RE: Rank-2 polymorphism and pattern matching

2008-01-07 Thread Simon Peyton-Jones
Jim | My reason for wanting pattern matching on values of polymorphic types | is a kind of first-level refinement types. I'm going to demonstrate | using the risers function, as presented in Dana N. Xu's ESC/Haskell, which | references Neil Mitchell's Catch. I didn't follow all the details, but

Re: Rank-2 polymorphism and pattern matching

2008-01-07 Thread Jim Apple
On Jan 7, 2008 1:37 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: Sadly, it's not true in Haskell, is it? (error urk) : [] also has type (forall a. [a]). It is a bit sad, but I think that's The Curse of The _|_, which infects any attempt to add static assurance. It's nicer if

Re: Rank-2 polymorphism and pattern matching

2008-01-06 Thread Jim Apple
On Jan 4, 2008 5:15 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: | The following won't compile for me | | isnull :: (forall a . [a]) - Bool | isnull ([] :: forall b . [b]) = True | | Couldn't match expected type `forall b. [b]' | against inferred type `[a]' |

RE: Rank-2 polymorphism and pattern matching

2008-01-04 Thread Simon Peyton-Jones
| The following won't compile for me | | isnull :: (forall a . [a]) - Bool | isnull ([] :: forall b . [b]) = True | | Couldn't match expected type `forall b. [b]' | against inferred type `[a]' | In the pattern: [] This is a pretty strange thing to do, to match a

Rank-2 polymorphism and pattern matching

2007-12-28 Thread Jim Apple
The following won't compile for me isnull :: (forall a . [a]) - Bool isnull ([] :: forall b . [b]) = True Couldn't match expected type `forall b. [b]' against inferred type `[a]' In the pattern: [] Wrapping it in a constructor doesn't help, though I can define a null: data