[Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread DavidA
Hi, I have the following code: {-# LANGUAGE TypeSynonymInstances #-} data Vect k b = V [(k,b)] -- vector space over field k with basis b -- for example, V [(5, E 1), (7, E 2)] would represent the vector 5 e1 + 7 e2 data Monomial v = M [(v,Int)] -- monomials over variables v -- for example, M

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Christopher Done
Maybe -XLiberalTypeSynonyms is an option: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/data-type-extensions.html#type-synonyms On 29 September 2010 20:08, DavidA polyom...@f2s.com wrote: Hi, I have the following code: {-# LANGUAGE TypeSynonymInstances #-} data Vect k b = V

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Ryan Ingram
On Wed, Sep 29, 2010 at 11:08 AM, DavidA polyom...@f2s.com wrote: Hi, I have the following code: {-# LANGUAGE TypeSynonymInstances #-} data Vect k b = V [(k,b)] -- vector space over field k with basis b -- for example, V [(5, E 1), (7, E 2)] would represent the vector 5 e1 + 7 e2 data

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Christopher Done
On 29 September 2010 20:48, Ryan Ingram ryani.s...@gmail.com wrote: But it doesn't let you partially apply the type synonym. On the other hand, if you did this: newtype Compose f g a = O { unO :: f (g a) } type Poly k = Compose (Vect k) Monomial instance Monad (Poly k) where ... would

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Dan Doel
On Wednesday 29 September 2010 2:52:21 pm Christopher Done wrote: LiberalTypeSynonyms lets you partially apply type synonyms. Not in general. LiberalTypeSynonyms only allows synonyms to be partially applied when expansions of other type synonyms will eventually cause them to become fully