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? -- Ashley Yakeley, Seattle WA
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
On 19-Feb-2001, Ashley Yakeley <ashley@semantic.org> 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.
Right. So by definition, it does.
Yet it doesn't seem possible to declare the type constructor an instance of a class: ... Hugs gives: (line 6): Not enough arguments for type synonym "T"
That is also correct. As the Haskell Report section 4.2.2 says: | Type constructor symbols T introduced by type synonym declarations | cannot be partially applied; it is a static error to use T without the | full number of arguments.
So is T a real type constructor or not?
The Haskell 98 Report does not define the term "real type constructor". So this is one of those existential philosphical debates about terminology ;-) Personally I would describe the type constructors introduced by type synonym declarations as "real", but not "first class". -- Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit | of excellence is a lethal habit" WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
participants (3)
-
Ashley Yakeley -
Fergus Henderson -
Zhanyong Wan