This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C2C381.9C49B970 Content-Type: text/plain In papers about parser combinators based on Haskell, usually a class is defined along the following lines (here in Clean syntax): class P p where fail :: p s r alt :: (p s r) (p s r) -> p s r sq :: (p s r) (r -> p s t) -> p s t suc :: r -> p s r Never mind the precise details here. Then an instance for a concrete parser-type should be made. But the only concrete types I can imagine here are synonym-types, because parsers are functions. For 'instance': :: Parser s r :== [s] -> [(r,[s])] // the traditional list-of-successes implementation instance P Parser where fail = \ss -> [] alt p1 p2 = \ss -> (p1 ss) ++ (p2 ss) sq p f = \ss -> [f r1 ss1 \\ (r1,ss1) <- p ss] suc r = \ss -> [(r,ss)] Last time I tried something like this in Clean, the compiler complained: Error [tests.icl,14,P]: Parser type synonym used as instance My question is: is this a serious disadvantage of Clean compared to Haskell? Regards Erik Zuurbier ------_=_NextPart_001_01C2C381.9C49B970 Content-Type: text/html Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">Synonym types as instances In papers about parser combinators = based on Haskell, usually a class is defined along the following lines = (here in Clean syntax):
class P p where
fail :: p s r
alt :: (p s r) (p s r) -> p s r
sq :: (p s r) (r -> p s t) -> p s t
suc :: r -> p s r
=20
Never mind the precise details here. = Then an instance for a concrete parser-type should be made. But the = only concrete types I can imagine here are synonym-types, because = parsers are functions. For 'instance'::: Parser s r :=3D=3D [s] -> = [(r,[s])] // the traditional = list-of-successes implementation
instance P Parser
where = fail =3D = \ss -> []
alt p1 p2 =3D \ss = -> (p1 ss) ++ (p2 ss)
sq p f = =3D \ss -> [f r1 ss1 \\ (r1,ss1) <- p ss]
suc = r =3D \ss -> [(r,ss)]Last time I tried something like this = in Clean, the compiler complained:
Error [tests.icl,14,P]: Parser type = synonym used as instance
My question is: is this a serious = disadvantage of Clean compared to Haskell?
Regards Erik Zuurbier
------_=_NextPart_001_01C2C381.9C49B970--