summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/PGFtoHaskell.hs
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2017-03-22 22:25:21 +0000
committeraarne <aarne@chalmers.se>2017-03-22 22:25:21 +0000
commit1e3323514464e5940993b99bcfa2b020927d7a00 (patch)
tree8d370b78d7e3ee0bc550d7592d3e9c1968db7e19 /src/compiler/GF/Compile/PGFtoHaskell.hs
parentf09507cb0f9c5c72445db6327d90e10484d05baa (diff)
fixed a bug in Eq instance generation for GADT and lexical categories
Diffstat (limited to 'src/compiler/GF/Compile/PGFtoHaskell.hs')
-rw-r--r--src/compiler/GF/Compile/PGFtoHaskell.hs4
1 files changed, 3 insertions, 1 deletions
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 |