[Haskell-cafe] Confused about type seen in the wild
Albert Y. C. Lai
trebla at vex.net
Thu Apr 10 16:27:39 UTC 2014
On 14-04-08 11:11 PM, Alexander Solla wrote:
> mathJaxField :: Monad m
>
> => RenderMessage (HandlerSite m) FormMessage
>
> => Field m MathJax
>
>
> Notice that there are two type arrows (=>). Interestingly,
>
>
> mathJaxField :: (Monad m
>
>
> , RenderMessage (HandlerSite m) FormMessage
>
>
> ) => Field m MathJax
>
>
>
> compiles too. So it looks like currying/uncurrying, at the type level. But when did this start? I'm using GHC 7.6.3
Yes, GHC accepts "X => Y => Z" and makes it "(X, Y) => Z". In fact, go
wilder:
whee :: Show a => Eq a => a => Bool
whee x = x == x && null (show x)
It is valid and it means (Show a, Eq a) => a -> Bool. Try it!
My understanding is that when the type checker has to support all those
generalizations like ConstraintKind, DataKinds, etc etc, it becomes so
general that some traditional distinctions vanish.
More information about the Haskell-Cafe
mailing list