diff options
| author | Volpeon <github@volpeon.ink> | 2023-05-26 07:40:13 +0200 |
|---|---|---|
| committer | Volpeon <github@volpeon.ink> | 2023-05-26 07:40:13 +0200 |
| commit | 11d0fb47c292a0ca25a9c377499d2b221d97a5cb (patch) | |
| tree | e729e2a4508763b3073b7eae9a56bc9c6a9ca0f7 /src/Data/JLD/Options.hs | |
| download | hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.tar.gz hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.tar.bz2 hs-jsonld-11d0fb47c292a0ca25a9c377499d2b221d97a5cb.zip | |
Init
Diffstat (limited to 'src/Data/JLD/Options.hs')
| -rw-r--r-- | src/Data/JLD/Options.hs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Data/JLD/Options.hs b/src/Data/JLD/Options.hs new file mode 100644 index 0000000..d6ec51d --- /dev/null +++ b/src/Data/JLD/Options.hs | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | module Data.JLD.Options ( | ||
| 2 | Document (..), | ||
| 3 | ContextCache, | ||
| 4 | DocumentCache, | ||
| 5 | JLDVersion (..), | ||
| 6 | DocumentLoader (..), | ||
| 7 | hoistDocumentLoader, | ||
| 8 | ) where | ||
| 9 | |||
| 10 | import Data.JLD.Prelude | ||
| 11 | |||
| 12 | import Data.Aeson (Object, Value) | ||
| 13 | import Text.Show (Show (..)) | ||
| 14 | import Text.URI (URI) | ||
| 15 | |||
| 16 | data Document = Document | ||
| 17 | { documentUri :: URI | ||
| 18 | , documentContent :: Object | ||
| 19 | } | ||
| 20 | deriving (Show, Eq) | ||
| 21 | |||
| 22 | type ContextCache = Map Text Value | ||
| 23 | |||
| 24 | type DocumentCache = Map Text Document | ||
| 25 | |||
| 26 | newtype DocumentLoader e m = DocumentLoader {runDocumentLoader :: URI -> m (Either e Value)} | ||
| 27 | |||
| 28 | instance Show (DocumentLoader e m) where | ||
| 29 | show _ = "DocumentLoader" | ||
| 30 | |||
| 31 | data JLDVersion = JLD1_0 | JLD1_1 deriving (Show, Eq) | ||
| 32 | |||
| 33 | hoistDocumentLoader :: (forall a. m a -> n a) -> DocumentLoader e m -> DocumentLoader e n | ||
| 34 | hoistDocumentLoader map' (DocumentLoader loader) = DocumentLoader <| loader .> map' | ||
