[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instance restriction



From: Kevin Hammond <kh@cs.glasgow.ac.uk>
Date: Tue, 11 Sep 90 10:20:19 BST
To: haskell@cs.glasgow.ac.uk, mleone@cs.cmu.edu
Subject: Re:  Instance restriction
Sender: haskell-request@cs.glasgow.ac.uk

> In particular, note that the form of an "inst" is severely restricted.
> However, consider a more general definition:
> 
>    inst'   ::= tcon
>              | (tcon type_1 ... type_k)
>              | (type_1, ..., type_k)
>              | ()
>              | [ type ]
>              | type -> type
> 
> It seems to me that the programmer can achieve this effect by simply
> adding a type synonym to his program!

False.  Only data types may appear in instances.  This is to avoid
exactly the kind of ambiguity that would be introduced by allowing
general types in instance declarations (and which we don't know how to
resolve).  This restriction appears on p.27 of the Haskell report.

Kevin