Skip to content
Snippets Groups Projects
Commit 83449fda authored by Alice Brenon's avatar Alice Brenon
Browse files

Spice things up with a little JSON for the Book type

parent 7a005ff8
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,8 @@ library ...@@ -35,7 +35,8 @@ library
-- LANGUAGE extensions used by modules in this package. -- LANGUAGE extensions used by modules in this package.
-- other-extensions: -- other-extensions:
build-depends: base >=4.16 && <4.17 build-depends: aeson >= 2.0.3.0 && <2.1
, base >=4.16 && <4.17
, bytestring >= 0.11.3 && <0.12 , bytestring >= 0.11.3 && <0.12
, containers >= 0.6.5.1 && <0.7 , containers >= 0.6.5.1 && <0.7
, cassava >= 0.5.3 && <0.6 , cassava >= 0.5.3 && <0.6
......
(use-modules ((gnu packages haskell-xyz) #:select (ghc-cassava (use-modules ((gnu packages haskell-xyz) #:select (ghc-cassava
ghc-optparse-applicative)) ghc-optparse-applicative))
((gnu packages haskell-check) #:select (ghc-hunit)) ((gnu packages haskell-check) #:select (ghc-hunit))
((gnu packages haskell-web) #:select (ghc-aeson))
((guix build-system haskell) #:select (haskell-build-system)) ((guix build-system haskell) #:select (haskell-build-system))
((guix git-download) #:select (git-predicate)) ((guix git-download) #:select (git-predicate))
((guix gexp) #:select (local-file)) ((guix gexp) #:select (local-file))
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
#:recursive? #t #:recursive? #t
#:select? (git-predicate %source-dir))) #:select? (git-predicate %source-dir)))
(build-system haskell-build-system) (build-system haskell-build-system)
(inputs (list ghc-cassava ghc-optparse-applicative ghc-hunit)) (inputs (list ghc-aeson ghc-cassava ghc-optparse-applicative ghc-hunit))
(home-page "https://gitlab.liris.cnrs.fr/geode/ghc-geode") (home-page "https://gitlab.liris.cnrs.fr/geode/ghc-geode")
(synopsis "Data structures and tooling used in project GEODE") (synopsis "Data structures and tooling used in project GEODE")
(description (description
......
...@@ -5,6 +5,7 @@ module GEODE.Metadata.PrimaryKey ...@@ -5,6 +5,7 @@ module GEODE.Metadata.PrimaryKey
, relativePath , relativePath
, uid ) where , uid ) where
import Data.Aeson (ToJSON(..))
import Data.Csv (FromField(..), FromNamedRecord(..), ToNamedRecord(..), ToField(..)) import Data.Csv (FromField(..), FromNamedRecord(..), ToNamedRecord(..), ToField(..))
import GEODE.Metadata.Types (Has(..)) import GEODE.Metadata.Types (Has(..))
import GEODE.Metadata.TSV.Header (DefaultFields(..), HasDefaultHeader(..)) import GEODE.Metadata.TSV.Header (DefaultFields(..), HasDefaultHeader(..))
...@@ -23,6 +24,9 @@ instance FromField Book where ...@@ -23,6 +24,9 @@ instance FromField Book where
instance ToField Book where instance ToField Book where
toField = toField . show toField = toField . show
instance ToJSON Book where
toJSON = toJSON . show
data PrimaryKey = PrimaryKey data PrimaryKey = PrimaryKey
{ book :: Book { book :: Book
, tome :: Int , tome :: Int
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment