1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 16:33:03 +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 }
instance JSON a => JSON (JSONWrapper (Row a)) where
showJSON (JSONWrapper (Row left right)) = JSObject $ toJSObject [("left", showLine left), ("right", showLine right)]
where showLine EmptyLine = JSNull
showLine (Line a) = showJSONs (toList a)
showJSON (JSONWrapper (Row left right)) = JSObject $ toJSObject [("left", showJSON (JSONWrapper left)), ("right", showJSON (JSONWrapper right))]
instance JSON a => JSON (JSONWrapper (Line a)) where
showJSON (JSONWrapper EmptyLine) = JSNull