[Haskell-cafe] Re: Function Type Calculation (Take 2)
Brent Yorgey
byorgey at gmail.com
Fri May 2 11:45:21 EDT 2008
> unification
> f :: a = h = (e -> d -> c)
> x b = d
>
> No. x :: b = d (a typo?)
> Paul: What's wrong with x being of type b and of type d?
> Could you perhaps explain the error please?
>
Nothing's wrong, you just forgot a ::, that is, you wrote x b = d instead
of x :: b = d.
>
>
> Don't forget also that
>
> funk :: a -> b -> c = h -> e,
>
> which means that e = b -> c
> Paul: is that something to do with partial application?
> (funk f) is a partially applied function, correct? Again an explanation
> would be appreciated.
>
It's because function arrows associate to the right, so a -> b -> c is
really shorthand for (a -> (b -> c)). If (a -> (b -> c)) = h -> e, then a =
h and (b -> c) = e.
-Brent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080502/32e97ed3/attachment.htm
More information about the Haskell-Cafe
mailing list