Well it might not be ambiguous.  Consider
        instance C Int b where...

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
| On Behalf Of Ross Paterson
| Sent: 11 December 2006 12:41
| To: glasgow-haskell-users@haskell.org
| Subject: Re: [Haskell] GHC Error question
|
| On Mon, Dec 11, 2006 at 12:16:06PM +0000, Simon Peyton-Jones wrote:
| > [...] Just to summarise, the difficulty is this:
| >         I have a dictionary of type (C a b1)
| >         I need a dictionary of type (C a b2)
| >         There is no functional dependency between C's parameters
| >
| > PS: the complete program is this:
| >         class C a b where
| >                 op :: a -> a
| >
| >         f :: C a b => a -> a
| >         f x = op x
|
| That raises a point I'd wondered about.  GHC requires only that each
| type variable in the context be reachable from the type via a chain
| of assertions:
|
| 
http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#type-restrictions
|
| What's the rationale for that, rather than calling types like the above
| type of f ambiguous?
|
| The examples given in the User's Guide involve functional dependencies,
| albeit obscured by superclasses
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to