[Haskell-cafe] passing a polymorphic function as a parameter vs using it directly in a function definition

Felipe Lessa felipe.lessa at gmail.com
Thu Jul 15 09:37:23 EDT 2010


On Thu, Jul 15, 2010 at 9:20 AM, Pasqualino "Titto" Assini
<tittoassini at gmail.com> wrote:
> Many thanks for the explanation.
>
> But I thought that GHC always derives the most generic type, why does
> it fix my 'a' to 'Int' ?

Inferring the type of higher ranked functions is problematic, so GHC
never does this by itself.  See [1].

[1] http://www.haskell.org/ghc/docs/6.12.1/html/users_guide/other-type-extensions.html#id3027672

HTH,

-- 
Felipe.


More information about the Haskell-Cafe mailing list