@@ -24,6 +24,7 @@ import GHC.Generics (Generic, Rep)
24
24
25
25
import qualified Data.Char as Char
26
26
import qualified Data.List as List
27
+ import qualified Data.Map as Map
27
28
import qualified Data.Map.Strict as Data.Map
28
29
import qualified Data.Maybe as Maybe
29
30
import qualified Data.Set as Set
@@ -32,8 +33,7 @@ import qualified Data.Text as Text
32
33
import qualified Data.Tuple as Tuple
33
34
import qualified Dhall.Core as Dhall
34
35
import qualified Dhall.Map
35
- import qualified Dhall.Optics
36
- import qualified Data.Map as Map
36
+ import qualified Lens.Micro as Lens
37
37
38
38
modelsToText :: ModelHierarchy -> [Text ]
39
39
modelsToText = List. map (\ (ModelName unModelName) -> unModelName)
@@ -141,7 +141,7 @@ mergeNoConflicts :: (Ord k, Eq a, Show a, Show k) => (a -> a -> Bool) -> Data.Ma
141
141
mergeNoConflicts canMerge = Data.Map. unionWithKey
142
142
(\ key left right ->
143
143
if canMerge left right
144
- then left
144
+ then left
145
145
else error (" Cannot merge differing values " ++ show left ++ " and " ++ show right ++ " for key " ++ show key))
146
146
147
147
{- | Extract the 'ModelName' to be used when splitting a definition.
@@ -164,7 +164,7 @@ guessModelNameForSplit models definition = ModelName <$> ((<>) <$> toPrepend <*>
164
164
'modelsToPath'. If a 'ModelName' is provided as a value for the given path, it will be returned (to be then used as
165
165
the 'ModelName' for the nested definition. If no 'ModelName' is provided, 'guessModelNameForSplit' will try to guess.
166
166
If that fails, 'Nothing' will be returned such that no split will be done by 'toTypes'
167
-
167
+
168
168
Currently not all split points in for nested definitions are supported (in fact only types with a properties
169
169
attribute are currently supported).
170
170
-}
@@ -215,7 +215,7 @@ toTypes' prefixMap typeSplitter preferNaturalInt natIntExceptions definitions to
215
215
(expr, leftOverDefs) = (convertToType (modelHierarchy ++ [k]) v (isException /= preferNaturalInt))
216
216
217
217
(newDefs, modelMap) = Data.Map. mapAccumWithKey (convertAndAccumWithKey [] ) Data.Map. empty definitions
218
-
218
+
219
219
kvList = Dhall. App Dhall. List $ Dhall. Record $ Dhall.Map. fromList
220
220
[ (" mapKey" , Dhall. makeRecordField Dhall. Text ), (" mapValue" , Dhall. makeRecordField Dhall. Text ) ]
221
221
@@ -233,7 +233,7 @@ toTypes' prefixMap typeSplitter preferNaturalInt natIntExceptions definitions to
233
233
shouldBeRequired hierarchy field = Set. member field requiredNames
234
234
where
235
235
requiredNames = requiredFields hierarchy (required definition)
236
-
236
+
237
237
(newPropDefs, propModelMap) = Data.Map. mapAccumWithKey (convertAndAccumWithKey modelHierarchy) Data.Map. empty props
238
238
239
239
(required', optional') = Data.Map. partitionWithKey
@@ -325,7 +325,7 @@ toDefault prefixMap definitions modelName = go
325
325
let expression = Dhall. App Dhall. None _T
326
326
327
327
let adjustedExpression =
328
- Dhall.Optics . transformOf
328
+ Lens . transformOf
329
329
Dhall. subExpressions
330
330
adjustImport
331
331
expression
0 commit comments