diff --git a/src/Serializing/Format.hs b/src/Serializing/Format.hs index d897a24e9..bc5b716ba 100644 --- a/src/Serializing/Format.hs +++ b/src/Serializing/Format.hs @@ -7,14 +7,18 @@ module Serializing.Format import Algebra.Graph.Class import Data.ByteString.Builder +import Prologue import Serializing.DOT +import Serializing.SExpression data Format input where - DOT :: (Ord vertex, ToGraph graph, ToVertex graph ~ vertex) => Style vertex Builder -> Format graph - Show :: Show input => Format input + DOT :: (Ord vertex, ToGraph graph, ToVertex graph ~ vertex) => Style vertex Builder -> Format graph + SExpression :: (Recursive input, ToSExpression (Base input)) => Format input + Show :: Show input => Format input runSerialize :: Format input -> input -> Builder runSerialize (DOT style) graph = serializeDOT style graph +runSerialize SExpression input = serializeSExpression input runSerialize Show input = stringUtf8 (show input) -- TODO: it would be kinda neat if we could use pretty-show/hscolour for Show output