File: JSON.hs

package info (click to toggle)
haskell-pandoc-citeproc 0.14.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,588 kB
  • sloc: xml: 14,814; haskell: 7,752; makefile: 13
file content (14 lines) | stat: -rw-r--r-- 485 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- ToJSON/FromJSON instances for Style
module JSON where
import Prelude
import           Data.Aeson
import qualified Data.ByteString.Lazy as L
import qualified Data.Text.Encoding   as T
import           Text.CSL.Parser
import           Text.CSL.Style

instance FromJSON Style where
  parseJSON (String s) = return $ parseCSL' $ L.fromChunks [T.encodeUtf8 s]
  parseJSON _          = fail "Could not parse Style"