Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit ca3101d

Browse files
committed
Serialize sums.
1 parent d15b031 commit ca3101d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Serializing/SExpression/Precise.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE FlexibleContexts, FlexibleInstances, OverloadedStrings #-}
1+
{-# LANGUAGE FlexibleContexts, FlexibleInstances, OverloadedStrings, TypeOperators #-}
22
module Serializing.SExpression.Precise
33
( serializeSExpression
44
) where
@@ -20,5 +20,9 @@ class GToSExpression f where
2020
instance GToSExpression f => GToSExpression (M1 D d f) where
2121
gtoSExpression' = gtoSExpression' . unM1
2222

23+
instance (GToSExpression f, GToSExpression g) => GToSExpression (f :+: g) where
24+
gtoSExpression' (L1 l) = gtoSExpression' l
25+
gtoSExpression' (R1 r) = gtoSExpression' r
26+
2327
instance (Constructor c, GToSExpression f) => GToSExpression (M1 C c f) where
2428
gtoSExpression' m n = stringUtf8 (conName m) : gtoSExpression' (unM1 m) (n + 1)

0 commit comments

Comments
 (0)