[Haskell] Re: Context of a pattern variable [ERRATA]

2005-01-11 Thread Tomasz Zielonka
Below are corrections of embarassing mistakes in my examples, pointed out by Wolfram and Stefan Holdermans. On Tue, Jan 11, 2005 at 11:12:04PM +0100, Tomasz Zielonka wrote: > before: > > case t of > (x, y, z) -> (x, y, z+1) > > after: > > case t of > (_, _, ctx @> z) -> ctx z

Re: [Haskell] Context of a pattern variable

2005-01-11 Thread Tomasz Zielonka
On Wed, Jan 12, 2005 at 01:02:43AM +0100, Stefan Holdermans wrote: > Furthermore, I think with this syntax, it is just too easy to get > wrong. Maybe I'm mistaken, but, to illustrate, I believe there's even > an error in the very examples given by you: > > >after: > > > > case t of > > (_

Re: [Haskell] Re: Context of a pattern variable

2005-01-11 Thread Tomasz Zielonka
On Tue, Jan 11, 2005 at 06:30:02PM -0500, Stefan Monnier wrote: > > case t of > > (x, y, z) -> (x, y, z+1) > > How would you do: > > case t of > (x, y, z, a, b, c) -> (x+1, y, z, a, b, c+2) > > would you allow: > > case t of > (ctx @> x, _, _, _, _, ctx @> c) ->

Re: [Haskell] Re: Context of a pattern variable

2005-01-11 Thread kahl
Tomasz Zielonka <[EMAIL PROTECTED]> proposed an interesting kind of ``second-order as-patterns'' that are ``safe'' from the usual problems of second-order matching by virtue of fixing (at least) the spine of the images of the second-order variables. Tomasz' first example (incorporating Stefan Hold

Re: [Haskell] Context of a pattern variable

2005-01-11 Thread Stefan Holdermans
Tomasz, I have an idea for a funny extension to pattern matching in Haskell. I wonder if it was proposed before, and most importantly, if it would be seen as useful. I haven't seen anything like this before, which if of course not to say that there has never been made a similar proposal before.

[Haskell] Re: Context of a pattern variable

2005-01-11 Thread Stefan Monnier
> case t of > (x, y, z) -> (x, y, z+1) How would you do: case t of (x, y, z, a, b, c) -> (x+1, y, z, a, b, c+2) would you allow: case t of (ctx @> x, _, _, _, _, ctx @> c) -> ctx (x+1) (c+2) -- Stefan ___ Haskell mai

[Haskell] Context of a pattern variable

2005-01-11 Thread Tomasz Zielonka
Hello! I have an idea for a funny extension to pattern matching in Haskell. I wonder if it was proposed before, and most importantly, if it would be seen as useful. Currently, pattern variables get only the values of the corresponding subterms of a matched term. What if we could mark a pattern va

[Haskell] GADT and constraints [Was: Rebindable syntax for monads and arrows]

2005-01-11 Thread Martin Sulzmann
Hi, > I can't understand how constraints float at all. In the following code: > Ex1: > > class Foo1 a where foo1 :: a -> String > > class Foo2 a where foo2 :: a -> String > > > > instance Foo1 Bool where foo1 _ = "Bool" > > instance Foo2 Char where foo2 _ = "Char" > > > > data U a wh