
Am Donnerstag 18 März 2010 22:34:48 schrieb Andrew Coppin:
Job Vranish wrote:
Hoogle is a great tool for finding haskell functions:
http://www.haskell.org/hoogle/
You can punch in the type of a function you want and it will give you a list of functions that might do what you need. Generalizing the types a bit usually helps. Searching for either m a -> n m a or IO a -> m a would give you 'lift' and 'liftIO' as one of the top results.
Is there a tool anywhere which can figure out how to construct a function with a specific type signature? Hoogle works if the thing you seek is a single function, but not so much if you need to throw several functions together.
(For example, the signature "x -> [x -> y] -> [y]" can be implemented by \ x -> map ($ x), but this is initially non-obvious.)
http://hackage.haskell.org/package/djinn does that, but it has serious limitations (it doesn't know [], and it doesn't accept recursive types, so you can't define a list-type yourself: Djinn> data List a = Nil | Cons a (List a) Error: Recursive types are not allowed: List ) So, no luck with x -> [x -> y] -> [y].