From 1e3323514464e5940993b99bcfa2b020927d7a00 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 22 Mar 2017 22:25:21 +0000 Subject: [PATCH] fixed a bug in Eq instance generation for GADT and lexical categories --- src/compiler/GF/Compile/PGFtoHaskell.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/GF/Compile/PGFtoHaskell.hs b/src/compiler/GF/Compile/PGFtoHaskell.hs index 8beafc8b3..24acc289a 100644 --- a/src/compiler/GF/Compile/PGFtoHaskell.hs +++ b/src/compiler/GF/Compile/PGFtoHaskell.hs @@ -168,7 +168,9 @@ hDatatypeGADT gId lexical (cat, rules) hEqGADT :: Prefix -> (OIdent -> Bool) -> (OIdent, [(OIdent, [OIdent])]) -> [String] hEqGADT gId lexical (cat, rules) | isListCat (cat,rules) = let r = listr cat in ["(" ++ patt "x" r ++ "," ++ patt "y" r ++ ") -> " ++ listeqs] - | otherwise = ["(" ++ patt "x" r ++ "," ++ patt "y" r ++ ") -> " ++ eqs r | r <- rules] + | otherwise = ["(" ++ patt "x" r ++ "," ++ patt "y" r ++ ") -> " ++ eqs r | r <- nonLexicalRules (lexical cat) rules] + ++ if lexical cat then ["(" ++ lexicalConstructor cat +++ "x" ++ "," ++ lexicalConstructor cat +++ "y" ++ ") -> x == y"] else [] + where patt s (f,xs) = unwords (gId f : mkSVars s (length xs)) eqs (_,xs) = unwords ("and" : "[" : intersperse "," [x ++ " == " ++ y |