Newsgroups: fa.haskell
From: Benjamin Franksen <benjamin.frank...@bessy.de>
Date: Fri, 12 Jan 2007 10:57:39 UTC
Local: Fri, Jan 12 2007 5:57 am
Subject: Re: [Haskell-cafe] Re: Monad Set via GADT
On Friday 12 January 2007 09:04, Simon Peyton-Jones wrote:
> | > On 1/3/07, Roberto Zunino <zun...@di.unipi.it> wrote: Crystal clear. My remark was meant merely as a general observation. > | >> 1) Why the first version did not typececk? > | > > | > 1) Class constraints can't be used on pattern matching. They ARE > | > restrictive on construction, however. This is arguably bug in the > | > Haskell standard. It is fixed in GHC HEAD for datatypes declared > | > in the GADT way, so as not to break H98 code: > | > | http://article.gmane.org/gmane.comp.lang.haskell.cvs.all/29458/matc > |h=gadt+class+context > | > | To quote from there: "I think this is stupid, but it's what H98 > | says." > | > | Maybe it is time to consider it deprecated to follow the Haskell 98 > | standard /to the letter/. > GHC follows this strange standard when you write data type decls in > data Eq a => T a = C a Int | D > Here, pattern-matching on either C or D will cause an (Eq a) > However, GHC does *not* follow this convention when you write the > data T a where > Here, (a) you can be selective; in this case, C has the context but D > In short, in GADT-style syntax, GHC is free to do as it pleases, so > All of this is documented in the user manual. If it's not clear, Cheers You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||