@@ -49,7 +49,6 @@ import Codec.CBOR.Cuddle.CDDL.CTree (
49
49
CTree (.. ),
50
50
CTreeExt ,
51
51
CTreeRoot (.. ),
52
- ProvidedParameters (.. ),
53
52
)
54
53
import Codec.CBOR.Cuddle.CDDL.CTree qualified as CTree
55
54
import Codec.CBOR.Cuddle.CDDL.Postlude (PTerm (.. ))
@@ -68,6 +67,18 @@ import Data.Text qualified as T
68
67
import GHC.Generics (Generic )
69
68
import Optics.Core
70
69
70
+ data ProvidedParameters a = ProvidedParameters
71
+ { parameters :: [Name ]
72
+ , underlying :: a
73
+ }
74
+ deriving (Generic , Functor , Show , Eq , Foldable , Traversable )
75
+
76
+ instance Hashable a => Hashable (ProvidedParameters a )
77
+
78
+ data Parametrised
79
+
80
+ type instance CTreeExt Parametrised = ProvidedParameters (CTree Parametrised )
81
+
71
82
--------------------------------------------------------------------------------
72
83
-- 1. Rule extensions
73
84
--------------------------------------------------------------------------------
@@ -79,7 +90,7 @@ type CDDLMap = Map.Map Name (ProvidedParameters TypeOrGroup)
79
90
80
91
toParametrised :: a -> Maybe GenericParam -> ProvidedParameters a
81
92
toParametrised a Nothing = ProvidedParameters [] a
82
- toParametrised a (Just (GenericParam gps)) = CTree. ProvidedParameters (NE. toList gps) a
93
+ toParametrised a (Just (GenericParam gps)) = ProvidedParameters (NE. toList gps) a
83
94
84
95
asMap :: CDDL -> CDDLMap
85
96
asMap cddl = foldl' go Map. empty rules
@@ -479,8 +490,8 @@ synthMono n@(Name origName _) args =
479
490
-- Lookup the original name in the global bindings
480
491
globalBinds <- ask @ " global"
481
492
case Map. lookup n globalBinds of
482
- Just (CTree. ProvidedParameters [] _) -> throwNR $ MismatchingArgs n []
483
- Just (CTree. ProvidedParameters params' r) ->
493
+ Just (ProvidedParameters [] _) -> throwNR $ MismatchingArgs n []
494
+ Just (ProvidedParameters params' r) ->
484
495
if length params' == length args
485
496
then do
486
497
rargs <- traverse resolveGenericCTree args
0 commit comments