Synonym Type Constructors

Zhanyong Wan zhanyong.wan@yale.edu
Mon, 19 Feb 2001 09:31:51 -0500


Ashley Yakeley wrote:
> 
> I don't know if this is a bug in Hugs 98, or whether it's a
> misunderstanding of mine.
> 
> The Haskell 98 Report Sec. 4.2.2 claims that 'type' introduces a new type
> constructor. Yet it doesn't seem possible to declare the type constructor
> an instance of a class:
> 
> --
> class MyClass c where
>         foo :: a -> c a
> 
> type T m = IO m
> 
> instance MyClass T where
>         foo = return
> --
> 
> Hugs gives:
> (line 6): Not enough arguments for type synonym "T"
> 
> So is T a real type constructor or not?

I haven't tried this in Haskell 98 mode yet, but I'm sure with the -98
flag, Hugs accepts:

  type T = IO

  instance MyClass T where ...

The problem is not what you suspected to be.  It is that you always have
to fully apply a type synonym.

-- Zhanyong Wan