existential types and functional dependencies

Christian Maeder <[email protected]>
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
The following module is accepted by ghc (with -fglasgow-exts) but 
rejected by hugs:

module ParseAny where

class Syntax tag as | tag -> as where
     parse :: tag -> String -> as

data AnyAs = forall tag as. Syntax tag as =>
	     MkAs tag as

data AnyTag = forall tag as. Syntax tag as =>
	      MkTag tag

parseAny :: AnyTag -> String -> AnyAs
parseAny (MkTag tag) str = MkAs tag $ parse tag str

-- -------------------------------------------------------

Hugs mode: Restart with command line option +98 for Haskell 98 mode

Reading file "/home/linux-bkb/hugs/lib/hugs/libraries/Hugs/Prelude.hs":
Reading file "/home/linux-bkb/hugs/lib/hugs/libraries/Prelude.hs":
Reading file "ParseAny.hs":
Type checking
ERROR "ParseAny.hs":13 - Cannot justify constraints in explicitly typed 
binding
*** Expression    : parseAny
*** Type          : AnyTag -> String -> AnyAs
*** Given context : ()
*** Constraints   : Syntax _0 a

When I omit the functional dependency "| tag -> as", ghc yields a 
similar error

Cheers Christian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.