logo       

no non-typevariable in instance declarations: msg#00051

lang.haskell.general

Subject: no non-typevariable in instance declarations

Hello.

I found that Hugs differs from GHC 4.08.1 and from NHC98 1.00
in instance declarations where the instance head has only
type variables: Hugs accepts them while the other two rejects.

Attached is a small program that demonstrates it.

Hugs happily runs the program and outputs the list

["NUM","Integer","NUM"]

NHC98 spits the message

In file ./t.hs:
6:23 Found a but expected one of [ ( <conid>

GHC is more verbose in its message:

t.hs:6:
Illegal instance declaration for `C a'
(There must be at least one non-type-variable in the instance head)

Compilation had errors

Why GHC and NHC98 are more restrictive than Hugs?

This style of instantiation would be very helpful when
dealing with type extensions in Haskell (based on classes
to provide the interface for common operations on
the extendable type).

Regards,

Romildo
--
Prof. José Romildo Malaquias <romildo@xxxxxxxxxxxx>
Departamento de Computação
Universidade Federal de Ouro Preto
Brasil

Attachment: t.hs
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise