[Haskell-cafe] Re: Monad instance for partially applied type constructor?
Daniel Fischer
daniel.is.fischer at web.de
Wed Sep 29 17:41:13 EDT 2010
On Wednesday 29 September 2010 23:15:14, DavidA wrote:
> Ryan Ingram <ryani.spam <at> gmail.com> writes:
> > Haskell doesn't have true type functions; what you are really saying
> > is
> >
> > instance Monad (\v -> Vect k (Monomial v))
>
> Yes, that is exactly what I am trying to say. And since I'm not allowed
> to say it like that, I was trying to say it using a type synonym
> parameterised over v instead. It appears that GHC won't let you use
> partially applied type synonyms as type constructors for instance
> declarations. Is this simply because the GHC developers didn't think
> anyone would want to, or is there some theoretical reason why it's hard,
> or a bad idea?
>
I think there was a theoretical reason why that isn't allowed (making type
inference undecidable? I don't remember, I don't recall ...).
For your problem, maybe
data Vect k m b = Vect [(k, m b)]
instance Monad (Vect k Monomial) where ...
is an option?
More information about the Haskell-Cafe
mailing list