[Haskell-cafe] Type synonyms

Dan Doel dan.doel at gmail.com
Wed Mar 26 10:39:35 EDT 2008

On Wednesday 26 March 2008, Hugo Pacheco wrote:
> Hi guys,
> There is something I think not to fully understand: what are the
> differences between these two type synonyms?
> type FInt x = Either One x
> type FInt = Either One
> Their kind is the same, so do they differ or are exactly the same type?

The difference comes in that type synonyms must be fully applied to all the 
type parameters listed in their declaration. So, for instance, with the 
second, you could declare (with a type synonym instances extension), say:

    instance Monad FInt where ...

But you could not with the first, because FInt would be partially applied; the 
first needs to always appear as 'FInt x' for some x.

-- Dan

More information about the Haskell-Cafe mailing list