Discussion:
[Haskell-cafe] find functions that produce / consume a type?
Johannes Waldmann
2018-11-09 09:59:03 UTC
Permalink
Dear Cafe,

can we automate something like the following

for any type T that appears in signatures (shown by haddock),
add (separate) lists of "functions that produce T",
"functions that consume T".

Hoogle can type-search approximately, but
* it would always (want to) match the full type AST
(matching with a subtree incurs a penalty?),
* and not distinguish between producer and consumer?

E.g.,
https://ndmitchell.com/downloads/slides-hoogle_finding_functions_from_types-16_may_2011.pdf
Slide #29 "Per Argument Searching"
uses "search arguments", "search results" -
only to merge the results immediately.
Can we keep them separate?

- J.W.
Eric Seidel
2018-11-11 14:45:43 UTC
Permalink
Hoogle does let you restrict the search to the output type by prefixing your query with “::”. For example, “:: Maybe a” produces a list of functions that return a Maybe.

https://www.haskell.org/hoogle/?hoogle=%3A%3A+Maybe+a

Unfortunately this doesn’t seem to work in the new Hoogle hosted at hoogle.haskell.org.

Sent from my iPhone
Post by Johannes Waldmann
Dear Cafe,
can we automate something like the following
for any type T that appears in signatures (shown by haddock),
add (separate) lists of "functions that produce T",
"functions that consume T".
Hoogle can type-search approximately, but
* it would always (want to) match the full type AST
(matching with a subtree incurs a penalty?),
* and not distinguish between producer and consumer?
E.g.,
https://ndmitchell.com/downloads/slides-hoogle_finding_functions_from_types-16_may_2011.pdf
Slide #29 "Per Argument Searching"
uses "search arguments", "search results" -
only to merge the results immediately.
Can we keep them separate?
- J.W.
_______________________________________________
Haskell-Cafe mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Loading...