[Haskell-cafe] Position of a constraint in a function's signature

Brandon Allbery allbery.b at gmail.com
Tue May 16 00:47:17 UTC 2017


On Mon, May 15, 2017 at 6:55 PM, William Yager <will.yager at gmail.com> wrote:

> "C => T" means (or is equivalent to) "A function which takes an implicit
> parameter C and returns a T". There's no particular reason this can't show
> up on the RHS of a "->" arrow.


The Report requires that all constraints be in a tuple before the rest of a
signature. ghc relaxes this since it implements not Haskell 2010, but
System FC. But yes, this is why it's syntactically correct once you enable
any extension that liberalizes type signature parsing. (Even without, ghc
permits constraint => constraint ... => type for reasons that iirc are hard
to "fix" and are not really considered bugs, just not Haskell 2010 syntax;
but ghc's Haskell 2010 support broke when Num lost Eq and Show
superclasses, and broke further when Monad gained Applicative
prerequisite/"superclass", so nobody's much worried about the Report
violation.)

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170515/2c24a0e5/attachment.html>


More information about the Haskell-Cafe mailing list