mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
Don’t print L1/R1.
This commit is contained in:
parent
70b24a476d
commit
867a65c575
@ -28,14 +28,19 @@ instance (ToSExpressionBy strategy t, strategy ~ ToSExpressionStrategy t) => ToS
|
||||
toSExpression = toSExpression' @strategy
|
||||
|
||||
|
||||
data Strategy = Generic
|
||||
data Strategy = Generic | Custom
|
||||
|
||||
type family ToSExpressionStrategy (t :: * -> *) :: Strategy where
|
||||
ToSExpressionStrategy _ = 'Generic
|
||||
ToSExpressionStrategy (_ :+: _) = 'Custom
|
||||
ToSExpressionStrategy _ = 'Generic
|
||||
|
||||
class ToSExpressionBy (strategy :: Strategy) t where
|
||||
toSExpression' :: t ann -> Int -> Builder
|
||||
|
||||
instance (ToSExpression l, ToSExpression r) => ToSExpressionBy 'Custom (l :+: r) where
|
||||
toSExpression' (L1 l) = toSExpression l
|
||||
toSExpression' (R1 r) = toSExpression r
|
||||
|
||||
instance (Generic1 t, GToSExpression (Rep1 t)) => ToSExpressionBy 'Generic t where
|
||||
toSExpression' t n = nl n <> pad n <> "(" <> fold (intersperse " " (gtoSExpression (from1 t) n)) <> ")"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user