instance heads (was Re: DData modules)

14 Jan
2005
14 Jan
'05
11:15 a.m.
On Thu, Jan 13, 2005 at 02:56:31PM +0000, Ross Paterson wrote:
On Thu, Jan 13, 2005 at 02:13:08PM +0000, Malcolm Wallace wrote:
In what sense is instance Monoid (a -> a) not Haskell'98? It looks perfectly OK to me. Is it because the two type variable arguments to (->) are the same?
Yes -- the Report even makes an example of instance C (a,a). But it seems that nhc98 implements this extension.
Nhc98 doesn't really implement it. Try class C a where twist :: a -> a instance C (a,a) where twist (x,y) = (y,x) main = print (twist ('a',True)) which is incorrectly accepted, causing runtime trouble. Also, the other two examples in that section of the Report cause compile-time crashes: instance C (Int,a) instance C [[a]]
7431
Age (days ago)
7431
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ross Paterson