type aliases in instances

Bernhard Reus bernhard@cogs.susx.ac.uk
Mon, 11 Mar 2002 13:06:58 +0000

Richard Uhtenwoldt wrote:
> I do not have experience commposing monads (maybe John Hughes can
> chime in?), but I'll address where Bernhard Reus writes:
> >This can be avoided by using type
> >aliases but then the monads in use cannot be instances of the Monad
> >class.
> >But not declaring the monads to be in class Monad can hardly
> >be good style, can it?
> GHC's source code defines many monads not in class Monad.
> I'll write some untested code to give an idea of
> the naming conventions used:
> type FooMd out = (a,b,c)->((a,b,c),out)
> returnFooMd out = \s0->out
> thenFooMd p k = \s0->let (s,out) = p s0

Thanks Richard. So this means it is common practice in the Haskell
community to use type aliases and not to declare the monads as

But that makes me even more curious. Why are type aliases not allowed in
instance declarations? I haven't found an explanation in the language
doc. Does anybody know the exact reason?   Any pointer appreciated.