diff --git a/src/app/MetaBrush/Document/Serialise.hs b/src/app/MetaBrush/Document/Serialise.hs index e30c10d..0f05739 100644 --- a/src/app/MetaBrush/Document/Serialise.hs +++ b/src/app/MetaBrush/Document/Serialise.hs @@ -39,6 +39,8 @@ import Data.STRef ( newSTRef ) import Data.Type.Equality ( (:~:)(Refl) ) +import Data.Version + ( Version(versionBranch) ) import GHC.Exts ( Proxy#, proxy# ) import GHC.TypeLits @@ -146,7 +148,7 @@ import qualified Waargonaut.Encode as JSON ( Encoder ) import qualified Waargonaut.Encode as JSON.Encoder ( runEncoder, runPureEncoder - , atKey', bool, json, keyValueTupleFoldable, list, mapLikeObj, scientific, text, either + , atKey', bool, int, json, keyValueTupleFoldable, list, mapLikeObj, scientific, text, either ) import qualified Waargonaut.Encode.Builder as JSON.Builder ( waargonautBuilder, bsBuilder ) @@ -201,6 +203,8 @@ import MetaBrush.MetaParameter.Driver ( SomeBrushFunction(..), interpretBrush ) import MetaBrush.Unique ( Unique, UniqueSupply, freshUnique ) +import qualified Paths_MetaBrush as Cabal + ( version ) -------------------------------------------------------------------------------- @@ -760,7 +764,8 @@ decodeDocumentContent uniqueSupply = do encodeDocument :: Applicative f => JSON.Encoder f Document encodeDocument = JSON.Encoder.mapLikeObj \ ( Document { displayName, viewportCenter, zoomFactor, documentContent, documentBrushes } ) -> - JSON.Encoder.atKey' "name" JSON.Encoder.text displayName + JSON.Encoder.atKey' "version" ( JSON.Encoder.list JSON.Encoder.int ) ( versionBranch Cabal.version ) + . JSON.Encoder.atKey' "name" JSON.Encoder.text displayName . JSON.Encoder.atKey' "center" ( encoder @( Point2D Double ) ) viewportCenter . JSON.Encoder.atKey' "zoom" ( encoder @Double ) zoomFactor . JSON.Encoder.atKey' "content" ( encodeDocumentContent documentBrushes ) documentContent