RE: [Haskell-cafe] closed classes [was: Re: exceptions vs. Either]

2004-08-09 Thread C T McBride
Hi On Mon, 9 Aug 2004, Simon Peyton-Jones wrote: Closed classes are certainly interesting, but a better way to go in this case is to allow the programmer to declear new kinds, as well as new types. This is what Tim Sheard's language Omega lets you do, and I'm considering adding it to GHC.

Re: overlapping instances and functional dependencies

2003-08-21 Thread C T McBride
Hi all With overlapping instances, I'm allowed class OK x y instance Functor f = OK (f x) (f y) instance Functor f = OK x (f y) but I'm not allowed class Bad x y z | x y - z instance Functor f = Bad (f x) (f y) Bool instance Functor f = Bad x (f y) Int I don't quite see why.

Re: Monads and Maybe

2003-08-21 Thread C T McBride
Hi Or, more generally, infixl 9 $ ($) :: Monad m = m (s - t) - m s - m t mf $ ms = do f - mf s - ms return (f s) or just liftM2 ($) or just ap OK, I'm a bad citizen and I never look things up in the library. If it isn't in the Gentle Introduction

RE: Language extension proposal

2003-06-30 Thread C T McBride
Hi There's nothing wrong with this in principle; the difficulty is that when you say mantissa + 4 you aren't saying which float type to get the mantissa of. Earlier messages have outlined workarounds, but in some ways the real solution is to provide a syntax for type application.

Re: duplicate instance declarations

2002-05-03 Thread C T McBride
Hi Why is this a duplicate instance declaration: class C a class D b data T a b instance (C (T a b), C a) = D b instance (C (T a b), C b) = D a These are symmetric, but not duplicate, as I see it. Suppose we add instance C () instance C (T () ()) Now there are two ways to

Re: deriving over renamed types

2002-04-09 Thread C T McBride
Hi Lennart wrote: I was referring to the expression language. So this is already allowed: f :: (forall a . a - a) - (b, c) - (c ,b ) f i (x,y) = (i y, i x) I'd like to be able to have explicit type applications. If we denote type application with infix # I'd like to write f i (x, y)

Re: deriving over renamed types

2002-04-06 Thread C T McBride
Hi On Fri, 5 Apr 2002, Ashley Yakeley wrote: At 2002-04-04 05:57, C T McBride wrote: ...which would be very useful, but would probably have unpleasant consequences for type inference... To my mind, this is not a credible objection. The horse has already bolted; there's no point

Re: deriving over renamed types

2002-04-04 Thread C T McBride
Hi all, At 2002-04-03 15:14, Hal Daume III wrote: type FM = FiniteMap type FM a b = FiniteMap a b I wasn't aware there was (supposed to be) a difference between these two declarations? Is there? On Wed, 3 Apr 2002, Ashley Yakeley wrote: type FM a b = FiniteMap a b ...This

Re: higher-kind deriving ... or not

2002-02-27 Thread C T McBride
Hi On Thu, 28 Feb 2002, Tom Pledger wrote: C T McBride writes: | data Fix f = Fix (f (Fix f)) | | There's no equivalent first-order definition. This is where | higher-kind parameters actually buy us extra stuff, and it's also the | point at which the first-order constraint for show

higher-kind deriving ... or not

2002-02-26 Thread C T McBride
Hi I'm rather fond of fixpoint constructions like this one: newtype Copy a = Copy a deriving Show data Wonky f = Wonky | Manky (f (Wonky f)) deriving Show (Clearly this is an ill-motivated example, but the real example which caused this problem is available on request...) The

Re: Reference types

2002-02-05 Thread C T McBride
Hi Simon On Tue, 5 Feb 2002, Simon Peyton-Jones wrote: 2. I'd be interested to know of any other examples you have of *bi-directional* functional depenencies. The above simplification nukes my only convincing example. (Usually one set of type variables determines another, but

Re: BAL paper available

2001-05-16 Thread C T McBride
On Wed, 16 May 2001, Stefan Karrmann wrote: On Tue, May 15, 2001 at 09:14:02PM +0300, Dylan Thurston wrote: On Tue, May 15, 2001 at 06:33:41PM +0200, Jerzy Karczmarczuk wrote: Serge Mechveliani : ... The matter was always in parametric domains ... Whoever tried to program real

Re: argument permutation and fundeps

2001-05-10 Thread C T McBride
C T McBride wrote: Hi This is a long message, containing a program which makes heavy use of type classes with functional dependencies, and a query about how the typechecker treats them. It might be a bit of an effort, but I'd be grateful for any comment and advice more experienced