aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/JLD/Expansion/Context.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/JLD/Expansion/Context.hs')
-rw-r--r--src/Data/JLD/Expansion/Context.hs36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Data/JLD/Expansion/Context.hs b/src/Data/JLD/Expansion/Context.hs
index 99daba0..21350c8 100644
--- a/src/Data/JLD/Expansion/Context.hs
+++ b/src/Data/JLD/Expansion/Context.hs
@@ -96,8 +96,8 @@ bacBuildActiveContext context uri = do
96 activeContext' <- 96 activeContext' <-
97 buildActiveContext activeContext context (Just uri) params 97 buildActiveContext activeContext context (Just uri) params
98 |> withEnvRES (const bacEnvGlobal) 98 |> withEnvRES (const bacEnvGlobal)
99 |> withErrorRES Left 99 .> withErrorRES Left
100 |> withStateRES bacStateGlobal (\bac global -> bac{bacStateGlobal = global}) 100 .> withStateRES bacStateGlobal (\bac global -> bac{bacStateGlobal = global})
101 bacModifyActiveContext <| const activeContext' 101 bacModifyActiveContext <| const activeContext'
102 102
103bacProcessItem :: Monad m => Maybe URI -> Value -> BACT e m () 103bacProcessItem :: Monad m => Maybe URI -> Value -> BACT e m ()
@@ -200,8 +200,8 @@ bacProcessItem baseUrl item = do
200 (maybeVocabMapping, activeContext', _) <- 200 (maybeVocabMapping, activeContext', _) <-
201 expandIri activeContext value params 201 expandIri activeContext value params
202 |> withEnvRES (const bacEnvGlobal) 202 |> withEnvRES (const bacEnvGlobal)
203 |> withErrorRES Left 203 .> withErrorRES Left
204 |> withStateRES bacStateGlobal (\bac global -> bac{bacStateGlobal = global}) 204 .> withStateRES bacStateGlobal (\bac global -> bac{bacStateGlobal = global})
205 bacModifyActiveContext <| const activeContext' 205 bacModifyActiveContext <| const activeContext'
206 206
207 case maybeVocabMapping of 207 case maybeVocabMapping of
@@ -218,7 +218,7 @@ bacProcessItem baseUrl item = do
218 -- 5.9.2. 218 -- 5.9.2.
219 Just Null -> bacModifyActiveContext \ac -> ac{activeContextDefaultLanguage = Just NoLanguage} 219 Just Null -> bacModifyActiveContext \ac -> ac{activeContextDefaultLanguage = Just NoLanguage}
220 -- 5.9.3. 220 -- 5.9.3.
221 Just (String language) -> bacModifyActiveContext \ac -> ac{activeContextDefaultLanguage = Just <| Language language} 221 Just (String language) -> bacModifyActiveContext \ac -> ac{activeContextDefaultLanguage = Just <. Language <| T.toLower language}
222 Just _ -> throwError <| Left InvalidDefaultLanguage 222 Just _ -> throwError <| Left InvalidDefaultLanguage
223 -- 223 --
224 Nothing -> pure () 224 Nothing -> pure ()
@@ -345,8 +345,8 @@ buildActiveContext activeContext localContext baseUrl paramsFn = do
345 BACState{..} <- 345 BACState{..} <-
346 (buildActiveContext' localContext baseUrl >> get) 346 (buildActiveContext' localContext baseUrl >> get)
347 |> withEnvRES env 347 |> withEnvRES env
348 |> withErrorRES' (either throwError (const get)) 348 .> withErrorRES' (either throwError (const get))
349 |> withStateRES st (const bacStateGlobal) 349 .> withStateRES st (const bacStateGlobal)
350 pure bacStateActiveContext 350 pure bacStateActiveContext
351 where 351 where
352 BACParams{..} = 352 BACParams{..} =
@@ -504,7 +504,7 @@ expandIri activeContext value paramsFn = do
504 (value', EIState{..}) <- 504 (value', EIState{..}) <-
505 (expandIri' value >>= \v -> gets (v,)) 505 (expandIri' value >>= \v -> gets (v,))
506 |> withEnvRES env 506 |> withEnvRES env
507 |> withStateRES st (const eiStateGlobal) 507 .> withStateRES st (const eiStateGlobal)
508 pure (value', eiStateActiveContext, eiStateDefined) 508 pure (value', eiStateActiveContext, eiStateDefined)
509 where 509 where
510 EIParams{..} = 510 EIParams{..} =
@@ -616,8 +616,8 @@ btdExpandIri value = do
616 (expanded, activeContext', defined') <- 616 (expanded, activeContext', defined') <-
617 expandIri activeContext value params 617 expandIri activeContext value params
618 |> withEnvRES (const btdEnvGlobal) 618 |> withEnvRES (const btdEnvGlobal)
619 |> withErrorRES Left 619 .> withErrorRES Left
620 |> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global}) 620 .> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global})
621 modify \s -> 621 modify \s ->
622 s 622 s
623 { btdStateActiveContext = activeContext' 623 { btdStateActiveContext = activeContext'
@@ -634,8 +634,8 @@ btdBuildTermDefinition term = do
634 (activeContext', defined') <- 634 (activeContext', defined') <-
635 buildTermDefinition activeContext btdEnvLocalContext term params 635 buildTermDefinition activeContext btdEnvLocalContext term params
636 |> withEnvRES (const btdEnvGlobal) 636 |> withEnvRES (const btdEnvGlobal)
637 |> withErrorRES Left 637 .> withErrorRES Left
638 |> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global}) 638 .> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global})
639 modify \env -> 639 modify \env ->
640 env 640 env
641 { btdStateActiveContext = activeContext' 641 { btdStateActiveContext = activeContext'
@@ -891,9 +891,9 @@ buildTermDefinition' term = do
891 } 891 }
892 buildActiveContext activeContext context btdEnvBaseUrl params 892 buildActiveContext activeContext context btdEnvBaseUrl params
893 |> withEnvRES (const btdEnvGlobal) 893 |> withEnvRES (const btdEnvGlobal)
894 |> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global}) 894 .> withStateRES btdStateGlobal (\btd global -> btd{btdStateGlobal = global})
895 |> withErrorRES (const <| Left InvalidScopedContext) 895 .> withErrorRES (const <| Left InvalidScopedContext)
896 |> void 896 .> void
897 897
898 -- 21.4. 898 -- 21.4.
899 btdModifyTermDefinition \d -> 899 btdModifyTermDefinition \d ->
@@ -909,7 +909,7 @@ buildTermDefinition' term = do
909 -- 22. 909 -- 22.
910 case KM.lookup (show KeywordLanguage) valueObject of 910 case KM.lookup (show KeywordLanguage) valueObject of
911 Just Null -> btdModifyTermDefinition \d -> d{termDefinitionLanguageMapping = Just NoLanguage} 911 Just Null -> btdModifyTermDefinition \d -> d{termDefinitionLanguageMapping = Just NoLanguage}
912 Just (String language) -> btdModifyTermDefinition \d -> d{termDefinitionLanguageMapping = Just <| Language language} 912 Just (String language) -> btdModifyTermDefinition \d -> d{termDefinitionLanguageMapping = Just <. Language <| T.toLower language}
913 Just _ -> throwError <| Left InvalidLanguageMapping 913 Just _ -> throwError <| Left InvalidLanguageMapping
914 Nothing -> pure () 914 Nothing -> pure ()
915 915
@@ -985,8 +985,8 @@ buildTermDefinition activeContext localContext term paramsFn = do
985 BTDState{..} <- 985 BTDState{..} <-
986 (buildTermDefinition' term >> get) 986 (buildTermDefinition' term >> get)
987 |> withEnvRES env 987 |> withEnvRES env
988 |> withErrorRES' (either throwError (const get)) 988 .> withErrorRES' (either throwError (const get))
989 |> withStateRES st (const btdStateGlobal) 989 .> withStateRES st (const btdStateGlobal)
990 pure (btdStateActiveContext, btdStateDefined) 990 pure (btdStateActiveContext, btdStateDefined)
991 where 991 where
992 BTDParams{..} = 992 BTDParams{..} =