@@ -139,23 +139,23 @@ deriving instance Show (CTreeRoot OrRef)
139
139
-- | Build a CTree incorporating references.
140
140
--
141
141
-- This translation cannot fail.
142
- buildRefCTree :: CDDLMap i -> RefCTree
142
+ buildRefCTree :: CDDLMap () -> RefCTree
143
143
buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
144
144
where
145
145
toCTreeRule ::
146
- Parametrised (TypeOrGroup i ) ->
146
+ Parametrised (TypeOrGroup () ) ->
147
147
ParametrisedWith [Name ] (CTree. Node OrRef )
148
148
toCTreeRule = fmap toCTreeTOG
149
149
150
- toCTreeTOG :: TypeOrGroup i -> CTree. Node OrRef
150
+ toCTreeTOG :: TypeOrGroup () -> CTree. Node OrRef
151
151
toCTreeTOG (TOGType t0) = toCTreeT0 t0
152
152
toCTreeTOG (TOGGroup ge) = toCTreeGroupEntry ge
153
153
154
- toCTreeT0 :: Type0 i -> CTree. Node OrRef
154
+ toCTreeT0 :: Type0 () -> CTree. Node OrRef
155
155
toCTreeT0 (Type0 (t1 NE. :| [] )) = toCTreeT1 t1
156
156
toCTreeT0 (Type0 xs) = It . CTree. Choice $ toCTreeT1 <$> xs
157
157
158
- toCTreeT1 :: Type1 i -> CTree. Node OrRef
158
+ toCTreeT1 :: Type1 () -> CTree. Node OrRef
159
159
toCTreeT1 (Type1 t2 Nothing _) = toCTreeT2 t2
160
160
toCTreeT1 (Type1 t2 (Just (op, t2')) _) = case op of
161
161
RangeOp bound ->
@@ -173,7 +173,7 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
173
173
, CTree. controller = toCTreeT2 t2'
174
174
}
175
175
176
- toCTreeT2 :: Type2 i -> CTree. Node OrRef
176
+ toCTreeT2 :: Type2 () -> CTree. Node OrRef
177
177
toCTreeT2 (T2Value v) = It $ CTree. Literal v
178
178
toCTreeT2 (T2Name n garg) =
179
179
Ref n (fromGenArgs garg)
@@ -215,7 +215,7 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
215
215
toCTreeDataItem _ =
216
216
It $ CTree. Postlude PTAny
217
217
218
- toCTreeGroupEntry :: GroupEntry i -> CTree. Node OrRef
218
+ toCTreeGroupEntry :: GroupEntry () -> CTree. Node OrRef
219
219
toCTreeGroupEntry (GroupEntry (Just occi) (GEType mmkey t0) _) =
220
220
It $
221
221
CTree. Occur
@@ -238,12 +238,12 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
238
238
}
239
239
toCTreeGroupEntry (GroupEntry Nothing (GEGroup g) _) = groupToGroup g
240
240
241
- fromGenArgs :: Maybe (GenericArg i ) -> [CTree. Node OrRef ]
241
+ fromGenArgs :: Maybe (GenericArg () ) -> [CTree. Node OrRef ]
242
242
fromGenArgs = maybe [] (\ (GenericArg xs) -> NE. toList $ fmap toCTreeT1 xs)
243
243
244
244
-- Interpret a group as an enumeration. Note that we float out the
245
245
-- choice options
246
- toCTreeEnum :: Group i -> CTree. Node OrRef
246
+ toCTreeEnum :: Group () -> CTree. Node OrRef
247
247
toCTreeEnum (Group (a NE. :| [] )) =
248
248
It . CTree. Enum . It . CTree. Group $ toCTreeGroupEntry <$> gcGroupEntries a
249
249
toCTreeEnum (Group xs) =
@@ -253,14 +253,14 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
253
253
groupEntries = fmap gcGroupEntries xs
254
254
255
255
-- Embed a group in another group, again floating out the choice options
256
- groupToGroup :: Group i -> CTree. Node OrRef
256
+ groupToGroup :: Group () -> CTree. Node OrRef
257
257
groupToGroup (Group (a NE. :| [] )) =
258
258
It . CTree. Group $ fmap toCTreeGroupEntry (gcGroupEntries a)
259
259
groupToGroup (Group xs) =
260
260
It . CTree. Choice $
261
261
fmap (It . CTree. Group . fmap toCTreeGroupEntry) (gcGroupEntries <$> xs)
262
262
263
- toKVPair :: Maybe (MemberKey i ) -> Type0 i -> CTree. Node OrRef
263
+ toKVPair :: Maybe (MemberKey () ) -> Type0 () -> CTree. Node OrRef
264
264
toKVPair Nothing t0 = toCTreeT0 t0
265
265
toKVPair (Just mkey) t0 =
266
266
It $
@@ -272,7 +272,7 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
272
272
}
273
273
274
274
-- Interpret a group as a map. Note that we float out the choice options
275
- toCTreeMap :: Group i -> CTree. Node OrRef
275
+ toCTreeMap :: Group () -> CTree. Node OrRef
276
276
toCTreeMap (Group (a NE. :| [] )) = It . CTree. Map $ fmap toCTreeGroupEntry (gcGroupEntries a)
277
277
toCTreeMap (Group xs) =
278
278
It
@@ -281,14 +281,14 @@ buildRefCTree rules = CTreeRoot $ fmap toCTreeRule rules
281
281
282
282
-- Interpret a group as an array. Note that we float out the choice
283
283
-- options
284
- toCTreeArray :: Group i -> CTree. Node OrRef
284
+ toCTreeArray :: Group () -> CTree. Node OrRef
285
285
toCTreeArray (Group (a NE. :| [] )) =
286
286
It . CTree. Array $ fmap toCTreeGroupEntry (gcGroupEntries a)
287
287
toCTreeArray (Group xs) =
288
288
It . CTree. Choice $
289
289
fmap (It . CTree. Array . fmap toCTreeGroupEntry) (gcGroupEntries <$> xs)
290
290
291
- toCTreeMemberKey :: MemberKey i -> CTree. Node OrRef
291
+ toCTreeMemberKey :: MemberKey () -> CTree. Node OrRef
292
292
toCTreeMemberKey (MKValue v) = It $ CTree. Literal v
293
293
toCTreeMemberKey (MKBareword (Name n _)) = It $ CTree. Literal (Value (VText n) mempty )
294
294
toCTreeMemberKey (MKType t1) = toCTreeT1 t1
@@ -556,7 +556,7 @@ buildMonoCTree (CTreeRoot ct) = do
556
556
-- Combined resolution
557
557
--------------------------------------------------------------------------------
558
558
559
- fullResolveCDDL :: CDDL i -> Either NameResolutionFailure (CTreeRoot' Identity MonoRef )
559
+ fullResolveCDDL :: CDDL () -> Either NameResolutionFailure (CTreeRoot' Identity MonoRef )
560
560
fullResolveCDDL cddl = do
561
561
let refCTree = buildRefCTree (asMap cddl)
562
562
rCTree <- buildResolvedCTree refCTree
0 commit comments