{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE ScopedTypeVariables #-}
#if MIN_VERSION_base(4,8,0)
#define OVERLAPS {-# OVERLAPPING #-}
#else
{-# LANGUAGE OverlappingInstances #-}
#define OVERLAPS
#endif
module Text.CSL.Reference ( Literal(..)
, Value(..)
, ReferenceMap
, mkRefMap
, fromValue
, isValueSet
, Empty(..)
, Season(..)
, seasonToInt
, RefDate(..)
, handleLiteral
, toDatePart
, setCirca
, RefType(..)
, CNum(..)
, CLabel(..)
, Reference(..)
, emptyReference
, numericVars
, getReference
, processCites
, setPageFirst
, setNearNote
, parseEDTFDate
)
where
import Prelude
import Control.Applicative ((<|>))
import Control.Monad (guard, mplus, msum)
import Data.Aeson hiding (Value)
import qualified Data.Aeson as Aeson
import Data.Aeson.Types (Parser)
import Data.Char (isDigit, toLower, isPunctuation)
import Data.Either (lefts, rights)
import Data.Generics hiding (Generic)
import qualified Data.HashMap.Strict as H
import Data.List (find, elemIndex)
import Data.Maybe (fromMaybe, isNothing)
import Data.String
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Vector as V
import Data.Yaml.Builder (ToYaml (..))
import qualified Data.Yaml.Builder as Y
import GHC.Generics (Generic)
import Text.CSL.Style hiding (Number)
import Text.CSL.Util (camelize, capitalize, inlinesToString,
mapping', parseBool, parseInt, parseMaybeInt,
parseString, readNum, safeRead, trim,
uncamelize, AddYaml(..), splitStrWhen)
import Text.Pandoc (Inline (Str))
import qualified Text.Parsec as P
import qualified Text.Parsec.Text as P
newtype Literal = Literal { Literal -> Text
unLiteral :: Text }
deriving ( Int -> Literal -> ShowS
[Literal] -> ShowS
Literal -> String
(Int -> Literal -> ShowS)
-> (Literal -> String) -> ([Literal] -> ShowS) -> Show Literal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Literal] -> ShowS
$cshowList :: [Literal] -> ShowS
show :: Literal -> String
$cshow :: Literal -> String
showsPrec :: Int -> Literal -> ShowS
$cshowsPrec :: Int -> Literal -> ShowS
Show, ReadPrec [Literal]
ReadPrec Literal
Int -> ReadS Literal
ReadS [Literal]
(Int -> ReadS Literal)
-> ReadS [Literal]
-> ReadPrec Literal
-> ReadPrec [Literal]
-> Read Literal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Literal]
$creadListPrec :: ReadPrec [Literal]
readPrec :: ReadPrec Literal
$creadPrec :: ReadPrec Literal
readList :: ReadS [Literal]
$creadList :: ReadS [Literal]
readsPrec :: Int -> ReadS Literal
$creadsPrec :: Int -> ReadS Literal
Read, Literal -> Literal -> Bool
(Literal -> Literal -> Bool)
-> (Literal -> Literal -> Bool) -> Eq Literal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Literal -> Literal -> Bool
$c/= :: Literal -> Literal -> Bool
== :: Literal -> Literal -> Bool
$c== :: Literal -> Literal -> Bool
Eq, Typeable Literal
DataType
Constr
Typeable Literal
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Literal -> c Literal)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Literal)
-> (Literal -> Constr)
-> (Literal -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Literal))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Literal))
-> ((forall b. Data b => b -> b) -> Literal -> Literal)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r)
-> (forall u. (forall d. Data d => d -> u) -> Literal -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Literal -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal)
-> Data Literal
Literal -> DataType
Literal -> Constr
(forall b. Data b => b -> b) -> Literal -> Literal
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Literal -> c Literal
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Literal
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Literal -> u
forall u. (forall d. Data d => d -> u) -> Literal -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Literal
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Literal -> c Literal
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Literal)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Literal)
$cLiteral :: Constr
$tLiteral :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Literal -> m Literal
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal
gmapMp :: (forall d. Data d => d -> m d) -> Literal -> m Literal
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal
gmapM :: (forall d. Data d => d -> m d) -> Literal -> m Literal
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Literal -> m Literal
gmapQi :: Int -> (forall d. Data d => d -> u) -> Literal -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Literal -> u
gmapQ :: (forall d. Data d => d -> u) -> Literal -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Literal -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Literal -> r
gmapT :: (forall b. Data b => b -> b) -> Literal -> Literal
$cgmapT :: (forall b. Data b => b -> b) -> Literal -> Literal
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Literal)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Literal)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Literal)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Literal)
dataTypeOf :: Literal -> DataType
$cdataTypeOf :: Literal -> DataType
toConstr :: Literal -> Constr
$ctoConstr :: Literal -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Literal
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Literal
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Literal -> c Literal
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Literal -> c Literal
$cp1Data :: Typeable Literal
Data, Typeable, b -> Literal -> Literal
NonEmpty Literal -> Literal
Literal -> Literal -> Literal
(Literal -> Literal -> Literal)
-> (NonEmpty Literal -> Literal)
-> (forall b. Integral b => b -> Literal -> Literal)
-> Semigroup Literal
forall b. Integral b => b -> Literal -> Literal
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> Literal -> Literal
$cstimes :: forall b. Integral b => b -> Literal -> Literal
sconcat :: NonEmpty Literal -> Literal
$csconcat :: NonEmpty Literal -> Literal
<> :: Literal -> Literal -> Literal
$c<> :: Literal -> Literal -> Literal
Semigroup, Semigroup Literal
Literal
Semigroup Literal
-> Literal
-> (Literal -> Literal -> Literal)
-> ([Literal] -> Literal)
-> Monoid Literal
[Literal] -> Literal
Literal -> Literal -> Literal
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [Literal] -> Literal
$cmconcat :: [Literal] -> Literal
mappend :: Literal -> Literal -> Literal
$cmappend :: Literal -> Literal -> Literal
mempty :: Literal
$cmempty :: Literal
$cp1Monoid :: Semigroup Literal
Monoid, (forall x. Literal -> Rep Literal x)
-> (forall x. Rep Literal x -> Literal) -> Generic Literal
forall x. Rep Literal x -> Literal
forall x. Literal -> Rep Literal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Literal x -> Literal
$cfrom :: forall x. Literal -> Rep Literal x
Generic )
instance AddYaml Literal
where Text
x &= :: Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= (Literal Text
y) = Text
x Text -> Text -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Text
y
instance FromJSON Literal where
parseJSON :: Value -> Parser Literal
parseJSON Value
v = Text -> Literal
Literal (Text -> Literal) -> Parser Text -> Parser Literal
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Value -> Parser Text
parseString Value
v
instance ToJSON Literal where
toJSON :: Literal -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text -> Value) -> (Literal -> Text) -> Literal -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> Text
unLiteral
instance ToYaml Literal where
toYaml :: Literal -> YamlBuilder
toYaml = Text -> YamlBuilder
Y.string (Text -> YamlBuilder)
-> (Literal -> Text) -> Literal -> YamlBuilder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Literal -> Text
unLiteral
instance IsString Literal where
fromString :: String -> Literal
fromString = Text -> Literal
Literal (Text -> Literal) -> (String -> Text) -> String -> Literal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack
data Value = forall a . Data a => Value a
instance Show Value where
show :: Value -> String
show (Value a
a) = a -> String
forall a. Data a => a -> String
gshow a
a
type ReferenceMap = [(Text, Value)]
mkRefMap :: Maybe Reference -> ReferenceMap
mkRefMap :: Maybe Reference -> ReferenceMap
mkRefMap Maybe Reference
Nothing = []
mkRefMap (Just Reference
r) = [Text] -> [Value] -> ReferenceMap
forall a b. [a] -> [b] -> [(a, b)]
zip [Text]
fields ((forall d. Data d => d -> Value) -> Reference -> [Value]
forall a u. Data a => (forall d. Data d => d -> u) -> a -> [u]
gmapQ forall d. Data d => d -> Value
Value Reference
r)
where fields :: [Text]
fields = (String -> Text) -> [String] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Text
T.pack (String -> Text) -> ShowS -> String -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
uncamelize) ([String] -> [Text])
-> (Reference -> [String]) -> Reference -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Constr -> [String]
constrFields (Constr -> [String])
-> (Reference -> Constr) -> Reference -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Reference -> Constr
forall a. Data a => a -> Constr
toConstr (Reference -> [Text]) -> Reference -> [Text]
forall a b. (a -> b) -> a -> b
$ Reference
r
fromValue :: Data a => Value -> Maybe a
fromValue :: Value -> Maybe a
fromValue (Value a
a) = a -> Maybe a
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a
a
isValueSet :: Value -> Bool
isValueSet :: Value -> Bool
isValueSet Value
val
| Just Literal
v <- Value -> Maybe Literal
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe Literal = Literal
v Literal -> Literal -> Bool
forall a. Eq a => a -> a -> Bool
/= Literal
forall a. Monoid a => a
mempty
| Just String
v <- Value -> Maybe String
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe String = String
v String -> String -> Bool
forall a. Eq a => a -> a -> Bool
/= String
forall a. Monoid a => a
mempty
| Just Formatted
v <- Value -> Maybe Formatted
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe Formatted = Formatted
v Formatted -> Formatted -> Bool
forall a. Eq a => a -> a -> Bool
/= Formatted
forall a. Monoid a => a
mempty
| Just [Agent]
v <- Value -> Maybe [Agent]
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe [Agent] = [Agent]
v [Agent] -> [Agent] -> Bool
forall a. Eq a => a -> a -> Bool
/= []
| Just [RefDate]
v <- Value -> Maybe [RefDate]
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe [RefDate] = [RefDate]
v [RefDate] -> [RefDate] -> Bool
forall a. Eq a => a -> a -> Bool
/= []
| Just Int
v <- Value -> Maybe Int
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe Int = Int
v Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= Int
0
| Just CNum
v <- Value -> Maybe CNum
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe CNum = CNum
v CNum -> CNum -> Bool
forall a. Eq a => a -> a -> Bool
/= CNum
0
| Just CLabel
v <- Value -> Maybe CLabel
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe CLabel = CLabel
v CLabel -> CLabel -> Bool
forall a. Eq a => a -> a -> Bool
/= CLabel
forall a. Monoid a => a
mempty
| Just Empty
_ <- Value -> Maybe Empty
forall a. Data a => Value -> Maybe a
fromValue Value
val :: Maybe Empty = Bool
True
| Bool
otherwise = Bool
False
data Empty = Empty deriving ( Typeable, Typeable Empty
DataType
Constr
Typeable Empty
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Empty -> c Empty)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Empty)
-> (Empty -> Constr)
-> (Empty -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Empty))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Empty))
-> ((forall b. Data b => b -> b) -> Empty -> Empty)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r)
-> (forall u. (forall d. Data d => d -> u) -> Empty -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Empty -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty)
-> Data Empty
Empty -> DataType
Empty -> Constr
(forall b. Data b => b -> b) -> Empty -> Empty
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Empty -> c Empty
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Empty
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Empty -> u
forall u. (forall d. Data d => d -> u) -> Empty -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Empty
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Empty -> c Empty
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Empty)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Empty)
$cEmpty :: Constr
$tEmpty :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Empty -> m Empty
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty
gmapMp :: (forall d. Data d => d -> m d) -> Empty -> m Empty
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty
gmapM :: (forall d. Data d => d -> m d) -> Empty -> m Empty
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Empty -> m Empty
gmapQi :: Int -> (forall d. Data d => d -> u) -> Empty -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Empty -> u
gmapQ :: (forall d. Data d => d -> u) -> Empty -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Empty -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Empty -> r
gmapT :: (forall b. Data b => b -> b) -> Empty -> Empty
$cgmapT :: (forall b. Data b => b -> b) -> Empty -> Empty
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Empty)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Empty)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Empty)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Empty)
dataTypeOf :: Empty -> DataType
$cdataTypeOf :: Empty -> DataType
toConstr :: Empty -> Constr
$ctoConstr :: Empty -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Empty
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Empty
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Empty -> c Empty
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Empty -> c Empty
$cp1Data :: Typeable Empty
Data, (forall x. Empty -> Rep Empty x)
-> (forall x. Rep Empty x -> Empty) -> Generic Empty
forall x. Rep Empty x -> Empty
forall x. Empty -> Rep Empty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Empty x -> Empty
$cfrom :: forall x. Empty -> Rep Empty x
Generic )
data Season = Spring | Summer | Autumn | Winter | RawSeason Text
deriving (Int -> Season -> ShowS
[Season] -> ShowS
Season -> String
(Int -> Season -> ShowS)
-> (Season -> String) -> ([Season] -> ShowS) -> Show Season
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Season] -> ShowS
$cshowList :: [Season] -> ShowS
show :: Season -> String
$cshow :: Season -> String
showsPrec :: Int -> Season -> ShowS
$cshowsPrec :: Int -> Season -> ShowS
Show, ReadPrec [Season]
ReadPrec Season
Int -> ReadS Season
ReadS [Season]
(Int -> ReadS Season)
-> ReadS [Season]
-> ReadPrec Season
-> ReadPrec [Season]
-> Read Season
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Season]
$creadListPrec :: ReadPrec [Season]
readPrec :: ReadPrec Season
$creadPrec :: ReadPrec Season
readList :: ReadS [Season]
$creadList :: ReadS [Season]
readsPrec :: Int -> ReadS Season
$creadsPrec :: Int -> ReadS Season
Read, Season -> Season -> Bool
(Season -> Season -> Bool)
-> (Season -> Season -> Bool) -> Eq Season
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Season -> Season -> Bool
$c/= :: Season -> Season -> Bool
== :: Season -> Season -> Bool
$c== :: Season -> Season -> Bool
Eq, Typeable, Typeable Season
DataType
Constr
Typeable Season
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Season -> c Season)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Season)
-> (Season -> Constr)
-> (Season -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Season))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Season))
-> ((forall b. Data b => b -> b) -> Season -> Season)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Season -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Season -> r)
-> (forall u. (forall d. Data d => d -> u) -> Season -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Season -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Season -> m Season)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Season -> m Season)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Season -> m Season)
-> Data Season
Season -> DataType
Season -> Constr
(forall b. Data b => b -> b) -> Season -> Season
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Season -> c Season
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Season
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Season -> u
forall u. (forall d. Data d => d -> u) -> Season -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Season -> m Season
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Season -> m Season
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Season
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Season -> c Season
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Season)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Season)
$cRawSeason :: Constr
$cWinter :: Constr
$cAutumn :: Constr
$cSummer :: Constr
$cSpring :: Constr
$tSeason :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Season -> m Season
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Season -> m Season
gmapMp :: (forall d. Data d => d -> m d) -> Season -> m Season
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Season -> m Season
gmapM :: (forall d. Data d => d -> m d) -> Season -> m Season
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Season -> m Season
gmapQi :: Int -> (forall d. Data d => d -> u) -> Season -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Season -> u
gmapQ :: (forall d. Data d => d -> u) -> Season -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Season -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Season -> r
gmapT :: (forall b. Data b => b -> b) -> Season -> Season
$cgmapT :: (forall b. Data b => b -> b) -> Season -> Season
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Season)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Season)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Season)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Season)
dataTypeOf :: Season -> DataType
$cdataTypeOf :: Season -> DataType
toConstr :: Season -> Constr
$ctoConstr :: Season -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Season
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Season
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Season -> c Season
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Season -> c Season
$cp1Data :: Typeable Season
Data, (forall x. Season -> Rep Season x)
-> (forall x. Rep Season x -> Season) -> Generic Season
forall x. Rep Season x -> Season
forall x. Season -> Rep Season x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Season x -> Season
$cfrom :: forall x. Season -> Rep Season x
Generic)
instance ToYaml Season where
toYaml :: Season -> YamlBuilder
toYaml Season
Spring = Int -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml (Int
1 :: Int)
toYaml Season
Summer = Int -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml (Int
2 :: Int)
toYaml Season
Autumn = Int -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml (Int
3 :: Int)
toYaml Season
Winter = Int -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml (Int
4 :: Int)
toYaml (RawSeason Text
s) = Text -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml Text
s
seasonToInt :: Season -> Maybe Int
seasonToInt :: Season -> Maybe Int
seasonToInt Season
Spring = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
1
seasonToInt Season
Summer = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2
seasonToInt Season
Autumn = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
3
seasonToInt Season
Winter = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
4
seasonToInt Season
_ = Maybe Int
forall a. Maybe a
Nothing
intToSeason :: Int -> Maybe Season
intToSeason :: Int -> Maybe Season
intToSeason Int
1 = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Spring
intToSeason Int
2 = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Summer
intToSeason Int
3 = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Autumn
intToSeason Int
4 = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Winter
intToSeason Int
_ = Maybe Season
forall a. Maybe a
Nothing
pseudoMonthToSeason :: Int -> Maybe Season
pseudoMonthToSeason :: Int -> Maybe Season
pseudoMonthToSeason Int
n
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
13 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
16 = Int -> Maybe Season
intToSeason (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
12)
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
21 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
24 = Int -> Maybe Season
intToSeason (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
20)
| Bool
otherwise = Maybe Season
forall a. Maybe a
Nothing
parseMaybeSeason :: Maybe Aeson.Value -> Parser (Maybe Season)
parseMaybeSeason :: Maybe Value -> Parser (Maybe Season)
parseMaybeSeason Maybe Value
Nothing = Maybe Season -> Parser (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Season
forall a. Maybe a
Nothing
parseMaybeSeason (Just Value
x) = do
Maybe Int
mbn <- Maybe Value -> Parser (Maybe Int)
parseMaybeInt (Value -> Maybe Value
forall a. a -> Maybe a
Just Value
x) Parser (Maybe Int) -> Parser (Maybe Int) -> Parser (Maybe Int)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Maybe Int -> Parser (Maybe Int)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Int
forall a. Maybe a
Nothing
case Maybe Int
mbn of
Just Int
n -> case Int -> Maybe Season
intToSeason Int
n of
Just Season
s -> Maybe Season -> Parser (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Season -> Parser (Maybe Season))
-> Maybe Season -> Parser (Maybe Season)
forall a b. (a -> b) -> a -> b
$ Season -> Maybe Season
forall a. a -> Maybe a
Just Season
s
Maybe Season
Nothing -> String -> Parser (Maybe Season)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser (Maybe Season))
-> String -> Parser (Maybe Season)
forall a b. (a -> b) -> a -> b
$ String
"Could not read season: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
n
Maybe Int
Nothing -> do
Text
s <- Value -> Parser Text
parseString Value
x
if Text -> Bool
T.null Text
s
then Maybe Season -> Parser (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Season
forall a. Maybe a
Nothing
else Maybe Season -> Parser (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Season -> Parser (Maybe Season))
-> Maybe Season -> Parser (Maybe Season)
forall a b. (a -> b) -> a -> b
$ Season -> Maybe Season
forall a. a -> Maybe a
Just (Season -> Maybe Season) -> Season -> Maybe Season
forall a b. (a -> b) -> a -> b
$ Text -> Season
RawSeason Text
s
data RefDate =
RefDate { RefDate -> Maybe Int
year :: Maybe Int
, RefDate -> Maybe Int
month :: Maybe Int
, RefDate -> Maybe Season
season :: Maybe Season
, RefDate -> Maybe Int
day :: Maybe Int
, RefDate -> Literal
other :: Literal
, RefDate -> Bool
circa :: Bool
} deriving ( Int -> RefDate -> ShowS
[RefDate] -> ShowS
RefDate -> String
(Int -> RefDate -> ShowS)
-> (RefDate -> String) -> ([RefDate] -> ShowS) -> Show RefDate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefDate] -> ShowS
$cshowList :: [RefDate] -> ShowS
show :: RefDate -> String
$cshow :: RefDate -> String
showsPrec :: Int -> RefDate -> ShowS
$cshowsPrec :: Int -> RefDate -> ShowS
Show, ReadPrec [RefDate]
ReadPrec RefDate
Int -> ReadS RefDate
ReadS [RefDate]
(Int -> ReadS RefDate)
-> ReadS [RefDate]
-> ReadPrec RefDate
-> ReadPrec [RefDate]
-> Read RefDate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefDate]
$creadListPrec :: ReadPrec [RefDate]
readPrec :: ReadPrec RefDate
$creadPrec :: ReadPrec RefDate
readList :: ReadS [RefDate]
$creadList :: ReadS [RefDate]
readsPrec :: Int -> ReadS RefDate
$creadsPrec :: Int -> ReadS RefDate
Read, RefDate -> RefDate -> Bool
(RefDate -> RefDate -> Bool)
-> (RefDate -> RefDate -> Bool) -> Eq RefDate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefDate -> RefDate -> Bool
$c/= :: RefDate -> RefDate -> Bool
== :: RefDate -> RefDate -> Bool
$c== :: RefDate -> RefDate -> Bool
Eq, Typeable, Typeable RefDate
DataType
Constr
Typeable RefDate
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefDate -> c RefDate)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefDate)
-> (RefDate -> Constr)
-> (RefDate -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefDate))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefDate))
-> ((forall b. Data b => b -> b) -> RefDate -> RefDate)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r)
-> (forall u. (forall d. Data d => d -> u) -> RefDate -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> RefDate -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate)
-> Data RefDate
RefDate -> DataType
RefDate -> Constr
(forall b. Data b => b -> b) -> RefDate -> RefDate
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefDate -> c RefDate
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefDate
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> RefDate -> u
forall u. (forall d. Data d => d -> u) -> RefDate -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefDate
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefDate -> c RefDate
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefDate)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefDate)
$cRefDate :: Constr
$tRefDate :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> RefDate -> m RefDate
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate
gmapMp :: (forall d. Data d => d -> m d) -> RefDate -> m RefDate
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate
gmapM :: (forall d. Data d => d -> m d) -> RefDate -> m RefDate
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefDate -> m RefDate
gmapQi :: Int -> (forall d. Data d => d -> u) -> RefDate -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RefDate -> u
gmapQ :: (forall d. Data d => d -> u) -> RefDate -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RefDate -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefDate -> r
gmapT :: (forall b. Data b => b -> b) -> RefDate -> RefDate
$cgmapT :: (forall b. Data b => b -> b) -> RefDate -> RefDate
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefDate)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefDate)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c RefDate)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefDate)
dataTypeOf :: RefDate -> DataType
$cdataTypeOf :: RefDate -> DataType
toConstr :: RefDate -> Constr
$ctoConstr :: RefDate -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefDate
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefDate
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefDate -> c RefDate
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefDate -> c RefDate
$cp1Data :: Typeable RefDate
Data, (forall x. RefDate -> Rep RefDate x)
-> (forall x. Rep RefDate x -> RefDate) -> Generic RefDate
forall x. Rep RefDate x -> RefDate
forall x. RefDate -> Rep RefDate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefDate x -> RefDate
$cfrom :: forall x. RefDate -> Rep RefDate x
Generic )
instance AddYaml RefDate where
Text
_ &= :: Text -> RefDate -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= (RefDate Maybe Int
Nothing Maybe Int
Nothing Maybe Season
Nothing Maybe Int
Nothing Literal
o Bool
_) | Literal
o Literal -> Literal -> Bool
forall a. Eq a => a -> a -> Bool
== Literal
forall a. Monoid a => a
mempty = [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> a
id
Text
x &= RefDate
y = Text
x Text -> RefDate -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate
y
instance FromJSON RefDate where
parseJSON :: Value -> Parser RefDate
parseJSON (Array Array
v) = RefDate -> RefDate
handlePseudoMonths (RefDate -> RefDate) -> Parser RefDate -> Parser RefDate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
case Value -> Result [Maybe Value]
forall a. FromJSON a => Value -> Result a
fromJSON (Array -> Value
Array Array
v) of
Success [Maybe Value
y] -> Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
y Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int)
-> Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Maybe Int -> Parser (Maybe Int)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Int
forall a. Maybe a
Nothing Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Season)
-> Parser (Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Season -> Parser (Maybe Season)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Season
forall a. Maybe a
Nothing Parser (Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int) -> Parser (Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Int -> Parser (Maybe Int)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Int
forall a. Maybe a
Nothing Parser (Literal -> Bool -> RefDate)
-> Parser Literal -> Parser (Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Literal -> Parser Literal
forall (f :: * -> *) a. Applicative f => a -> f a
pure Literal
"" Parser (Bool -> RefDate) -> Parser Bool -> Parser RefDate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> Parser Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Success [Maybe Value
y,Maybe Value
m] -> Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
y Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int)
-> Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
m Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Season)
-> Parser (Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Maybe Season -> Parser (Maybe Season)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Season
forall a. Maybe a
Nothing Parser (Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int) -> Parser (Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Int -> Parser (Maybe Int)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Int
forall a. Maybe a
Nothing Parser (Literal -> Bool -> RefDate)
-> Parser Literal -> Parser (Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Literal -> Parser Literal
forall (f :: * -> *) a. Applicative f => a -> f a
pure Literal
"" Parser (Bool -> RefDate) -> Parser Bool -> Parser RefDate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> Parser Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Success [Maybe Value
y,Maybe Value
m,Maybe Value
d] -> Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
y Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int)
-> Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
m Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Season)
-> Parser (Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Maybe Season -> Parser (Maybe Season)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Season
forall a. Maybe a
Nothing Parser (Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int) -> Parser (Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe Value -> Parser (Maybe Int)
parseMaybeInt Maybe Value
d Parser (Literal -> Bool -> RefDate)
-> Parser Literal -> Parser (Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Literal -> Parser Literal
forall (f :: * -> *) a. Applicative f => a -> f a
pure Literal
"" Parser (Bool -> RefDate) -> Parser Bool -> Parser RefDate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> Parser Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Error String
e -> String -> Parser RefDate
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser RefDate) -> String -> Parser RefDate
forall a b. (a -> b) -> a -> b
$ String
"Could not parse RefDate: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
e
Result [Maybe Value]
_ -> String -> Parser RefDate
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Could not parse RefDate"
where handlePseudoMonths :: RefDate -> RefDate
handlePseudoMonths RefDate
r =
case RefDate -> Maybe Int
month RefDate
r Maybe Int -> (Int -> Maybe Season) -> Maybe Season
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> Maybe Season
pseudoMonthToSeason of
Just Season
s -> RefDate
r{ month :: Maybe Int
month = Maybe Int
forall a. Maybe a
Nothing, season :: Maybe Season
season = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
s }
Maybe Season
Nothing -> RefDate
r
parseJSON (Object Object
v) = Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate)
-> Parser (Maybe Int)
-> Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
(Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"year" Parser (Maybe Value)
-> (Maybe Value -> Parser (Maybe Int)) -> Parser (Maybe Int)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Maybe Value -> Parser (Maybe Int)
parseMaybeInt) Parser
(Maybe Int
-> Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int)
-> Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
(Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"month" Parser (Maybe Value)
-> (Maybe Value -> Parser (Maybe Int)) -> Parser (Maybe Int)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Maybe Value -> Parser (Maybe Int)
parseMaybeInt) Parser (Maybe Season -> Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Season)
-> Parser (Maybe Int -> Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
(Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"season" Parser (Maybe Value)
-> (Maybe Value -> Parser (Maybe Season)) -> Parser (Maybe Season)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Maybe Value -> Parser (Maybe Season)
parseMaybeSeason) Parser (Maybe Int -> Literal -> Bool -> RefDate)
-> Parser (Maybe Int) -> Parser (Literal -> Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
(Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"day" Parser (Maybe Value)
-> (Maybe Value -> Parser (Maybe Int)) -> Parser (Maybe Int)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Maybe Value -> Parser (Maybe Int)
parseMaybeInt) Parser (Literal -> Bool -> RefDate)
-> Parser Literal -> Parser (Bool -> RefDate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"literal" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser (Bool -> RefDate) -> Parser Bool -> Parser RefDate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
((Object
v Object -> Text -> Parser Value
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"circa" Parser Value -> (Value -> Parser Bool) -> Parser Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Value -> Parser Bool
parseBool) Parser Bool -> Parser Bool -> Parser Bool
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> Parser Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False)
parseJSON Value
_ = String -> Parser RefDate
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Could not parse RefDate"
instance ToYaml RefDate where
toYaml :: RefDate -> YamlBuilder
toYaml RefDate
r = [[(Text, YamlBuilder)] -> [(Text, YamlBuilder)]] -> YamlBuilder
mapping'
[ Text
"year" Text -> Maybe Int -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Maybe Int
year RefDate
r
, Text
"month" Text -> Maybe Int -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Maybe Int
month RefDate
r
, Text
"season" Text
-> Maybe Season -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Maybe Season
season RefDate
r
, Text
"day" Text -> Maybe Int -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Maybe Int
day RefDate
r
, Text
"literal" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Literal
other RefDate
r
, Text
"circa" Text -> Bool -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= RefDate -> Bool
circa RefDate
r
]
instance OVERLAPS
FromJSON [RefDate] where
parseJSON :: Value -> Parser [RefDate]
parseJSON (Array Array
xs) = (Value -> Parser RefDate) -> [Value] -> Parser [RefDate]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Value -> Parser RefDate
forall a. FromJSON a => Value -> Parser a
parseJSON ([Value] -> Parser [RefDate]) -> [Value] -> Parser [RefDate]
forall a b. (a -> b) -> a -> b
$ Array -> [Value]
forall a. Vector a -> [a]
V.toList Array
xs
parseJSON (Object Object
v) = do
Maybe Text
raw' <- Object
v Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"raw"
Maybe Value
dateParts <- Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"date-parts"
Bool
circa' <- (Object
v Object -> Text -> Parser Value
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"circa" Parser Value -> (Value -> Parser Bool) -> Parser Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Value -> Parser Bool
parseBool) Parser Bool -> Parser Bool -> Parser Bool
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> Parser Bool
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Maybe Season
season' <- Object
v Object -> Text -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"season" Parser (Maybe Value)
-> (Maybe Value -> Parser (Maybe Season)) -> Parser (Maybe Season)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Maybe Value -> Parser (Maybe Season)
parseMaybeSeason
case Maybe Value
dateParts of
Just (Array Array
y) | Maybe Text -> Bool
forall a. Maybe a -> Bool
isNothing Maybe Text
raw' ->
case Array -> [Value]
forall a. Vector a -> [a]
V.toList Array
y of
[] -> [RefDate] -> Parser [RefDate]
forall (m :: * -> *) a. Monad m => a -> m a
return []
[Value
Null] -> [RefDate] -> Parser [RefDate]
forall (m :: * -> *) a. Monad m => a -> m a
return []
[Array Array
x]
| Array -> Bool
forall a. Vector a -> Bool
V.null Array
x -> [RefDate] -> Parser [RefDate]
forall (m :: * -> *) a. Monad m => a -> m a
return []
[Value]
ys -> (Value -> Parser RefDate) -> [Value] -> Parser [RefDate]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((RefDate -> RefDate) -> Parser RefDate -> Parser RefDate
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Bool -> RefDate -> RefDate
setCirca Bool
circa' (RefDate -> RefDate) -> (RefDate -> RefDate) -> RefDate -> RefDate
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
(RefDate -> RefDate)
-> (Season -> RefDate -> RefDate)
-> Maybe Season
-> RefDate
-> RefDate
forall b a. b -> (a -> b) -> Maybe a -> b
maybe RefDate -> RefDate
forall a. a -> a
id Season -> RefDate -> RefDate
setSeason Maybe Season
season') (Parser RefDate -> Parser RefDate)
-> (Value -> Parser RefDate) -> Value -> Parser RefDate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Parser RefDate
forall a. FromJSON a => Value -> Parser a
parseJSON) [Value]
ys
Maybe Value
_ -> case Maybe Text
raw' of
Maybe Text
Nothing -> RefDate -> [RefDate]
handleLiteral (RefDate -> [RefDate]) -> Parser RefDate -> Parser [RefDate]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser RefDate
forall a. FromJSON a => Value -> Parser a
parseJSON (Object -> Value
Object Object
v)
Just Text
r -> [RefDate] -> Parser [RefDate]
forall (m :: * -> *) a. Monad m => a -> m a
return ([RefDate] -> Parser [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a b. (a -> b) -> a -> b
$ Text -> [RefDate]
parseRawDate Text
r
parseJSON Value
x = Text -> [RefDate]
parseRawDate (Text -> [RefDate]) -> Parser Text -> Parser [RefDate]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
parseJSON Value
x
instance OVERLAPS
ToJSON [RefDate] where
toJSON :: [RefDate] -> Value
toJSON = [RefDate] -> Value
toJSONDate
toJSONDate :: [RefDate] -> Aeson.Value
toJSONDate :: [RefDate] -> Value
toJSONDate [] = Array -> Value
Array Array
forall a. Vector a
V.empty
toJSONDate [RefDate]
ds = [Pair] -> Value
object' ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
[ Text
"date-parts" Text -> [[Int]] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [[Int]]
dateparts | Bool -> Bool
not ([[Int]] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [[Int]]
dateparts) ] [Pair] -> [Pair] -> [Pair]
forall a. [a] -> [a] -> [a]
++
[Text
"circa" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= (Int
1 :: Int) | (RefDate -> Bool) -> [RefDate] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any RefDate -> Bool
circa [RefDate]
ds] [Pair] -> [Pair] -> [Pair]
forall a. [a] -> [a] -> [a]
++
(case [Maybe Season] -> Maybe Season
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum ((RefDate -> Maybe Season) -> [RefDate] -> [Maybe Season]
forall a b. (a -> b) -> [a] -> [b]
map RefDate -> Maybe Season
season [RefDate]
ds) of
Just (RawSeason Text
s) -> [Text
"season" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
Maybe Season
_ -> []) [Pair] -> [Pair] -> [Pair]
forall a. [a] -> [a] -> [a]
++
(case [Literal] -> Literal
forall a. Monoid a => [a] -> a
mconcat ((RefDate -> Literal) -> [RefDate] -> [Literal]
forall a b. (a -> b) -> [a] -> [b]
map RefDate -> Literal
other [RefDate]
ds) of
Literal Text
l | Bool -> Bool
not (Text -> Bool
T.null Text
l) -> [Text
"literal" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
l]
Literal
_ -> [])
where dateparts :: [[Int]]
dateparts = ([Int] -> Bool) -> [[Int]] -> [[Int]]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> ([Int] -> Bool) -> [Int] -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Int] -> Bool
forall a. (Eq a, Num a) => [a] -> Bool
emptyDatePart) ([[Int]] -> [[Int]]) -> [[Int]] -> [[Int]]
forall a b. (a -> b) -> a -> b
$ (RefDate -> [Int]) -> [RefDate] -> [[Int]]
forall a b. (a -> b) -> [a] -> [b]
map RefDate -> [Int]
toDatePart [RefDate]
ds
emptyDatePart :: [a] -> Bool
emptyDatePart [] = Bool
True
emptyDatePart [a]
xs = (a -> Bool) -> [a] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
0) [a]
xs
toDatePart :: RefDate -> [Int]
toDatePart :: RefDate -> [Int]
toDatePart RefDate
refdate =
case (RefDate -> Maybe Int
year RefDate
refdate, RefDate -> Maybe Int
month RefDate
refdate
Maybe Int -> Maybe Int -> Maybe Int
forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a
`mplus`
((Int
12Int -> Int -> Int
forall a. Num a => a -> a -> a
+) (Int -> Int) -> Maybe Int -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (RefDate -> Maybe Season
season RefDate
refdate Maybe Season -> (Season -> Maybe Int) -> Maybe Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Season -> Maybe Int
seasonToInt)),
RefDate -> Maybe Int
day RefDate
refdate) of
(Just (Int
y :: Int), Just (Int
m :: Int), Just (Int
d :: Int))
-> [Int
y, Int
m, Int
d]
(Just Int
y, Just Int
m, Maybe Int
Nothing) -> [Int
y, Int
m]
(Just Int
y, Maybe Int
Nothing, Maybe Int
Nothing) -> [Int
y]
(Maybe Int, Maybe Int, Maybe Int)
_ -> []
handleLiteral :: RefDate -> [RefDate]
handleLiteral :: RefDate -> [RefDate]
handleLiteral d :: RefDate
d@(RefDate Maybe Int
Nothing Maybe Int
Nothing Maybe Season
Nothing Maybe Int
Nothing (Literal Text
xs) Bool
b)
= case Text -> Text -> [Text]
T.splitOn Text
"_" Text
xs of
[Text
x,Text
y] | (Char -> Bool) -> Text -> Bool
T.all Char -> Bool
isDigit Text
x Bool -> Bool -> Bool
&& (Char -> Bool) -> Text -> Bool
T.all Char -> Bool
isDigit Text
y Bool -> Bool -> Bool
&&
Bool -> Bool
not (Text -> Bool
T.null Text
x) ->
[Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead Text
x) Maybe Int
forall a. Maybe a
Nothing Maybe Season
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Literal
forall a. Monoid a => a
mempty Bool
b,
Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate (Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead Text
y) Maybe Int
forall a. Maybe a
Nothing Maybe Season
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Literal
forall a. Monoid a => a
mempty Bool
b]
[Text]
_ -> [RefDate
d]
handleLiteral RefDate
d = [RefDate
d]
setCirca :: Bool -> RefDate -> RefDate
setCirca :: Bool -> RefDate -> RefDate
setCirca Bool
circa' RefDate
rd = RefDate
rd{ circa :: Bool
circa = Bool
circa' }
setSeason :: Season -> RefDate -> RefDate
setSeason :: Season -> RefDate -> RefDate
setSeason Season
season' RefDate
rd = RefDate
rd{ season :: Maybe Season
season = Season -> Maybe Season
forall a. a -> Maybe a
Just Season
season' }
data RefType
= NoType
| Article
| ArticleMagazine
| ArticleNewspaper
| ArticleJournal
| Bill
| Book
| Broadcast
| Chapter
| Dataset
| Entry
| EntryDictionary
| EntryEncyclopedia
| Figure
| Graphic
| Interview
| Legislation
| LegalCase
| Manuscript
| Map
| MotionPicture
| MusicalScore
| Pamphlet
| PaperConference
| Patent
| Post
| PostWeblog
| PersonalCommunication
| Report
| Review
| ReviewBook
| Song
| Speech
| Thesis
| Treaty
| Webpage
deriving ( ReadPrec [RefType]
ReadPrec RefType
Int -> ReadS RefType
ReadS [RefType]
(Int -> ReadS RefType)
-> ReadS [RefType]
-> ReadPrec RefType
-> ReadPrec [RefType]
-> Read RefType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefType]
$creadListPrec :: ReadPrec [RefType]
readPrec :: ReadPrec RefType
$creadPrec :: ReadPrec RefType
readList :: ReadS [RefType]
$creadList :: ReadS [RefType]
readsPrec :: Int -> ReadS RefType
$creadsPrec :: Int -> ReadS RefType
Read, RefType -> RefType -> Bool
(RefType -> RefType -> Bool)
-> (RefType -> RefType -> Bool) -> Eq RefType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefType -> RefType -> Bool
$c/= :: RefType -> RefType -> Bool
== :: RefType -> RefType -> Bool
$c== :: RefType -> RefType -> Bool
Eq, Typeable, Typeable RefType
DataType
Constr
Typeable RefType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefType -> c RefType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefType)
-> (RefType -> Constr)
-> (RefType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefType))
-> ((forall b. Data b => b -> b) -> RefType -> RefType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r)
-> (forall u. (forall d. Data d => d -> u) -> RefType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> RefType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType)
-> Data RefType
RefType -> DataType
RefType -> Constr
(forall b. Data b => b -> b) -> RefType -> RefType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefType -> c RefType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> RefType -> u
forall u. (forall d. Data d => d -> u) -> RefType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefType -> c RefType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefType)
$cWebpage :: Constr
$cTreaty :: Constr
$cThesis :: Constr
$cSpeech :: Constr
$cSong :: Constr
$cReviewBook :: Constr
$cReview :: Constr
$cReport :: Constr
$cPersonalCommunication :: Constr
$cPostWeblog :: Constr
$cPost :: Constr
$cPatent :: Constr
$cPaperConference :: Constr
$cPamphlet :: Constr
$cMusicalScore :: Constr
$cMotionPicture :: Constr
$cMap :: Constr
$cManuscript :: Constr
$cLegalCase :: Constr
$cLegislation :: Constr
$cInterview :: Constr
$cGraphic :: Constr
$cFigure :: Constr
$cEntryEncyclopedia :: Constr
$cEntryDictionary :: Constr
$cEntry :: Constr
$cDataset :: Constr
$cChapter :: Constr
$cBroadcast :: Constr
$cBook :: Constr
$cBill :: Constr
$cArticleJournal :: Constr
$cArticleNewspaper :: Constr
$cArticleMagazine :: Constr
$cArticle :: Constr
$cNoType :: Constr
$tRefType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> RefType -> m RefType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType
gmapMp :: (forall d. Data d => d -> m d) -> RefType -> m RefType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType
gmapM :: (forall d. Data d => d -> m d) -> RefType -> m RefType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> RefType -> m RefType
gmapQi :: Int -> (forall d. Data d => d -> u) -> RefType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> RefType -> u
gmapQ :: (forall d. Data d => d -> u) -> RefType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> RefType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> RefType -> r
gmapT :: (forall b. Data b => b -> b) -> RefType -> RefType
$cgmapT :: (forall b. Data b => b -> b) -> RefType -> RefType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RefType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c RefType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c RefType)
dataTypeOf :: RefType -> DataType
$cdataTypeOf :: RefType -> DataType
toConstr :: RefType -> Constr
$ctoConstr :: RefType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c RefType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefType -> c RefType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> RefType -> c RefType
$cp1Data :: Typeable RefType
Data, (forall x. RefType -> Rep RefType x)
-> (forall x. Rep RefType x -> RefType) -> Generic RefType
forall x. Rep RefType x -> RefType
forall x. RefType -> Rep RefType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefType x -> RefType
$cfrom :: forall x. RefType -> Rep RefType x
Generic )
instance Show RefType where
show :: RefType -> String
show RefType
x = (Char -> Char) -> ShowS
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower ShowS -> (RefType -> String) -> RefType -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
uncamelize ShowS -> (RefType -> String) -> RefType -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Constr -> String
showConstr (Constr -> String) -> (RefType -> Constr) -> RefType -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RefType -> Constr
forall a. Data a => a -> Constr
toConstr (RefType -> String) -> RefType -> String
forall a b. (a -> b) -> a -> b
$ RefType
x
instance FromJSON RefType where
parseJSON :: Value -> Parser RefType
parseJSON (String Text
"film") = RefType -> Parser RefType
forall (m :: * -> *) a. Monad m => a -> m a
return RefType
MotionPicture
parseJSON (String Text
t) =
Text -> Parser RefType
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (Text -> Text
capitalize (Text -> Text) -> (Text -> Text) -> Text -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> Text) -> (Text -> String) -> Text -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
camelize (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Text
t) Parser RefType -> Parser RefType -> Parser RefType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
String -> Parser RefType
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"'" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
T.unpack Text
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"' is not a valid reference type")
parseJSON v :: Value
v@(Array Array
_) =
([Inline] -> Text) -> Parser [Inline] -> Parser Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Text -> Text
capitalize (Text -> Text) -> ([Inline] -> Text) -> [Inline] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> Text) -> ([Inline] -> String) -> [Inline] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> String
camelize (Text -> String) -> ([Inline] -> Text) -> [Inline] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Inline] -> Text
inlinesToString) (Value -> Parser [Inline]
forall a. FromJSON a => Value -> Parser a
parseJSON Value
v) Parser Text -> (Text -> Parser RefType) -> Parser RefType
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Text
t ->
Text -> Parser RefType
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead Text
t Parser RefType -> Parser RefType -> Parser RefType
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|>
String -> Parser RefType
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String
"'" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Text -> String
T.unpack Text
t String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"' is not a valid reference type")
parseJSON Value
_ = String -> Parser RefType
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Could not parse RefType"
instance ToJSON RefType where
toJSON :: RefType -> Value
toJSON RefType
reftype = String -> Value
forall a. ToJSON a => a -> Value
toJSON (ShowS
handleSpecialCases ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ RefType -> String
forall a. Show a => a -> String
show RefType
reftype)
instance ToYaml RefType where
toYaml :: RefType -> YamlBuilder
toYaml RefType
r = Text -> YamlBuilder
Y.string (String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ ShowS
handleSpecialCases ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ RefType -> String
forall a. Show a => a -> String
show RefType
r)
handleSpecialCases :: String -> String
handleSpecialCases :: ShowS
handleSpecialCases String
"motion-picture" = String
"motion_picture"
handleSpecialCases String
"musical-score" = String
"musical_score"
handleSpecialCases String
"personal-communication" = String
"personal_communication"
handleSpecialCases String
"legal-case" = String
"legal_case"
handleSpecialCases String
x = String
x
newtype CNum = CNum { CNum -> Int
unCNum :: Int }
deriving ( Int -> CNum -> ShowS
[CNum] -> ShowS
CNum -> String
(Int -> CNum -> ShowS)
-> (CNum -> String) -> ([CNum] -> ShowS) -> Show CNum
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CNum] -> ShowS
$cshowList :: [CNum] -> ShowS
show :: CNum -> String
$cshow :: CNum -> String
showsPrec :: Int -> CNum -> ShowS
$cshowsPrec :: Int -> CNum -> ShowS
Show, ReadPrec [CNum]
ReadPrec CNum
Int -> ReadS CNum
ReadS [CNum]
(Int -> ReadS CNum)
-> ReadS [CNum] -> ReadPrec CNum -> ReadPrec [CNum] -> Read CNum
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CNum]
$creadListPrec :: ReadPrec [CNum]
readPrec :: ReadPrec CNum
$creadPrec :: ReadPrec CNum
readList :: ReadS [CNum]
$creadList :: ReadS [CNum]
readsPrec :: Int -> ReadS CNum
$creadsPrec :: Int -> ReadS CNum
Read, CNum -> CNum -> Bool
(CNum -> CNum -> Bool) -> (CNum -> CNum -> Bool) -> Eq CNum
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CNum -> CNum -> Bool
$c/= :: CNum -> CNum -> Bool
== :: CNum -> CNum -> Bool
$c== :: CNum -> CNum -> Bool
Eq, Eq CNum
Eq CNum
-> (CNum -> CNum -> Ordering)
-> (CNum -> CNum -> Bool)
-> (CNum -> CNum -> Bool)
-> (CNum -> CNum -> Bool)
-> (CNum -> CNum -> Bool)
-> (CNum -> CNum -> CNum)
-> (CNum -> CNum -> CNum)
-> Ord CNum
CNum -> CNum -> Bool
CNum -> CNum -> Ordering
CNum -> CNum -> CNum
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CNum -> CNum -> CNum
$cmin :: CNum -> CNum -> CNum
max :: CNum -> CNum -> CNum
$cmax :: CNum -> CNum -> CNum
>= :: CNum -> CNum -> Bool
$c>= :: CNum -> CNum -> Bool
> :: CNum -> CNum -> Bool
$c> :: CNum -> CNum -> Bool
<= :: CNum -> CNum -> Bool
$c<= :: CNum -> CNum -> Bool
< :: CNum -> CNum -> Bool
$c< :: CNum -> CNum -> Bool
compare :: CNum -> CNum -> Ordering
$ccompare :: CNum -> CNum -> Ordering
$cp1Ord :: Eq CNum
Ord, Integer -> CNum
CNum -> CNum
CNum -> CNum -> CNum
(CNum -> CNum -> CNum)
-> (CNum -> CNum -> CNum)
-> (CNum -> CNum -> CNum)
-> (CNum -> CNum)
-> (CNum -> CNum)
-> (CNum -> CNum)
-> (Integer -> CNum)
-> Num CNum
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> CNum
$cfromInteger :: Integer -> CNum
signum :: CNum -> CNum
$csignum :: CNum -> CNum
abs :: CNum -> CNum
$cabs :: CNum -> CNum
negate :: CNum -> CNum
$cnegate :: CNum -> CNum
* :: CNum -> CNum -> CNum
$c* :: CNum -> CNum -> CNum
- :: CNum -> CNum -> CNum
$c- :: CNum -> CNum -> CNum
+ :: CNum -> CNum -> CNum
$c+ :: CNum -> CNum -> CNum
Num, Typeable, Typeable CNum
DataType
Constr
Typeable CNum
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CNum -> c CNum)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CNum)
-> (CNum -> Constr)
-> (CNum -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CNum))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CNum))
-> ((forall b. Data b => b -> b) -> CNum -> CNum)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r)
-> (forall u. (forall d. Data d => d -> u) -> CNum -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> CNum -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum)
-> Data CNum
CNum -> DataType
CNum -> Constr
(forall b. Data b => b -> b) -> CNum -> CNum
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CNum -> c CNum
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CNum
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CNum -> u
forall u. (forall d. Data d => d -> u) -> CNum -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CNum
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CNum -> c CNum
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CNum)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CNum)
$cCNum :: Constr
$tCNum :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CNum -> m CNum
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum
gmapMp :: (forall d. Data d => d -> m d) -> CNum -> m CNum
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum
gmapM :: (forall d. Data d => d -> m d) -> CNum -> m CNum
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CNum -> m CNum
gmapQi :: Int -> (forall d. Data d => d -> u) -> CNum -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CNum -> u
gmapQ :: (forall d. Data d => d -> u) -> CNum -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CNum -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CNum -> r
gmapT :: (forall b. Data b => b -> b) -> CNum -> CNum
$cgmapT :: (forall b. Data b => b -> b) -> CNum -> CNum
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CNum)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CNum)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CNum)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CNum)
dataTypeOf :: CNum -> DataType
$cdataTypeOf :: CNum -> DataType
toConstr :: CNum -> Constr
$ctoConstr :: CNum -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CNum
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CNum
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CNum -> c CNum
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CNum -> c CNum
$cp1Data :: Typeable CNum
Data, (forall x. CNum -> Rep CNum x)
-> (forall x. Rep CNum x -> CNum) -> Generic CNum
forall x. Rep CNum x -> CNum
forall x. CNum -> Rep CNum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CNum x -> CNum
$cfrom :: forall x. CNum -> Rep CNum x
Generic )
instance FromJSON CNum where
parseJSON :: Value -> Parser CNum
parseJSON Value
x = Int -> CNum
CNum (Int -> CNum) -> Parser Int -> Parser CNum
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Value -> Parser Int
parseInt Value
x
instance ToJSON CNum where
toJSON :: CNum -> Value
toJSON (CNum Int
n) = Int -> Value
forall a. ToJSON a => a -> Value
toJSON Int
n
instance ToYaml CNum where
toYaml :: CNum -> YamlBuilder
toYaml CNum
r = Text -> YamlBuilder
Y.string (String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ Int -> String
forall a. Show a => a -> String
show (Int -> String) -> Int -> String
forall a b. (a -> b) -> a -> b
$ CNum -> Int
unCNum CNum
r)
newtype CLabel = CLabel { CLabel -> Text
unCLabel :: Text }
deriving ( Int -> CLabel -> ShowS
[CLabel] -> ShowS
CLabel -> String
(Int -> CLabel -> ShowS)
-> (CLabel -> String) -> ([CLabel] -> ShowS) -> Show CLabel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CLabel] -> ShowS
$cshowList :: [CLabel] -> ShowS
show :: CLabel -> String
$cshow :: CLabel -> String
showsPrec :: Int -> CLabel -> ShowS
$cshowsPrec :: Int -> CLabel -> ShowS
Show, ReadPrec [CLabel]
ReadPrec CLabel
Int -> ReadS CLabel
ReadS [CLabel]
(Int -> ReadS CLabel)
-> ReadS [CLabel]
-> ReadPrec CLabel
-> ReadPrec [CLabel]
-> Read CLabel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CLabel]
$creadListPrec :: ReadPrec [CLabel]
readPrec :: ReadPrec CLabel
$creadPrec :: ReadPrec CLabel
readList :: ReadS [CLabel]
$creadList :: ReadS [CLabel]
readsPrec :: Int -> ReadS CLabel
$creadsPrec :: Int -> ReadS CLabel
Read, CLabel -> CLabel -> Bool
(CLabel -> CLabel -> Bool)
-> (CLabel -> CLabel -> Bool) -> Eq CLabel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CLabel -> CLabel -> Bool
$c/= :: CLabel -> CLabel -> Bool
== :: CLabel -> CLabel -> Bool
$c== :: CLabel -> CLabel -> Bool
Eq, Typeable, Typeable CLabel
DataType
Constr
Typeable CLabel
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CLabel -> c CLabel)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CLabel)
-> (CLabel -> Constr)
-> (CLabel -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CLabel))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CLabel))
-> ((forall b. Data b => b -> b) -> CLabel -> CLabel)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CLabel -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CLabel -> r)
-> (forall u. (forall d. Data d => d -> u) -> CLabel -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> CLabel -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel)
-> Data CLabel
CLabel -> DataType
CLabel -> Constr
(forall b. Data b => b -> b) -> CLabel -> CLabel
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CLabel -> c CLabel
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CLabel
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CLabel -> u
forall u. (forall d. Data d => d -> u) -> CLabel -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CLabel
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CLabel -> c CLabel
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CLabel)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CLabel)
$cCLabel :: Constr
$tCLabel :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CLabel -> m CLabel
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel
gmapMp :: (forall d. Data d => d -> m d) -> CLabel -> m CLabel
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel
gmapM :: (forall d. Data d => d -> m d) -> CLabel -> m CLabel
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CLabel -> m CLabel
gmapQi :: Int -> (forall d. Data d => d -> u) -> CLabel -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CLabel -> u
gmapQ :: (forall d. Data d => d -> u) -> CLabel -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CLabel -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CLabel -> r
gmapT :: (forall b. Data b => b -> b) -> CLabel -> CLabel
$cgmapT :: (forall b. Data b => b -> b) -> CLabel -> CLabel
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CLabel)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CLabel)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CLabel)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CLabel)
dataTypeOf :: CLabel -> DataType
$cdataTypeOf :: CLabel -> DataType
toConstr :: CLabel -> Constr
$ctoConstr :: CLabel -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CLabel
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CLabel
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CLabel -> c CLabel
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CLabel -> c CLabel
$cp1Data :: Typeable CLabel
Data, (forall x. CLabel -> Rep CLabel x)
-> (forall x. Rep CLabel x -> CLabel) -> Generic CLabel
forall x. Rep CLabel x -> CLabel
forall x. CLabel -> Rep CLabel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CLabel x -> CLabel
$cfrom :: forall x. CLabel -> Rep CLabel x
Generic, b -> CLabel -> CLabel
NonEmpty CLabel -> CLabel
CLabel -> CLabel -> CLabel
(CLabel -> CLabel -> CLabel)
-> (NonEmpty CLabel -> CLabel)
-> (forall b. Integral b => b -> CLabel -> CLabel)
-> Semigroup CLabel
forall b. Integral b => b -> CLabel -> CLabel
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: b -> CLabel -> CLabel
$cstimes :: forall b. Integral b => b -> CLabel -> CLabel
sconcat :: NonEmpty CLabel -> CLabel
$csconcat :: NonEmpty CLabel -> CLabel
<> :: CLabel -> CLabel -> CLabel
$c<> :: CLabel -> CLabel -> CLabel
Semigroup, Semigroup CLabel
CLabel
Semigroup CLabel
-> CLabel
-> (CLabel -> CLabel -> CLabel)
-> ([CLabel] -> CLabel)
-> Monoid CLabel
[CLabel] -> CLabel
CLabel -> CLabel -> CLabel
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [CLabel] -> CLabel
$cmconcat :: [CLabel] -> CLabel
mappend :: CLabel -> CLabel -> CLabel
$cmappend :: CLabel -> CLabel -> CLabel
mempty :: CLabel
$cmempty :: CLabel
$cp1Monoid :: Semigroup CLabel
Monoid )
instance FromJSON CLabel where
parseJSON :: Value -> Parser CLabel
parseJSON Value
x = Text -> CLabel
CLabel (Text -> CLabel) -> Parser Text -> Parser CLabel
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` Value -> Parser Text
parseString Value
x
instance ToJSON CLabel where
toJSON :: CLabel -> Value
toJSON (CLabel Text
s) = Text -> Value
forall a. ToJSON a => a -> Value
toJSON Text
s
instance ToYaml CLabel where
toYaml :: CLabel -> YamlBuilder
toYaml (CLabel Text
s) = Text -> YamlBuilder
forall a. ToYaml a => a -> YamlBuilder
toYaml Text
s
data Reference =
Reference
{ Reference -> Literal
refId :: Literal
, Reference -> [Literal]
refOtherIds :: [Literal]
, Reference -> RefType
refType :: RefType
, Reference -> [Agent]
author :: [Agent]
, Reference -> [Agent]
editor :: [Agent]
, Reference -> [Agent]
translator :: [Agent]
, Reference -> [Agent]
recipient :: [Agent]
, Reference -> [Agent]
interviewer :: [Agent]
, Reference -> [Agent]
composer :: [Agent]
, Reference -> [Agent]
director :: [Agent]
, Reference -> [Agent]
illustrator :: [Agent]
, Reference -> [Agent]
originalAuthor :: [Agent]
, Reference -> [Agent]
containerAuthor :: [Agent]
, Reference -> [Agent]
collectionEditor :: [Agent]
, Reference -> [Agent]
editorialDirector :: [Agent]
, Reference -> [Agent]
reviewedAuthor :: [Agent]
, Reference -> [RefDate]
issued :: [RefDate]
, Reference -> [RefDate]
eventDate :: [RefDate]
, Reference -> [RefDate]
accessed :: [RefDate]
, Reference -> [RefDate]
container :: [RefDate]
, Reference -> [RefDate]
originalDate :: [RefDate]
, Reference -> [RefDate]
submitted :: [RefDate]
, Reference -> Formatted
title :: Formatted
, Reference -> Formatted
titleShort :: Formatted
, Reference -> Formatted
reviewedTitle :: Formatted
, Reference -> Formatted
containerTitle :: Formatted
, Reference -> Formatted
volumeTitle :: Formatted
, Reference -> Formatted
collectionTitle :: Formatted
, Reference -> Formatted
containerTitleShort :: Formatted
, Reference -> Formatted
collectionNumber :: Formatted
, Reference -> Formatted
originalTitle :: Formatted
, Reference -> Formatted
publisher :: Formatted
, Reference -> Formatted
originalPublisher :: Formatted
, Reference -> Formatted
publisherPlace :: Formatted
, Reference -> Formatted
originalPublisherPlace :: Formatted
, Reference -> Formatted
authority :: Formatted
, Reference -> Formatted
jurisdiction :: Formatted
, Reference -> Formatted
archive :: Formatted
, Reference -> Formatted
archivePlace :: Formatted
, Reference -> Formatted
archiveLocation :: Formatted
, Reference -> Formatted
event :: Formatted
, Reference -> Formatted
eventPlace :: Formatted
, Reference -> Formatted
page :: Formatted
, Reference -> Formatted
pageFirst :: Formatted
, Reference -> Formatted
numberOfPages :: Formatted
, Reference -> Formatted
version :: Formatted
, Reference -> Formatted
volume :: Formatted
, Reference -> Formatted
numberOfVolumes :: Formatted
, Reference -> Formatted
issue :: Formatted
, Reference -> Formatted
chapterNumber :: Formatted
, Reference -> Formatted
medium :: Formatted
, Reference -> Formatted
status :: Formatted
, Reference -> Formatted
edition :: Formatted
, Reference -> Formatted
section :: Formatted
, Reference -> Formatted
source :: Formatted
, Reference -> Formatted
genre :: Formatted
, Reference -> Formatted
note :: Formatted
, Reference -> Formatted
annote :: Formatted
, Reference -> Formatted
abstract :: Formatted
, Reference -> Formatted
keyword :: Formatted
, Reference -> Formatted
number :: Formatted
, Reference -> Formatted
references :: Formatted
, Reference -> Literal
url :: Literal
, Reference -> Literal
doi :: Literal
, Reference -> Literal
isbn :: Literal
, Reference -> Literal
issn :: Literal
, Reference -> Literal
pmcid :: Literal
, Reference -> Literal
pmid :: Literal
, Reference -> Literal
callNumber :: Literal
, Reference -> Literal
dimensions :: Literal
, Reference -> Literal
scale :: Literal
, Reference -> [Literal]
categories :: [Literal]
, Reference -> Literal
language :: Literal
, Reference -> CNum
citationNumber :: CNum
, Reference -> Int
firstReferenceNoteNumber :: Int
, Reference -> CLabel
citationLabel :: CLabel
} deriving ( Reference -> Reference -> Bool
(Reference -> Reference -> Bool)
-> (Reference -> Reference -> Bool) -> Eq Reference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Reference -> Reference -> Bool
$c/= :: Reference -> Reference -> Bool
== :: Reference -> Reference -> Bool
$c== :: Reference -> Reference -> Bool
Eq, Int -> Reference -> ShowS
[Reference] -> ShowS
Reference -> String
(Int -> Reference -> ShowS)
-> (Reference -> String)
-> ([Reference] -> ShowS)
-> Show Reference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Reference] -> ShowS
$cshowList :: [Reference] -> ShowS
show :: Reference -> String
$cshow :: Reference -> String
showsPrec :: Int -> Reference -> ShowS
$cshowsPrec :: Int -> Reference -> ShowS
Show, ReadPrec [Reference]
ReadPrec Reference
Int -> ReadS Reference
ReadS [Reference]
(Int -> ReadS Reference)
-> ReadS [Reference]
-> ReadPrec Reference
-> ReadPrec [Reference]
-> Read Reference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Reference]
$creadListPrec :: ReadPrec [Reference]
readPrec :: ReadPrec Reference
$creadPrec :: ReadPrec Reference
readList :: ReadS [Reference]
$creadList :: ReadS [Reference]
readsPrec :: Int -> ReadS Reference
$creadsPrec :: Int -> ReadS Reference
Read, Typeable, Typeable Reference
DataType
Constr
Typeable Reference
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Reference -> c Reference)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Reference)
-> (Reference -> Constr)
-> (Reference -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Reference))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Reference))
-> ((forall b. Data b => b -> b) -> Reference -> Reference)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r)
-> (forall u. (forall d. Data d => d -> u) -> Reference -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Reference -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference)
-> Data Reference
Reference -> DataType
Reference -> Constr
(forall b. Data b => b -> b) -> Reference -> Reference
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Reference -> c Reference
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Reference
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Reference -> u
forall u. (forall d. Data d => d -> u) -> Reference -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Reference
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Reference -> c Reference
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Reference)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Reference)
$cReference :: Constr
$tReference :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Reference -> m Reference
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference
gmapMp :: (forall d. Data d => d -> m d) -> Reference -> m Reference
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference
gmapM :: (forall d. Data d => d -> m d) -> Reference -> m Reference
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Reference -> m Reference
gmapQi :: Int -> (forall d. Data d => d -> u) -> Reference -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Reference -> u
gmapQ :: (forall d. Data d => d -> u) -> Reference -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Reference -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Reference -> r
gmapT :: (forall b. Data b => b -> b) -> Reference -> Reference
$cgmapT :: (forall b. Data b => b -> b) -> Reference -> Reference
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Reference)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Reference)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Reference)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Reference)
dataTypeOf :: Reference -> DataType
$cdataTypeOf :: Reference -> DataType
toConstr :: Reference -> Constr
$ctoConstr :: Reference -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Reference
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Reference
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Reference -> c Reference
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Reference -> c Reference
$cp1Data :: Typeable Reference
Data, (forall x. Reference -> Rep Reference x)
-> (forall x. Rep Reference x -> Reference) -> Generic Reference
forall x. Rep Reference x -> Reference
forall x. Reference -> Rep Reference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Reference x -> Reference
$cfrom :: forall x. Reference -> Rep Reference x
Generic )
instance FromJSON Reference where
parseJSON :: Value -> Parser Reference
parseJSON (Object Object
v') = do
Object
v <- Object -> Parser Object
parseSuppFields Object
v' Parser Object -> Parser Object -> Parser Object
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Object -> Parser Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
v'
(Literal
-> [Literal]
-> RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference
Reference (Literal
-> [Literal]
-> RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
([Literal]
-> RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"id" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
([Literal]
-> RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Literal]
-> Parser
(RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Literal])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"other-ids" Parser (Maybe [Literal]) -> [Literal] -> Parser [Literal]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
(RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser RefType
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe RefType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"type" Parser (Maybe RefType) -> RefType -> Parser RefType
forall a. Parser (Maybe a) -> a -> Parser a
.!= RefType
NoType Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"author" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"editor" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"translator" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"recipient" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"interviewer" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"composer" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"director" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"illustrator" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"original-author" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"container-author" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"collection-editor" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"editorial-director" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [Agent]
-> Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Agent])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"reviewed-author" Parser (Maybe [Agent]) -> [Agent] -> Parser [Agent]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"issued" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"event-date" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"accessed" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
([RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"container" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
([RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"original-date" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
([RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser [RefDate]
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [RefDate])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"submitted" Parser (Maybe [RefDate]) -> [RefDate] -> Parser [RefDate]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
(Object
v Object -> Text -> Parser Formatted
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"shortTitle" Parser Formatted -> Parser Formatted -> Parser Formatted
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"title-short" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty)) Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"reviewed-title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"container-title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"volume-title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"collection-title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
(Object
v Object -> Text -> Parser Formatted
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"journalAbbreviation" Parser Formatted -> Parser Formatted -> Parser Formatted
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"container-title-short" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty) Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"collection-number" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"original-title" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"publisher" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"original-publisher" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"publisher-place" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"original-publisher-place" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"authority" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"jurisdiction" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"archive" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"archive-place" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"archive_location" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"event" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"event-place" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"page" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"page-first" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"number-of-pages" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"version" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"volume" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"number-of-volumes" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"issue" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"chapter-number" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"medium" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"status" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"edition" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"section" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"source" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"genre" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"note" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"annote" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"abstract" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"keyword" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"number" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Formatted
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Formatted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"references" Parser (Maybe Formatted) -> Formatted -> Parser Formatted
forall a. Parser (Maybe a) -> a -> Parser a
.!= Formatted
forall a. Monoid a => a
mempty Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"URL" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"DOI" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"ISBN" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"ISSN" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"PMCID" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"PMID" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"call-number" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference)
-> Parser Literal
-> Parser
(Literal
-> [Literal] -> Literal -> CNum -> Int -> CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"dimensions" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser
(Literal
-> [Literal] -> Literal -> CNum -> Int -> CLabel -> Reference)
-> Parser Literal
-> Parser
([Literal] -> Literal -> CNum -> Int -> CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"scale" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser ([Literal] -> Literal -> CNum -> Int -> CLabel -> Reference)
-> Parser [Literal]
-> Parser (Literal -> CNum -> Int -> CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe [Literal])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"categories" Parser (Maybe [Literal]) -> [Literal] -> Parser [Literal]
forall a. Parser (Maybe a) -> a -> Parser a
.!= [] Parser (Literal -> CNum -> Int -> CLabel -> Reference)
-> Parser Literal -> Parser (CNum -> Int -> CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe Literal)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"language" Parser (Maybe Literal) -> Literal -> Parser Literal
forall a. Parser (Maybe a) -> a -> Parser a
.!= Literal
"" Parser (CNum -> Int -> CLabel -> Reference)
-> Parser CNum -> Parser (Int -> CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe CNum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"citation-number" Parser (Maybe CNum) -> CNum -> Parser CNum
forall a. Parser (Maybe a) -> a -> Parser a
.!= Int -> CNum
CNum Int
0 Parser (Int -> CLabel -> Reference)
-> Parser Int -> Parser (CLabel -> Reference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
((Object
v Object -> Text -> Parser Value
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"first-reference-note-number" Parser Value -> (Value -> Parser Int) -> Parser Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Value -> Parser Int
parseInt) Parser Int -> Parser Int -> Parser Int
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Int -> Parser Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
0) Parser (CLabel -> Reference) -> Parser CLabel -> Parser Reference
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*>
Object
v Object -> Text -> Parser (Maybe CLabel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? Text
"citation-label" Parser (Maybe CLabel) -> CLabel -> Parser CLabel
forall a. Parser (Maybe a) -> a -> Parser a
.!= CLabel
forall a. Monoid a => a
mempty)
parseJSON Value
_ = String -> Parser Reference
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Could not parse Reference"
parseSuppFields :: Aeson.Object -> Parser Aeson.Object
parseSuppFields :: Object -> Parser Object
parseSuppFields Object
o = do
Text
nt <- Object
o Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
.: Text
"note"
case Parsec Text () [Pair] -> String -> Text -> Either ParseError [Pair]
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
P.parse Parsec Text () [Pair]
noteFields String
"note" Text
nt of
Left ParseError
err -> String -> Parser Object
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (ParseError -> String
forall a. Show a => a -> String
show ParseError
err)
Right [Pair]
fs -> Object -> Parser Object
forall (m :: * -> *) a. Monad m => a -> m a
return (Object -> Parser Object) -> Object -> Parser Object
forall a b. (a -> b) -> a -> b
$ (Pair -> Object -> Object) -> Object -> [Pair] -> Object
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (\(Text
k,Value
v) Object
x -> Text -> Value -> Object -> Object
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
H.insert Text
k Value
v Object
x) Object
o [Pair]
fs
noteFields :: P.Parser [(Text, Aeson.Value)]
noteFields :: Parsec Text () [Pair]
noteFields = do
[Either Text Pair]
fs <- ParsecT Text () Identity (Either Text Pair)
-> ParsecT Text () Identity [Either Text Pair]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
P.many (Pair -> Either Text Pair
forall a b. b -> Either a b
Right (Pair -> Either Text Pair)
-> ParsecT Text () Identity Pair
-> ParsecT Text () Identity (Either Text Pair)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ParsecT Text () Identity Pair
noteField ParsecT Text () Identity Pair
-> ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Text () Identity Pair
lineNoteField) ParsecT Text () Identity (Either Text Pair)
-> ParsecT Text () Identity (Either Text Pair)
-> ParsecT Text () Identity (Either Text Pair)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Either Text Pair
forall a b. a -> Either a b
Left (Text -> Either Text Pair)
-> ParsecT Text () Identity Text
-> ParsecT Text () Identity (Either Text Pair)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text () Identity Text
regText)
ParsecT Text () Identity ()
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m ()
P.spaces
let rest :: Text
rest = [Text] -> Text
T.unwords ([Either Text Pair] -> [Text]
forall a b. [Either a b] -> [a]
lefts [Either Text Pair]
fs)
[Pair] -> Parsec Text () [Pair]
forall (m :: * -> *) a. Monad m => a -> m a
return ((Text
"note", Text -> Value
Aeson.String Text
rest) Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Either Text Pair] -> [Pair]
forall a b. [Either a b] -> [b]
rights [Either Text Pair]
fs)
noteField :: P.Parser (Text, Aeson.Value)
noteField :: ParsecT Text () Identity Pair
noteField = ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair)
-> ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair
forall a b. (a -> b) -> a -> b
$ do
Char
_ <- Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'{'
Char
_ <- Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
':'
String
k <- ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a end.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
P.manyTill (ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.letter ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Char
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'-') (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
':')
()
_ <- ParsecT Text () Identity Char -> ParsecT Text () Identity ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
P.skipMany (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
' ')
String
v <- ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a end.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
P.manyTill ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.anyChar (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'}')
Pair -> ParsecT Text () Identity Pair
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> Text
T.pack String
k, Text -> Value
Aeson.String (String -> Text
T.pack String
v))
lineNoteField :: P.Parser (Text, Aeson.Value)
lineNoteField :: ParsecT Text () Identity Pair
lineNoteField = ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair)
-> ParsecT Text () Identity Pair -> ParsecT Text () Identity Pair
forall a b. (a -> b) -> a -> b
$ do
Char
_ <- Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'\n'
String
k <- ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a end.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
P.manyTill (ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.letter ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Char
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'-') (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
':')
()
_ <- ParsecT Text () Identity Char -> ParsecT Text () Identity ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
P.skipMany (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
' ')
String
v <- ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a end.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
P.manyTill ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.anyChar (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'\n' ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Char
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Char
'\n' Char
-> ParsecT Text () Identity () -> ParsecT Text () Identity Char
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Text () Identity ()
forall s (m :: * -> *) t u.
(Stream s m t, Show t) =>
ParsecT s u m ()
P.eof)
Pair -> ParsecT Text () Identity Pair
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> Text
T.pack String
k, Text -> Value
Aeson.String (String -> Text
T.pack String
v))
regText :: P.Parser Text
regText :: ParsecT Text () Identity Text
regText = (String -> Text
T.pack (String -> Text)
-> ParsecT Text () Identity String -> ParsecT Text () Identity Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 (String -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
P.noneOf String
"\n{")) ParsecT Text () Identity Text
-> ParsecT Text () Identity Text -> ParsecT Text () Identity Text
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> (Char -> Text
T.singleton (Char -> Text)
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.anyChar)
instance ToJSON Reference where
toJSON :: Reference -> Value
toJSON Reference
ref = [Pair] -> Value
object' [
Text
"id" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
refId Reference
ref
, Text
"other-ids" Text -> [Literal] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Literal]
refOtherIds Reference
ref
, Text
"type" Text -> RefType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> RefType
refType Reference
ref
, Text
"author" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
author Reference
ref
, Text
"editor" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
editor Reference
ref
, Text
"translator" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
translator Reference
ref
, Text
"recipient" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
recipient Reference
ref
, Text
"interviewer" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
interviewer Reference
ref
, Text
"composer" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
composer Reference
ref
, Text
"director" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
director Reference
ref
, Text
"illustrator" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
illustrator Reference
ref
, Text
"original-author" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
originalAuthor Reference
ref
, Text
"container-author" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
containerAuthor Reference
ref
, Text
"collection-editor" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
collectionEditor Reference
ref
, Text
"editorial-director" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
editorialDirector Reference
ref
, Text
"reviewed-author" Text -> [Agent] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Agent]
reviewedAuthor Reference
ref
, Text
"issued" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
issued Reference
ref
, Text
"event-date" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
eventDate Reference
ref
, Text
"accessed" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
accessed Reference
ref
, Text
"container" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
container Reference
ref
, Text
"original-date" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
originalDate Reference
ref
, Text
"submitted" Text -> [RefDate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [RefDate]
submitted Reference
ref
, Text
"title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
title Reference
ref
, Text
"title-short" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
titleShort Reference
ref
, Text
"reviewed-title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
reviewedTitle Reference
ref
, Text
"container-title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
containerTitle Reference
ref
, Text
"volume-title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
volumeTitle Reference
ref
, Text
"collection-title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
collectionTitle Reference
ref
, Text
"container-title-short" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
containerTitleShort Reference
ref
, Text
"collection-number" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
collectionNumber Reference
ref
, Text
"original-title" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
originalTitle Reference
ref
, Text
"publisher" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
publisher Reference
ref
, Text
"original-publisher" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
originalPublisher Reference
ref
, Text
"publisher-place" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
publisherPlace Reference
ref
, Text
"original-publisher-place" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
originalPublisherPlace Reference
ref
, Text
"authority" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
authority Reference
ref
, Text
"jurisdiction" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
jurisdiction Reference
ref
, Text
"archive" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
archive Reference
ref
, Text
"archive-place" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
archivePlace Reference
ref
, Text
"archive_location" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
archiveLocation Reference
ref
, Text
"event" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
event Reference
ref
, Text
"event-place" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
eventPlace Reference
ref
, Text
"page" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
page Reference
ref
, Text
"page-first" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= (if Reference -> Formatted
page Reference
ref Formatted -> Formatted -> Bool
forall a. Eq a => a -> a -> Bool
== Formatted
forall a. Monoid a => a
mempty then Reference -> Formatted
pageFirst Reference
ref else Formatted
forall a. Monoid a => a
mempty)
, Text
"number-of-pages" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
numberOfPages Reference
ref
, Text
"version" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
version Reference
ref
, Text
"volume" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
volume Reference
ref
, Text
"number-of-volumes" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
numberOfVolumes Reference
ref
, Text
"issue" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
issue Reference
ref
, Text
"chapter-number" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
chapterNumber Reference
ref
, Text
"medium" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
medium Reference
ref
, Text
"status" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
status Reference
ref
, Text
"edition" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
edition Reference
ref
, Text
"section" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
section Reference
ref
, Text
"source" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
source Reference
ref
, Text
"genre" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
genre Reference
ref
, Text
"note" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
note Reference
ref
, Text
"annote" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
annote Reference
ref
, Text
"abstract" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
abstract Reference
ref
, Text
"keyword" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
keyword Reference
ref
, Text
"number" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
number Reference
ref
, Text
"references" Text -> Formatted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Formatted
references Reference
ref
, Text
"URL" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
url Reference
ref
, Text
"DOI" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
doi Reference
ref
, Text
"ISBN" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
isbn Reference
ref
, Text
"ISSN" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
issn Reference
ref
, Text
"PMCID" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
pmcid Reference
ref
, Text
"PMID" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
pmid Reference
ref
, Text
"call-number" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
callNumber Reference
ref
, Text
"dimensions" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
dimensions Reference
ref
, Text
"scale" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
scale Reference
ref
, Text
"categories" Text -> [Literal] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> [Literal]
categories Reference
ref
, Text
"language" Text -> Literal -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Literal
language Reference
ref
, Text
"citation-number" Text -> CNum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> CNum
citationNumber Reference
ref
, Text
"first-reference-note-number" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> Int
firstReferenceNoteNumber Reference
ref
, Text
"citation-label" Text -> CLabel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Reference -> CLabel
citationLabel Reference
ref
]
instance ToYaml Reference where
toYaml :: Reference -> YamlBuilder
toYaml Reference
ref = [[(Text, YamlBuilder)] -> [(Text, YamlBuilder)]] -> YamlBuilder
mapping' [
Text
"id" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
refId Reference
ref
, Text
"other-ids" Text -> [Literal] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Literal]
refOtherIds Reference
ref
, ((Text
"type" Text -> RefType -> (Text, YamlBuilder)
forall a. ToYaml a => Text -> a -> (Text, YamlBuilder)
Y..= Reference -> RefType
refType Reference
ref) (Text, YamlBuilder)
-> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> [a] -> [a]
:)
, Text
"author" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
author Reference
ref
, Text
"editor" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
editor Reference
ref
, Text
"translator" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
translator Reference
ref
, Text
"recipient" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
recipient Reference
ref
, Text
"interviewer" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
interviewer Reference
ref
, Text
"composer" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
composer Reference
ref
, Text
"director" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
director Reference
ref
, Text
"illustrator" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
illustrator Reference
ref
, Text
"original-author" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
originalAuthor Reference
ref
, Text
"container-author" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
containerAuthor Reference
ref
, Text
"collection-editor" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
collectionEditor Reference
ref
, Text
"editorial-director" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
editorialDirector Reference
ref
, Text
"reviewed-author" Text -> [Agent] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Agent]
reviewedAuthor Reference
ref
, Text
"issued" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
issued Reference
ref
, Text
"event-date" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
eventDate Reference
ref
, Text
"accessed" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
accessed Reference
ref
, Text
"container" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
container Reference
ref
, Text
"original-date" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
originalDate Reference
ref
, Text
"submitted" Text -> [RefDate] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [RefDate]
submitted Reference
ref
, Text
"title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
title Reference
ref
, Text
"title-short" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
titleShort Reference
ref
, Text
"reviewed-title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
reviewedTitle Reference
ref
, Text
"container-title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
containerTitle Reference
ref
, Text
"volume-title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
volumeTitle Reference
ref
, Text
"collection-title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
collectionTitle Reference
ref
, Text
"container-title-short" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
containerTitleShort Reference
ref
, Text
"collection-number" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
collectionNumber Reference
ref
, Text
"original-title" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
originalTitle Reference
ref
, Text
"publisher" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
publisher Reference
ref
, Text
"original-publisher" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
originalPublisher Reference
ref
, Text
"publisher-place" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
publisherPlace Reference
ref
, Text
"original-publisher-place" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
originalPublisherPlace Reference
ref
, Text
"authority" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
authority Reference
ref
, Text
"jurisdiction" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
jurisdiction Reference
ref
, Text
"archive" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
archive Reference
ref
, Text
"archive-place" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
archivePlace Reference
ref
, Text
"archive_location" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
archiveLocation Reference
ref
, Text
"event" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
event Reference
ref
, Text
"event-place" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
eventPlace Reference
ref
, Text
"page" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
page Reference
ref
, Text
"page-first" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= (if Reference -> Formatted
page Reference
ref Formatted -> Formatted -> Bool
forall a. Eq a => a -> a -> Bool
== Formatted
forall a. Monoid a => a
mempty then Reference -> Formatted
pageFirst Reference
ref else Formatted
forall a. Monoid a => a
mempty)
, Text
"number-of-pages" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
numberOfPages Reference
ref
, Text
"version" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
version Reference
ref
, Text
"volume" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
volume Reference
ref
, Text
"number-of-volumes" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
numberOfVolumes Reference
ref
, Text
"issue" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
issue Reference
ref
, Text
"chapter-number" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
chapterNumber Reference
ref
, Text
"medium" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
medium Reference
ref
, Text
"status" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
status Reference
ref
, Text
"edition" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
edition Reference
ref
, Text
"section" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
section Reference
ref
, Text
"source" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
source Reference
ref
, Text
"genre" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
genre Reference
ref
, Text
"note" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
note Reference
ref
, Text
"annote" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
annote Reference
ref
, Text
"abstract" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
abstract Reference
ref
, Text
"keyword" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
keyword Reference
ref
, Text
"number" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
number Reference
ref
, Text
"references" Text -> Formatted -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Formatted
references Reference
ref
, Text
"URL" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
url Reference
ref
, Text
"DOI" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
doi Reference
ref
, Text
"ISBN" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
isbn Reference
ref
, Text
"ISSN" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
issn Reference
ref
, Text
"PMCID" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
pmcid Reference
ref
, Text
"PMID" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
pmid Reference
ref
, Text
"call-number" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
callNumber Reference
ref
, Text
"dimensions" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
dimensions Reference
ref
, Text
"scale" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
scale Reference
ref
, Text
"categories" Text -> [Literal] -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> [Literal]
categories Reference
ref
, Text
"language" Text -> Literal -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a.
AddYaml a =>
Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
&= Reference -> Literal
language Reference
ref
, if Reference -> CNum
citationNumber Reference
ref CNum -> CNum -> Bool
forall a. Eq a => a -> a -> Bool
== Int -> CNum
CNum Int
0
then [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> a
id
else ((Text
"citation-number" Text -> CNum -> (Text, YamlBuilder)
forall a. ToYaml a => Text -> a -> (Text, YamlBuilder)
Y..= Reference -> CNum
citationNumber Reference
ref) (Text, YamlBuilder)
-> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> [a] -> [a]
:)
, if Reference -> Int
firstReferenceNoteNumber Reference
ref Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0
then [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> a
id
else ((Text
"first-reference-note-number" Text -> Int -> (Text, YamlBuilder)
forall a. ToYaml a => Text -> a -> (Text, YamlBuilder)
Y..=
Reference -> Int
firstReferenceNoteNumber Reference
ref) (Text, YamlBuilder)
-> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> [a] -> [a]
:)
, if Reference -> CLabel
citationLabel Reference
ref CLabel -> CLabel -> Bool
forall a. Eq a => a -> a -> Bool
== CLabel
forall a. Monoid a => a
mempty
then [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> a
id
else ((Text
"citation-label" Text -> CLabel -> (Text, YamlBuilder)
forall a. ToYaml a => Text -> a -> (Text, YamlBuilder)
Y..= Reference -> CLabel
citationLabel Reference
ref) (Text, YamlBuilder)
-> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
forall a. a -> [a] -> [a]
:)
]
emptyReference :: Reference
emptyReference :: Reference
emptyReference =
Reference :: Literal
-> [Literal]
-> RefType
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [Agent]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> [RefDate]
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Formatted
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> Literal
-> [Literal]
-> Literal
-> CNum
-> Int
-> CLabel
-> Reference
Reference
{ refId :: Literal
refId = Literal
forall a. Monoid a => a
mempty
, refOtherIds :: [Literal]
refOtherIds = [Literal]
forall a. Monoid a => a
mempty
, refType :: RefType
refType = RefType
NoType
, author :: [Agent]
author = []
, editor :: [Agent]
editor = []
, translator :: [Agent]
translator = []
, recipient :: [Agent]
recipient = []
, interviewer :: [Agent]
interviewer = []
, composer :: [Agent]
composer = []
, director :: [Agent]
director = []
, illustrator :: [Agent]
illustrator = []
, originalAuthor :: [Agent]
originalAuthor = []
, containerAuthor :: [Agent]
containerAuthor = []
, collectionEditor :: [Agent]
collectionEditor = []
, editorialDirector :: [Agent]
editorialDirector = []
, reviewedAuthor :: [Agent]
reviewedAuthor = []
, issued :: [RefDate]
issued = []
, eventDate :: [RefDate]
eventDate = []
, accessed :: [RefDate]
accessed = []
, container :: [RefDate]
container = []
, originalDate :: [RefDate]
originalDate = []
, submitted :: [RefDate]
submitted = []
, title :: Formatted
title = Formatted
forall a. Monoid a => a
mempty
, titleShort :: Formatted
titleShort = Formatted
forall a. Monoid a => a
mempty
, reviewedTitle :: Formatted
reviewedTitle = Formatted
forall a. Monoid a => a
mempty
, containerTitle :: Formatted
containerTitle = Formatted
forall a. Monoid a => a
mempty
, volumeTitle :: Formatted
volumeTitle = Formatted
forall a. Monoid a => a
mempty
, collectionTitle :: Formatted
collectionTitle = Formatted
forall a. Monoid a => a
mempty
, containerTitleShort :: Formatted
containerTitleShort = Formatted
forall a. Monoid a => a
mempty
, collectionNumber :: Formatted
collectionNumber = Formatted
forall a. Monoid a => a
mempty
, originalTitle :: Formatted
originalTitle = Formatted
forall a. Monoid a => a
mempty
, publisher :: Formatted
publisher = Formatted
forall a. Monoid a => a
mempty
, originalPublisher :: Formatted
originalPublisher = Formatted
forall a. Monoid a => a
mempty
, publisherPlace :: Formatted
publisherPlace = Formatted
forall a. Monoid a => a
mempty
, originalPublisherPlace :: Formatted
originalPublisherPlace = Formatted
forall a. Monoid a => a
mempty
, authority :: Formatted
authority = Formatted
forall a. Monoid a => a
mempty
, jurisdiction :: Formatted
jurisdiction = Formatted
forall a. Monoid a => a
mempty
, archive :: Formatted
archive = Formatted
forall a. Monoid a => a
mempty
, archivePlace :: Formatted
archivePlace = Formatted
forall a. Monoid a => a
mempty
, archiveLocation :: Formatted
archiveLocation = Formatted
forall a. Monoid a => a
mempty
, event :: Formatted
event = Formatted
forall a. Monoid a => a
mempty
, eventPlace :: Formatted
eventPlace = Formatted
forall a. Monoid a => a
mempty
, page :: Formatted
page = Formatted
forall a. Monoid a => a
mempty
, pageFirst :: Formatted
pageFirst = Formatted
forall a. Monoid a => a
mempty
, numberOfPages :: Formatted
numberOfPages = Formatted
forall a. Monoid a => a
mempty
, version :: Formatted
version = Formatted
forall a. Monoid a => a
mempty
, volume :: Formatted
volume = Formatted
forall a. Monoid a => a
mempty
, numberOfVolumes :: Formatted
numberOfVolumes = Formatted
forall a. Monoid a => a
mempty
, issue :: Formatted
issue = Formatted
forall a. Monoid a => a
mempty
, chapterNumber :: Formatted
chapterNumber = Formatted
forall a. Monoid a => a
mempty
, medium :: Formatted
medium = Formatted
forall a. Monoid a => a
mempty
, status :: Formatted
status = Formatted
forall a. Monoid a => a
mempty
, edition :: Formatted
edition = Formatted
forall a. Monoid a => a
mempty
, section :: Formatted
section = Formatted
forall a. Monoid a => a
mempty
, source :: Formatted
source = Formatted
forall a. Monoid a => a
mempty
, genre :: Formatted
genre = Formatted
forall a. Monoid a => a
mempty
, note :: Formatted
note = Formatted
forall a. Monoid a => a
mempty
, annote :: Formatted
annote = Formatted
forall a. Monoid a => a
mempty
, abstract :: Formatted
abstract = Formatted
forall a. Monoid a => a
mempty
, keyword :: Formatted
keyword = Formatted
forall a. Monoid a => a
mempty
, number :: Formatted
number = Formatted
forall a. Monoid a => a
mempty
, references :: Formatted
references = Formatted
forall a. Monoid a => a
mempty
, url :: Literal
url = Literal
forall a. Monoid a => a
mempty
, doi :: Literal
doi = Literal
forall a. Monoid a => a
mempty
, isbn :: Literal
isbn = Literal
forall a. Monoid a => a
mempty
, issn :: Literal
issn = Literal
forall a. Monoid a => a
mempty
, pmcid :: Literal
pmcid = Literal
forall a. Monoid a => a
mempty
, pmid :: Literal
pmid = Literal
forall a. Monoid a => a
mempty
, callNumber :: Literal
callNumber = Literal
forall a. Monoid a => a
mempty
, dimensions :: Literal
dimensions = Literal
forall a. Monoid a => a
mempty
, scale :: Literal
scale = Literal
forall a. Monoid a => a
mempty
, categories :: [Literal]
categories = [Literal]
forall a. Monoid a => a
mempty
, language :: Literal
language = Literal
forall a. Monoid a => a
mempty
, citationNumber :: CNum
citationNumber = Int -> CNum
CNum Int
0
, firstReferenceNoteNumber :: Int
firstReferenceNoteNumber = Int
0
, citationLabel :: CLabel
citationLabel = CLabel
forall a. Monoid a => a
mempty
}
numericVars :: [Text]
numericVars :: [Text]
numericVars = [ Text
"edition", Text
"volume", Text
"number-of-volumes", Text
"number", Text
"issue", Text
"citation-number"
, Text
"chapter-number", Text
"collection-number", Text
"number-of-pages"]
getReference :: [Reference] -> Cite -> Maybe Reference
getReference :: [Reference] -> Cite -> Maybe Reference
getReference [Reference]
rs Cite
c
= case (Text -> Reference -> Bool
hasId (Cite -> Text
citeId Cite
c)) (Reference -> Bool) -> [Reference] -> Maybe Reference
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
`find` [Reference]
rs of
Just Reference
r -> Reference -> Maybe Reference
forall a. a -> Maybe a
Just (Reference -> Maybe Reference) -> Reference -> Maybe Reference
forall a b. (a -> b) -> a -> b
$ Reference -> Reference
setPageFirst Reference
r
Maybe Reference
Nothing -> Maybe Reference
forall a. Maybe a
Nothing
where hasId :: Text -> Reference -> Bool
hasId :: Text -> Reference -> Bool
hasId Text
ident Reference
r = Text
ident Text -> [Text] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ((Literal -> Text) -> [Literal] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Literal -> Text
unLiteral (Reference -> Literal
refId Reference
r Literal -> [Literal] -> [Literal]
forall a. a -> [a] -> [a]
: Reference -> [Literal]
refOtherIds Reference
r))
processCites :: [Reference] -> [[Cite]] -> [[(Cite, Maybe Reference)]]
processCites :: [Reference] -> [[Cite]] -> [[(Cite, Maybe Reference)]]
processCites [Reference]
rs [[Cite]]
cs
= [[Cite]] -> [[Cite]] -> [[(Cite, Maybe Reference)]]
procGr [] [[Cite]]
cs
where
procRef :: Reference -> Reference
procRef Reference
r = case (Cite -> Bool) -> [Cite] -> [Cite]
forall a. (a -> Bool) -> [a] -> [a]
filter (Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
(==) (Literal -> Text
unLiteral (Literal -> Text) -> Literal -> Text
forall a b. (a -> b) -> a -> b
$ Reference -> Literal
refId Reference
r) (Text -> Bool) -> (Cite -> Text) -> Cite -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Cite -> Text
citeId) ([Cite] -> [Cite]) -> [Cite] -> [Cite]
forall a b. (a -> b) -> a -> b
$ [[Cite]] -> [Cite]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[Cite]]
cs of
Cite
x:[Cite]
_ -> Reference
r { firstReferenceNoteNumber :: Int
firstReferenceNoteNumber = Text -> Int
readNum (Text -> Int) -> Text -> Int
forall a b. (a -> b) -> a -> b
$ Cite -> Text
citeNoteNumber Cite
x}
[] -> Reference
r
procGr :: [[Cite]] -> [[Cite]] -> [[(Cite, Maybe Reference)]]
procGr [[Cite]]
_ [] = []
procGr [[Cite]]
acc ([Cite]
x:[[Cite]]
xs) = let ([[Cite]]
a',[(Cite, Maybe Reference)]
res) = [[Cite]] -> [Cite] -> ([[Cite]], [(Cite, Maybe Reference)])
procCs [[Cite]]
acc [Cite]
x
in [(Cite, Maybe Reference)]
res [(Cite, Maybe Reference)]
-> [[(Cite, Maybe Reference)]] -> [[(Cite, Maybe Reference)]]
forall a. a -> [a] -> [a]
: [[Cite]] -> [[Cite]] -> [[(Cite, Maybe Reference)]]
procGr ([] [Cite] -> [[Cite]] -> [[Cite]]
forall a. a -> [a] -> [a]
: [[Cite]]
a') [[Cite]]
xs
procCs :: [[Cite]] -> [Cite] -> ([[Cite]], [(Cite, Maybe Reference)])
procCs [[Cite]]
acc [] = ([[Cite]]
acc,[])
procCs [[Cite]]
acc (Cite
c:[Cite]
xs) = let ([[Cite]]
a, [(Cite, Maybe Reference)]
rest) = [[Cite]] -> [Cite] -> ([[Cite]], [(Cite, Maybe Reference)])
procCs [[Cite]]
addCite [Cite]
xs
ref :: Maybe Reference
ref = Reference -> Reference
procRef (Reference -> Reference) -> Maybe Reference -> Maybe Reference
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Reference] -> Cite -> Maybe Reference
getReference [Reference]
rs Cite
c
c' :: Cite
c' = Cite
c { citePosition :: Text
citePosition = Text
getCitePosition }
in ([[Cite]]
a, (Cite
c', Maybe Reference
ref) (Cite, Maybe Reference)
-> [(Cite, Maybe Reference)] -> [(Cite, Maybe Reference)]
forall a. a -> [a] -> [a]
: [(Cite, Maybe Reference)]
rest)
where
addCite :: [[Cite]]
addCite = case [[Cite]]
acc of
[] -> [[Cite
c]]
(a:as) -> (Cite
c Cite -> [Cite] -> [Cite]
forall a. a -> [a] -> [a]
: [Cite]
a) [Cite] -> [[Cite]] -> [[Cite]]
forall a. a -> [a] -> [a]
: [[Cite]]
as
getCitePosition :: Text
getCitePosition = Text -> Maybe Text -> Text
forall a. a -> Maybe a -> a
fromMaybe Text
notIbid (Cite -> Text
forall p. IsString p => Cite -> p
ibidPosition (Cite -> Text) -> Maybe Cite -> Maybe Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Cite
prevSameCite)
where
notIbid :: Text
notIbid = if Cite -> Text
citeId Cite
c Text -> [Text] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` (Cite -> Text) -> [Cite] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Cite -> Text
citeId ([[Cite]] -> [Cite]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[Cite]]
acc)
then Text
"subsequent"
else Text
"first"
ibidPosition :: Cite -> p
ibidPosition Cite
x = let hasL :: Cite -> Bool
hasL Cite
k = Cite -> Text
citeLocator Cite
k Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Text
""
withIf :: Bool -> p
withIf Bool
b = if Bool
b then p
"ibid-with-locator" else p
"ibid"
diffLoc :: Bool
diffLoc = Cite -> Text
citeLocator Cite
x Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Cite -> Text
citeLocator Cite
c
Bool -> Bool -> Bool
|| Cite -> Text
citeLabel Cite
x Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Cite -> Text
citeLabel Cite
c
in case (Cite -> Bool
hasL Cite
x, Cite -> Bool
hasL Cite
c) of
(Bool
False, Bool
cur) -> Bool -> p
forall p. IsString p => Bool -> p
withIf Bool
cur
(Bool
True, Bool
True) -> Bool -> p
forall p. IsString p => Bool -> p
withIf Bool
diffLoc
(Bool
True, Bool
False) -> p
"subsequent"
prevSameCite :: Maybe Cite
prevSameCite = case [[Cite]]
acc of
[] -> Maybe Cite
forall a. Maybe a
Nothing
(a:as) -> [Cite] -> [[Cite]] -> Maybe Cite
psc [Cite]
a [[Cite]]
as
where
psc :: [Cite] -> [[Cite]] -> Maybe Cite
psc [] [] = Maybe Cite
forall a. Maybe a
Nothing
psc (Cite
x:[Cite]
_) [[Cite]]
_ = if Cite -> Text
citeId Cite
c Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Cite -> Text
citeId Cite
x
then Cite -> Maybe Cite
forall a. a -> Maybe a
Just Cite
x
else Maybe Cite
forall a. Maybe a
Nothing
psc [] ([Cite]
zs:[[Cite]]
_) = case [Cite]
zs of
[] -> Maybe Cite
forall a. Maybe a
Nothing
(Cite
z:[Cite]
_) -> if (Text -> Bool) -> [Text] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Cite -> Text
citeId Cite
c) ((Cite -> Text) -> [Cite] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Cite -> Text
citeId [Cite]
zs)
then Cite -> Maybe Cite
forall a. a -> Maybe a
Just Cite
z
else Maybe Cite
forall a. Maybe a
Nothing
setPageFirst :: Reference -> Reference
setPageFirst :: Reference -> Reference
setPageFirst Reference
ref =
let Formatted [Inline]
ils = Reference -> Formatted
page Reference
ref
ils' :: [Inline]
ils' = (Inline -> Bool) -> [Inline] -> [Inline]
forall a. (a -> Bool) -> [a] -> [a]
takeWhile (\Inline
i -> Inline
i Inline -> Inline -> Bool
forall a. Eq a => a -> a -> Bool
/= Text -> Inline
Str Text
"–" Bool -> Bool -> Bool
&& Inline
i Inline -> Inline -> Bool
forall a. Eq a => a -> a -> Bool
/= Text -> Inline
Str Text
"-") ([Inline] -> [Inline]) -> [Inline] -> [Inline]
forall a b. (a -> b) -> a -> b
$
(Char -> Bool) -> [Inline] -> [Inline]
splitStrWhen Char -> Bool
isPunctuation [Inline]
ils
in if [Inline]
ils [Inline] -> [Inline] -> Bool
forall a. Eq a => a -> a -> Bool
== [Inline]
ils'
then Reference
ref
else Reference
ref{ pageFirst :: Formatted
pageFirst = [Inline] -> Formatted
Formatted [Inline]
ils' }
setNearNote :: Style -> [[Cite]] -> [[Cite]]
setNearNote :: Style -> [[Cite]] -> [[Cite]]
setNearNote Style
s [[Cite]]
cs
= [Cite] -> [[Cite]] -> [[Cite]]
procGr [] [[Cite]]
cs
where
near_note :: Int
near_note = let nn :: Maybe Text
nn = Text -> [(Text, Text)] -> Maybe Text
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Text
"near-note-distance" ([(Text, Text)] -> Maybe Text)
-> (Style -> [(Text, Text)]) -> Style -> Maybe Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Citation -> [(Text, Text)]
citOptions (Citation -> [(Text, Text)])
-> (Style -> Citation) -> Style -> [(Text, Text)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Style -> Citation
citation (Style -> Maybe Text) -> Style -> Maybe Text
forall a b. (a -> b) -> a -> b
$ Style
s
in Int -> (Text -> Int) -> Maybe Text -> Int
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Int
5 Text -> Int
readNum Maybe Text
nn
procGr :: [Cite] -> [[Cite]] -> [[Cite]]
procGr [Cite]
_ [] = []
procGr [Cite]
a ([Cite]
x:[[Cite]]
xs) = let ([Cite]
a',[Cite]
res) = [Cite] -> [Cite] -> ([Cite], [Cite])
procCs [Cite]
a [Cite]
x
in [Cite]
res [Cite] -> [[Cite]] -> [[Cite]]
forall a. a -> [a] -> [a]
: [Cite] -> [[Cite]] -> [[Cite]]
procGr [Cite]
a' [[Cite]]
xs
procCs :: [Cite] -> [Cite] -> ([Cite], [Cite])
procCs [Cite]
a [] = ([Cite]
a,[])
procCs [Cite]
a (Cite
c:[Cite]
xs) = ([Cite]
a', Cite
c { nearNote :: Bool
nearNote = Bool
isNear} Cite -> [Cite] -> [Cite]
forall a. a -> [a] -> [a]
: [Cite]
rest)
where
([Cite]
a', [Cite]
rest) = [Cite] -> [Cite] -> ([Cite], [Cite])
procCs (Cite
cCite -> [Cite] -> [Cite]
forall a. a -> [a] -> [a]
:[Cite]
a) [Cite]
xs
isNear :: Bool
isNear = case (Cite -> Bool) -> [Cite] -> [Cite]
forall a. (a -> Bool) -> [a] -> [a]
filter (Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
(==) (Cite -> Text
citeId Cite
c) (Text -> Bool) -> (Cite -> Text) -> Cite -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Cite -> Text
citeId) [Cite]
a of
Cite
x:[Cite]
_ -> Cite -> Text
citeNoteNumber Cite
c Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Text
"0" Bool -> Bool -> Bool
&&
Cite -> Text
citeNoteNumber Cite
x Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Text
"0" Bool -> Bool -> Bool
&&
Text -> Int
readNum (Cite -> Text
citeNoteNumber Cite
c) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Text -> Int
readNum (Cite -> Text
citeNoteNumber Cite
x) Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
near_note
[Cite]
_ -> Bool
False
parseRawDate :: Text -> [RefDate]
parseRawDate :: Text -> [RefDate]
parseRawDate Text
o =
case Parsec Text () [RefDate]
-> String -> Text -> Either ParseError [RefDate]
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
P.parse Parsec Text () [RefDate]
rawDate String
"raw date" Text
o of
Left ParseError
_ -> [Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate Maybe Int
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Maybe Season
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing (Text -> Literal
Literal Text
o) Bool
False]
Right [RefDate]
ds -> [RefDate]
ds
rawDate :: P.Parser [RefDate]
rawDate :: Parsec Text () [RefDate]
rawDate = Parsec Text () [RefDate]
rawDateISO Parsec Text () [RefDate]
-> Parsec Text () [RefDate] -> Parsec Text () [RefDate]
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parsec Text () [RefDate]
rawDateOld
parseEDTFDate :: Text -> [RefDate]
parseEDTFDate :: Text -> [RefDate]
parseEDTFDate Text
o =
case Text -> Text
handleRanges (Text -> Text
trim Text
o) of
Text
"" -> []
Text
o' -> case Parsec Text () [RefDate]
-> String -> Text -> Either ParseError [RefDate]
forall s t a.
Stream s Identity t =>
Parsec s () a -> String -> s -> Either ParseError a
P.parse Parsec Text () [RefDate]
rawDateISO String
"date" Text
o' of
Left ParseError
_ -> []
Right [RefDate]
ds -> [RefDate]
ds
where handleRanges :: Text -> Text
handleRanges Text
s =
case Text -> Text -> [Text]
T.splitOn Text
"/" Text
s of
[Text
x] | (Char -> Bool) -> Text -> Bool
T.any (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'u') Text
x ->
(Char -> Char) -> Text -> Text
T.map (\Char
c -> if Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'u' then Char
'0' else Char
c) Text
x
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
(Char -> Char) -> Text -> Text
T.map (\Char
c -> if Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'u' then Char
'9' else Char
c) Text
x
[Text
x, Text
"open"] -> Text
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/"
[Text
x, Text
"unknown"] -> Text
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"/"
[Text]
_ -> Text
s
rawDateISO :: P.Parser [RefDate]
rawDateISO :: Parsec Text () [RefDate]
rawDateISO = do
RefDate
d1 <- Parser RefDate
isoDate
[RefDate] -> Parsec Text () [RefDate] -> Parsec Text () [RefDate]
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option [RefDate
d1] (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'/' ParsecT Text () Identity Char
-> Parsec Text () [RefDate] -> Parsec Text () [RefDate]
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
(\RefDate
x -> [RefDate
d1, RefDate
x]) (RefDate -> [RefDate])
-> Parser RefDate -> Parsec Text () [RefDate]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
( Parser RefDate
isoDate Parser RefDate -> Parser RefDate -> Parser RefDate
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> RefDate -> Parser RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate
emptydate )) Parsec Text () [RefDate]
-> ParsecT Text () Identity () -> Parsec Text () [RefDate]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Text () Identity ()
forall s (m :: * -> *) t u.
(Stream s m t, Show t) =>
ParsecT s u m ()
P.eof
where emptydate :: RefDate
emptydate = Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate Maybe Int
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Maybe Season
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Literal
forall a. Monoid a => a
mempty Bool
False
isoDate :: P.Parser RefDate
isoDate :: Parser RefDate
isoDate = Parser RefDate -> Parser RefDate
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (Parser RefDate -> Parser RefDate)
-> Parser RefDate -> Parser RefDate
forall a b. (a -> b) -> a -> b
$ do
Bool
extyear <- Bool
-> ParsecT Text () Identity Bool -> ParsecT Text () Identity Bool
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option Bool
False (Bool
True Bool
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'y')
Maybe Int
y <- do
String
sign <- String
-> ParsecT Text () Identity String
-> ParsecT Text () Identity String
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option String
"" (String -> ParsecT Text () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
P.string String
"-")
String
rest <- Int
-> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
Int -> ParsecT s u m a -> ParsecT s u m [a]
P.count Int
4 ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit
String
extended <- if Bool
extyear
then ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
P.many ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit
else String -> ParsecT Text () Identity String
forall (m :: * -> *) a. Monad m => a -> m a
return []
Maybe Int -> ParsecT Text () Identity (Maybe Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Int -> ParsecT Text () Identity (Maybe Int))
-> Maybe Int -> ParsecT Text () Identity (Maybe Int)
forall a b. (a -> b) -> a -> b
$ case Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ String
sign String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
rest String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
extended) of
Just Int
x | Int
x Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
0 -> Int -> Maybe Int
forall a. a -> Maybe a
Just (Int
x Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)
Maybe Int
x -> Maybe Int
x
Maybe String
m' <- Maybe String
-> ParsecT Text () Identity (Maybe String)
-> ParsecT Text () Identity (Maybe String)
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option Maybe String
forall a. Maybe a
Nothing (ParsecT Text () Identity (Maybe String)
-> ParsecT Text () Identity (Maybe String))
-> ParsecT Text () Identity (Maybe String)
-> ParsecT Text () Identity (Maybe String)
forall a b. (a -> b) -> a -> b
$ String -> Maybe String
forall a. a -> Maybe a
Just (String -> Maybe String)
-> ParsecT Text () Identity String
-> ParsecT Text () Identity (Maybe String)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text () Identity String -> ParsecT Text () Identity String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'-' ParsecT Text () Identity Char
-> ParsecT Text () Identity String
-> ParsecT Text () Identity String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit)
(Maybe Int
m,Maybe Season
s) <- case Maybe String
m' Maybe String -> (String -> Maybe Int) -> Maybe Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (Text -> Maybe Int) -> (String -> Text) -> String -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack of
Just (Int
n::Int)
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
1 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
12 -> (Maybe Int, Maybe Season)
-> ParsecT Text () Identity (Maybe Int, Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n, Maybe Season
forall a. Maybe a
Nothing)
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
13 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
16 -> (Maybe Int, Maybe Season)
-> ParsecT Text () Identity (Maybe Int, Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Int
forall a. Maybe a
Nothing, Int -> Maybe Season
pseudoMonthToSeason Int
n)
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
21 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
24 -> (Maybe Int, Maybe Season)
-> ParsecT Text () Identity (Maybe Int, Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Int
forall a. Maybe a
Nothing, Int -> Maybe Season
pseudoMonthToSeason Int
n)
Maybe Int
Nothing | Maybe String -> Bool
forall a. Maybe a -> Bool
isNothing Maybe String
m' -> (Maybe Int, Maybe Season)
-> ParsecT Text () Identity (Maybe Int, Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Int
forall a. Maybe a
Nothing, Maybe Season
forall a. Maybe a
Nothing)
Maybe Int
_ -> String -> ParsecT Text () Identity (Maybe Int, Maybe Season)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Improper month"
Maybe Int
d <- Maybe Int
-> ParsecT Text () Identity (Maybe Int)
-> ParsecT Text () Identity (Maybe Int)
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option Maybe Int
forall a. Maybe a
Nothing (ParsecT Text () Identity (Maybe Int)
-> ParsecT Text () Identity (Maybe Int))
-> ParsecT Text () Identity (Maybe Int)
-> ParsecT Text () Identity (Maybe Int)
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (Text -> Maybe Int) -> (String -> Text) -> String -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> Maybe Int)
-> ParsecT Text () Identity String
-> ParsecT Text () Identity (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text () Identity String -> ParsecT Text () Identity String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'-' ParsecT Text () Identity Char
-> ParsecT Text () Identity String
-> ParsecT Text () Identity String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit)
Bool -> ParsecT Text () Identity ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (Bool -> ParsecT Text () Identity ())
-> Bool -> ParsecT Text () Identity ()
forall a b. (a -> b) -> a -> b
$ case Maybe Int
d of
Maybe Int
Nothing -> Bool
True
Just (Int
n::Int) | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
1 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
31 -> Bool
True
Maybe Int
_ -> Bool
False
ParsecT Text () Identity () -> ParsecT Text () Identity ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m ()
P.optional (ParsecT Text () Identity () -> ParsecT Text () Identity ())
-> ParsecT Text () Identity () -> ParsecT Text () Identity ()
forall a b. (a -> b) -> a -> b
$ do
Char
_ <- Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'T'
String
_ <- ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
P.many (ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Char
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
':')
ParsecT Text () Identity String -> ParsecT Text () Identity ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m ()
P.optional (ParsecT Text () Identity String -> ParsecT Text () Identity ())
-> ParsecT Text () Identity String -> ParsecT Text () Identity ()
forall a b. (a -> b) -> a -> b
$ (String -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
P.oneOf String
"+-" ParsecT Text () Identity Char
-> ParsecT Text () Identity String
-> ParsecT Text () Identity String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT Text () Identity Char -> ParsecT Text () Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 (ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit ParsecT Text () Identity Char
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Char
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
':'))
ParsecT Text () Identity String
-> ParsecT Text () Identity String
-> ParsecT Text () Identity String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> String -> ParsecT Text () Identity String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
P.string String
"Z"
()
_ <- ParsecT Text () Identity Char -> ParsecT Text () Identity ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m ()
P.optional (Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'?')
Bool
c <- Bool
-> ParsecT Text () Identity Bool -> ParsecT Text () Identity Bool
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option Bool
False (Bool
True Bool
-> ParsecT Text () Identity Char -> ParsecT Text () Identity Bool
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Char -> ParsecT Text () Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'~')
RefDate -> Parser RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate :: Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate{ year :: Maybe Int
year = Maybe Int
y, month :: Maybe Int
month = Maybe Int
m,
season :: Maybe Season
season = Maybe Season
s, day :: Maybe Int
day = Maybe Int
d,
other :: Literal
other = Literal
forall a. Monoid a => a
mempty, circa :: Bool
circa = Bool
c }
rawDateOld :: P.Parser [RefDate]
rawDateOld :: Parsec Text () [RefDate]
rawDateOld = do
let months :: [String]
months = [String
"jan",String
"feb",String
"mar",String
"apr",String
"may",String
"jun",String
"jul",String
"aug",
String
"sep",String
"oct",String
"nov",String
"dec"]
let seasons :: [String]
seasons = [String
"spr",String
"sum",String
"fal",String
"win"]
let pmonth :: ParsecT Text u Identity (Maybe Int)
pmonth = ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int)
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int))
-> ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int)
forall a b. (a -> b) -> a -> b
$ do
String
xs <- ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text u Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.letter ParsecT Text u Identity String
-> ParsecT Text u Identity String -> ParsecT Text u Identity String
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text u Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit
if (Char -> Bool) -> String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isDigit String
xs
then case Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (String -> Text
T.pack String
xs) of
Just (Int
n::Int) | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
1 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
12 -> Maybe Int -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n)
Maybe Int
_ -> String -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Improper month"
else case String -> [String] -> Maybe Int
forall a. Eq a => a -> [a] -> Maybe Int
elemIndex ((Char -> Char) -> ShowS
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ Int -> ShowS
forall a. Int -> [a] -> [a]
take Int
3 String
xs) [String]
months of
Maybe Int
Nothing -> String -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Improper month"
Just Int
n -> Maybe Int -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Maybe Int
forall a. a -> Maybe a
Just (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1))
let pseason :: ParsecT Text u Identity (Maybe Season)
pseason = ParsecT Text u Identity (Maybe Season)
-> ParsecT Text u Identity (Maybe Season)
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text u Identity (Maybe Season)
-> ParsecT Text u Identity (Maybe Season))
-> ParsecT Text u Identity (Maybe Season)
-> ParsecT Text u Identity (Maybe Season)
forall a b. (a -> b) -> a -> b
$ do
String
xs <- ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text u Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.letter
case String -> [String] -> Maybe Int
forall a. Eq a => a -> [a] -> Maybe Int
elemIndex ((Char -> Char) -> ShowS
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ Int -> ShowS
forall a. Int -> [a] -> [a]
take Int
3 String
xs) [String]
seasons of
Just Int
0 -> Maybe Season -> ParsecT Text u Identity (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Spring)
Just Int
1 -> Maybe Season -> ParsecT Text u Identity (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Summer)
Just Int
2 -> Maybe Season -> ParsecT Text u Identity (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Autumn)
Just Int
3 -> Maybe Season -> ParsecT Text u Identity (Maybe Season)
forall (m :: * -> *) a. Monad m => a -> m a
return (Season -> Maybe Season
forall a. a -> Maybe a
Just Season
Winter)
Maybe Int
_ -> String -> ParsecT Text u Identity (Maybe Season)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Improper season"
let pday :: ParsecT Text u Identity (Maybe Int)
pday = ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int)
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int))
-> ParsecT Text u Identity (Maybe Int)
-> ParsecT Text u Identity (Maybe Int)
forall a b. (a -> b) -> a -> b
$ do
String
xs <- ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text u Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit
case Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (String -> Text
T.pack String
xs) of
Just (Int
n::Int) | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
1 Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
31 -> Maybe Int -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n)
Maybe Int
_ -> String -> ParsecT Text u Identity (Maybe Int)
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"Improper day"
let pyear :: ParsecT Text u Identity (Maybe Int)
pyear = Text -> Maybe Int
forall (m :: * -> *) a. (MonadPlus m, Read a) => Text -> m a
safeRead (Text -> Maybe Int) -> (String -> Text) -> String -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
T.pack (String -> Maybe Int)
-> ParsecT Text u Identity String
-> ParsecT Text u Identity (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Text u Identity Char -> ParsecT Text u Identity String
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
P.many1 ParsecT Text u Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.digit
let sep :: ParsecT Text u Identity ()
sep = String -> ParsecT Text u Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m Char
P.oneOf [Char
' ',Char
'/',Char
','] ParsecT Text u Identity Char
-> ParsecT Text u Identity () -> ParsecT Text u Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT Text u Identity ()
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m ()
P.spaces
let rangesep :: ParsecT Text u Identity ()
rangesep = ParsecT Text u Identity () -> ParsecT Text u Identity ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try (ParsecT Text u Identity () -> ParsecT Text u Identity ())
-> ParsecT Text u Identity () -> ParsecT Text u Identity ()
forall a b. (a -> b) -> a -> b
$ ParsecT Text u Identity ()
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m ()
P.spaces ParsecT Text u Identity ()
-> ParsecT Text u Identity Char -> ParsecT Text u Identity Char
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Char -> ParsecT Text u Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
Char -> ParsecT s u m Char
P.char Char
'-' ParsecT Text u Identity Char
-> ParsecT Text u Identity () -> ParsecT Text u Identity ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ParsecT Text u Identity ()
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m ()
P.spaces
let refDate :: RefDate
refDate = Maybe Int
-> Maybe Int
-> Maybe Season
-> Maybe Int
-> Literal
-> Bool
-> RefDate
RefDate Maybe Int
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Maybe Season
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Literal
forall a. Monoid a => a
mempty Bool
False
let date :: ParsecT Text u Identity RefDate
date = [ParsecT Text u Identity RefDate]
-> ParsecT Text u Identity RefDate
forall s (m :: * -> *) t u a.
Stream s m t =>
[ParsecT s u m a] -> ParsecT s u m a
P.choice ([ParsecT Text u Identity RefDate]
-> ParsecT Text u Identity RefDate)
-> [ParsecT Text u Identity RefDate]
-> ParsecT Text u Identity RefDate
forall a b. (a -> b) -> a -> b
$ (ParsecT Text u Identity RefDate
-> ParsecT Text u Identity RefDate)
-> [ParsecT Text u Identity RefDate]
-> [ParsecT Text u Identity RefDate]
forall a b. (a -> b) -> [a] -> [b]
map ParsecT Text u Identity RefDate -> ParsecT Text u Identity RefDate
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
P.try
[ do Maybe Season
s <- ParsecT Text u Identity (Maybe Season)
forall u. ParsecT Text u Identity (Maybe Season)
pseason
ParsecT Text u Identity ()
forall u. ParsecT Text u Identity ()
sep
Maybe Int
y <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pyear
RefDate -> ParsecT Text u Identity RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate
refDate{ year :: Maybe Int
year = Maybe Int
y, season :: Maybe Season
season = Maybe Season
s }
, do Maybe Int
m <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pmonth
ParsecT Text u Identity ()
forall u. ParsecT Text u Identity ()
sep
Maybe Int
d <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pday
ParsecT Text u Identity ()
forall u. ParsecT Text u Identity ()
sep
Maybe Int
y <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pyear
RefDate -> ParsecT Text u Identity RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate
refDate{ year :: Maybe Int
year = Maybe Int
y, month :: Maybe Int
month = Maybe Int
m, day :: Maybe Int
day = Maybe Int
d }
, do Maybe Int
m <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pmonth
ParsecT Text u Identity ()
forall u. ParsecT Text u Identity ()
sep
Maybe Int
y <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pyear
RefDate -> ParsecT Text u Identity RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate
refDate{ year :: Maybe Int
year = Maybe Int
y, month :: Maybe Int
month = Maybe Int
m }
, do Maybe Int
y <- ParsecT Text u Identity (Maybe Int)
forall u. ParsecT Text u Identity (Maybe Int)
pyear
RefDate -> ParsecT Text u Identity RefDate
forall (m :: * -> *) a. Monad m => a -> m a
return RefDate
refDate{ year :: Maybe Int
year = Maybe Int
y }
]
RefDate
d1 <- Parser RefDate
forall u. ParsecT Text u Identity RefDate
date
[RefDate] -> Parsec Text () [RefDate] -> Parsec Text () [RefDate]
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
P.option [RefDate
d1] ((\RefDate
x -> [RefDate
d1,RefDate
x]) (RefDate -> [RefDate])
-> Parser RefDate -> Parsec Text () [RefDate]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ParsecT Text () Identity ()
forall u. ParsecT Text u Identity ()
rangesep ParsecT Text () Identity () -> Parser RefDate -> Parser RefDate
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Parser RefDate
forall u. ParsecT Text u Identity RefDate
date))