Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Monad Set via GADT
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jim Apple  
View profile  
 More options Jan 8 2007, 8:52 pm
Newsgroups: fa.haskell
From: "Jim Apple" <jbapple+haskell-c...@gmail.com>
Date: Tue, 09 Jan 2007 01:52:13 UTC
Local: Mon, Jan 8 2007 8:52 pm
Subject: Re: [Haskell-cafe] Monad Set via GADT
On 1/3/07, Roberto Zunino <zun...@di.unipi.it> wrote:

> 1) Why the first version did not typececk?
> 2) Why the second one does?
> 3) If I replace (Teq a w) with (Teq w a), as in
>      SM :: Ord w => Teq w a -> Set.Set w -> SetM a
> then union above does not typecheck! Why? I guess the type variable
> unification deriving from matching Teq is not symmetric as I expect it
> to be...

These are very interesting questions that I forgot about until
reminded by Haskell Weekly News. Thanks, HWN!

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/match=...

2) The second one works because Class constraints can be used when
pattern matching existentials.

3) I imagine this might have something to do with the coercions that
System FC uses. With one ordering, a coercion might occur that in
another one is unnecessary. This coercion might allow the use of Ord w
by using it before the coercion from S.Set a to S.Set w.

#3 is just a guess.

Jim
_______________________________________________
Haskell-Cafe mailing list
Haskell-C...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


 
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.