GF.Grammar.Canonical: some Functor/Foldable/Traversable instances

This commit is contained in:
Thomas Hallgren
2019-03-13 01:51:26 +01:00
parent ba9aeb3322
commit b11d7d93dc
4 changed files with 24 additions and 19 deletions

View File

@@ -210,10 +210,10 @@ instance JSON a => JSON (RecordRow a) where
where fromRow (lbl, jsvalue) = do value <- readJSON jsvalue
return (RecordRow (LabelId lbl) value)
instance JSON TableRowValue where
showJSON (TableRowValue l v) = makeObj [(".pattern", showJSON l), (".value", showJSON v)]
instance JSON rhs => JSON (TableRow rhs) where
showJSON (TableRow l v) = makeObj [(".pattern", showJSON l), (".value", showJSON v)]
readJSON o = TableRowValue <$> o!".pattern" <*> o!".value"
readJSON o = TableRow <$> o!".pattern" <*> o!".value"
-- *** Identifiers in Concrete Syntax