1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Rename ToSExpressionWithStrategy to ToSExpressionBy.

This commit is contained in:
Rob Rix 2019-10-03 02:28:32 -04:00
parent 51abeb58ba
commit 09070aaf33
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -25,7 +25,7 @@ pad n = stringUtf8 (replicate (2 * n) ' ')
class ToSExpression t where
toSExpression :: t -> Int -> Builder
instance (ToSExpressionWithStrategy strategy t, strategy ~ ToSExpressionStrategy t) => ToSExpression t where
instance (ToSExpressionBy strategy t, strategy ~ ToSExpressionStrategy t) => ToSExpression t where
toSExpression = toSExpressionWithStrategy @strategy undefined
@ -35,13 +35,13 @@ type family ToSExpressionStrategy t :: Strategy where
ToSExpressionStrategy Text = 'Show
ToSExpressionStrategy _ = 'Generic
class ToSExpressionWithStrategy (strategy :: Strategy) t where
class ToSExpressionBy (strategy :: Strategy) t where
toSExpressionWithStrategy :: proxy strategy -> t -> Int -> Builder
instance Show t => ToSExpressionWithStrategy 'Show t where
instance Show t => ToSExpressionBy 'Show t where
toSExpressionWithStrategy _ t _ = stringUtf8 (show t)
instance (Generic t, GToSExpression (Rep t)) => ToSExpressionWithStrategy 'Generic t where
instance (Generic t, GToSExpression (Rep t)) => ToSExpressionBy 'Generic t where
toSExpressionWithStrategy _ t n = nl n <> pad n <> "(" <> fold (intersperse " " (gtoSExpression (from t) n)) <> ")"