1
1
mirror of https://github.com/github/semantic.git synced 2024-12-27 08:54:14 +03:00

Define the Row instance in terms of the Line instance.

This commit is contained in:
Rob Rix 2016-02-29 16:58:45 -05:00
parent 4bfe19f73c
commit d6d419e743

View File

@ -47,9 +47,7 @@ instance Show (JSON a) where
newtype JSONWrapper a = JSONWrapper { unWrap :: a } newtype JSONWrapper a = JSONWrapper { unWrap :: a }
instance JSON a => JSON (JSONWrapper (Row a)) where instance JSON a => JSON (JSONWrapper (Row a)) where
showJSON (JSONWrapper (Row left right)) = JSObject $ toJSObject [("left", showLine left), ("right", showLine right)] showJSON (JSONWrapper (Row left right)) = JSObject $ toJSObject [("left", showJSON (JSONWrapper left)), ("right", showJSON (JSONWrapper right))]
where showLine EmptyLine = JSNull
showLine (Line a) = showJSONs (toList a)
instance JSON a => JSON (JSONWrapper (Line a)) where instance JSON a => JSON (JSONWrapper (Line a)) where
showJSON (JSONWrapper EmptyLine) = JSNull showJSON (JSONWrapper EmptyLine) = JSNull