mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 14:53:37 +00:00
write cabal version number to .mb JSONs
This commit is contained in:
parent
89e21c2bf4
commit
70cab39947
|
@ -39,6 +39,8 @@ import Data.STRef
|
||||||
( newSTRef )
|
( newSTRef )
|
||||||
import Data.Type.Equality
|
import Data.Type.Equality
|
||||||
( (:~:)(Refl) )
|
( (:~:)(Refl) )
|
||||||
|
import Data.Version
|
||||||
|
( Version(versionBranch) )
|
||||||
import GHC.Exts
|
import GHC.Exts
|
||||||
( Proxy#, proxy# )
|
( Proxy#, proxy# )
|
||||||
import GHC.TypeLits
|
import GHC.TypeLits
|
||||||
|
@ -146,7 +148,7 @@ import qualified Waargonaut.Encode as JSON
|
||||||
( Encoder )
|
( Encoder )
|
||||||
import qualified Waargonaut.Encode as JSON.Encoder
|
import qualified Waargonaut.Encode as JSON.Encoder
|
||||||
( runEncoder, runPureEncoder
|
( 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
|
import qualified Waargonaut.Encode.Builder as JSON.Builder
|
||||||
( waargonautBuilder, bsBuilder )
|
( waargonautBuilder, bsBuilder )
|
||||||
|
@ -201,6 +203,8 @@ import MetaBrush.MetaParameter.Driver
|
||||||
( SomeBrushFunction(..), interpretBrush )
|
( SomeBrushFunction(..), interpretBrush )
|
||||||
import MetaBrush.Unique
|
import MetaBrush.Unique
|
||||||
( Unique, UniqueSupply, freshUnique )
|
( 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 :: Applicative f => JSON.Encoder f Document
|
||||||
encodeDocument = JSON.Encoder.mapLikeObj
|
encodeDocument = JSON.Encoder.mapLikeObj
|
||||||
\ ( Document { displayName, viewportCenter, zoomFactor, documentContent, documentBrushes } ) ->
|
\ ( 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' "center" ( encoder @( Point2D Double ) ) viewportCenter
|
||||||
. JSON.Encoder.atKey' "zoom" ( encoder @Double ) zoomFactor
|
. JSON.Encoder.atKey' "zoom" ( encoder @Double ) zoomFactor
|
||||||
. JSON.Encoder.atKey' "content" ( encodeDocumentContent documentBrushes ) documentContent
|
. JSON.Encoder.atKey' "content" ( encodeDocumentContent documentBrushes ) documentContent
|
||||||
|
|
Loading…
Reference in a new issue