blob: d6ec51db9e34ebeeb1f9c5b4254208ebfce3325e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
module Data.JLD.Options (
Document (..),
ContextCache,
DocumentCache,
JLDVersion (..),
DocumentLoader (..),
hoistDocumentLoader,
) where
import Data.JLD.Prelude
import Data.Aeson (Object, Value)
import Text.Show (Show (..))
import Text.URI (URI)
data Document = Document
{ documentUri :: URI
, documentContent :: Object
}
deriving (Show, Eq)
type ContextCache = Map Text Value
type DocumentCache = Map Text Document
newtype DocumentLoader e m = DocumentLoader {runDocumentLoader :: URI -> m (Either e Value)}
instance Show (DocumentLoader e m) where
show _ = "DocumentLoader"
data JLDVersion = JLD1_0 | JLD1_1 deriving (Show, Eq)
hoistDocumentLoader :: (forall a. m a -> n a) -> DocumentLoader e m -> DocumentLoader e n
hoistDocumentLoader map' (DocumentLoader loader) = DocumentLoader <| loader .> map'
|