How to find a Haskell function based on its type signature?

Viewed 110

For example, I haven't used Haskell in a while, and forgot the name of the const function, but remembered that its type signature is a -> b -> a.

1 Answers

Use Hoogle or Stackage. (See also related Stackoverflow answer.)

As far as I know, Stackage uses Hoogle underneath, but one may find its representation easier to read.

Just type any type signature that would be acceptable by Haskell, and browse the results.

Related