Question about use of | in a class declaration

Christian Sievers sievers@math2.nat.tu-bs.de
Wed, 21 Aug 2002 18:54:01 +0200


Simon Guest asked:

> Please could someone explain the meaning of | in this class declaration (from Andrew's example):
> 
> 	class (Ord k) => Map m k v | m -> k v where
> 	  lookupM :: m -> k -> Maybe v
> 
> I couldn't find reference to this in any of my standard Haskell tutorials, nor the Haskell 98 report.  Any references?

It might not have become clear from the previous answers:
this construction is not Haskell 98, but an extension.
That's why it's not in the report.

BTW: Already multi parameter type classes 
(such as  "class (Ord k) => Map m k v where ...")
                                ^ ^ ^ only one type variable allowed here
aren't Haskell 98.


All the best
Christian Sievers