{-# LANGUAGE DefaultSignatures #-}
module Codec.CBOR.Cuddle.IndexMappable (IndexMappable (..), mapCDDLDropExt) where
import Codec.CBOR.Cuddle.CDDL (
CDDL (..),
GenericArg (..),
GenericParameter (..),
GenericParameters (..),
Group (..),
GroupEntry (..),
GroupEntryVariant (..),
GrpChoice (..),
MemberKey (..),
Rule (..),
TopLevel (..),
Type0 (..),
Type1 (..),
Type2 (..),
TypeOrGroup (..),
XCddl,
XRule,
XTerm,
XXTopLevel,
XXType2,
)
import Codec.CBOR.Cuddle.CDDL.CTree (
CTreePhase,
XCddl (..),
XRule (..),
XTerm (..),
XXType2 (..),
)
import Codec.CBOR.Cuddle.Huddle (
HuddleStage,
XCddl (..),
XRule (..),
XTerm (..),
XXTopLevel (..),
XXType2 (..),
)
import Codec.CBOR.Cuddle.Parser (
ParserStage,
XCddl (..),
XRule (..),
XTerm (..),
XXTopLevel (..),
XXType2 (..),
)
import Codec.CBOR.Cuddle.Pretty (PrettyStage, XCddl (..), XRule (..), XTerm (..), XXTopLevel (..))
import Data.Bifunctor (Bifunctor (..))
import Data.Coerce (Coercible, coerce)
import Data.Void (absurd)
class IndexMappable f i j where
mapIndex :: f i -> f j
default mapIndex :: Coercible (f i) (f j) => f i -> f j
mapIndex = f i -> f j
forall a b. Coercible a b => a -> b
coerce
mapCDDLDropExt ::
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
, IndexMappable XRule i j
) =>
CDDL i ->
CDDL j
mapCDDLDropExt :: forall i j.
(IndexMappable XXType2 i j, IndexMappable XTerm i j,
IndexMappable XRule i j) =>
CDDL i -> CDDL j
mapCDDLDropExt (CDDL Rule i
r [TopLevel i]
tls [XXTopLevel i]
_) = Rule j -> [TopLevel j] -> [XXTopLevel j] -> CDDL j
forall i. Rule i -> [TopLevel i] -> [XXTopLevel i] -> CDDL i
CDDL (Rule i -> Rule j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Rule i
r) ((TopLevel i -> [TopLevel j]) -> [TopLevel i] -> [TopLevel j]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap TopLevel i -> [TopLevel j]
forall {i} {i}.
(IndexMappable XXType2 i i, IndexMappable XTerm i i,
IndexMappable XRule i i) =>
TopLevel i -> [TopLevel i]
mapTopLevelDropExt [TopLevel i]
tls) []
where
mapTopLevelDropExt :: TopLevel i -> [TopLevel i]
mapTopLevelDropExt (TopLevelRule Rule i
x) = [Rule i -> TopLevel i
forall i. Rule i -> TopLevel i
TopLevelRule (Rule i -> TopLevel i) -> Rule i -> TopLevel i
forall a b. (a -> b) -> a -> b
$ Rule i -> Rule i
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Rule i
x]
mapTopLevelDropExt (XXTopLevel XXTopLevel i
_) = []
instance
( IndexMappable XCddl i j
, IndexMappable XXTopLevel i j
, IndexMappable XXType2 i j
, IndexMappable XTerm i j
, IndexMappable XRule i j
) =>
IndexMappable CDDL i j
where
mapIndex :: CDDL i -> CDDL j
mapIndex (CDDL Rule i
r [TopLevel i]
tls [XXTopLevel i]
e) = Rule j -> [TopLevel j] -> [XXTopLevel j] -> CDDL j
forall i. Rule i -> [TopLevel i] -> [XXTopLevel i] -> CDDL i
CDDL (Rule i -> Rule j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Rule i
r) (TopLevel i -> TopLevel j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (TopLevel i -> TopLevel j) -> [TopLevel i] -> [TopLevel j]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [TopLevel i]
tls) (XXTopLevel i -> XXTopLevel j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (XXTopLevel i -> XXTopLevel j) -> [XXTopLevel i] -> [XXTopLevel j]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [XXTopLevel i]
e)
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
, IndexMappable XRule i j
) =>
IndexMappable Rule i j
where
mapIndex :: Rule i -> Rule j
mapIndex (Rule Name
n Maybe (GenericParameters i)
mg Assign
a TypeOrGroup i
t XRule i
c) = Name
-> Maybe (GenericParameters j)
-> Assign
-> TypeOrGroup j
-> XRule j
-> Rule j
forall i.
Name
-> Maybe (GenericParameters i)
-> Assign
-> TypeOrGroup i
-> XRule i
-> Rule i
Rule Name
n (GenericParameters i -> GenericParameters j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericParameters i -> GenericParameters j)
-> Maybe (GenericParameters i) -> Maybe (GenericParameters j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (GenericParameters i)
mg) Assign
a (TypeOrGroup i -> TypeOrGroup j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex TypeOrGroup i
t) (XRule i -> XRule j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XRule i
c)
instance
( IndexMappable XXTopLevel i j
, IndexMappable XXType2 i j
, IndexMappable XTerm i j
, IndexMappable XRule i j
) =>
IndexMappable TopLevel i j
where
mapIndex :: TopLevel i -> TopLevel j
mapIndex (TopLevelRule Rule i
r) = Rule j -> TopLevel j
forall i. Rule i -> TopLevel i
TopLevelRule (Rule j -> TopLevel j) -> Rule j -> TopLevel j
forall a b. (a -> b) -> a -> b
$ Rule i -> Rule j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Rule i
r
mapIndex (XXTopLevel XXTopLevel i
e) = XXTopLevel j -> TopLevel j
forall i. XXTopLevel i -> TopLevel i
XXTopLevel (XXTopLevel j -> TopLevel j) -> XXTopLevel j -> TopLevel j
forall a b. (a -> b) -> a -> b
$ XXTopLevel i -> XXTopLevel j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XXTopLevel i
e
instance IndexMappable XTerm i j => IndexMappable GenericParameter i j where
mapIndex :: GenericParameter i -> GenericParameter j
mapIndex (GenericParameter Name
n XTerm i
e) = Name -> XTerm j -> GenericParameter j
forall i. Name -> XTerm i -> GenericParameter i
GenericParameter Name
n (XTerm j -> GenericParameter j) -> XTerm j -> GenericParameter j
forall a b. (a -> b) -> a -> b
$ XTerm i -> XTerm j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XTerm i
e
instance IndexMappable XTerm i j => IndexMappable GenericParameters i j where
mapIndex :: GenericParameters i -> GenericParameters j
mapIndex (GenericParameters NonEmpty (GenericParameter i)
ns) = NonEmpty (GenericParameter j) -> GenericParameters j
forall i. NonEmpty (GenericParameter i) -> GenericParameters i
GenericParameters (NonEmpty (GenericParameter j) -> GenericParameters j)
-> NonEmpty (GenericParameter j) -> GenericParameters j
forall a b. (a -> b) -> a -> b
$ GenericParameter i -> GenericParameter j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericParameter i -> GenericParameter j)
-> NonEmpty (GenericParameter i) -> NonEmpty (GenericParameter j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (GenericParameter i)
ns
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable TypeOrGroup i j
where
mapIndex :: TypeOrGroup i -> TypeOrGroup j
mapIndex (TOGType Type0 i
t) = Type0 j -> TypeOrGroup j
forall i. Type0 i -> TypeOrGroup i
TOGType (Type0 j -> TypeOrGroup j) -> Type0 j -> TypeOrGroup j
forall a b. (a -> b) -> a -> b
$ Type0 i -> Type0 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type0 i
t
mapIndex (TOGGroup GroupEntry i
g) = GroupEntry j -> TypeOrGroup j
forall i. GroupEntry i -> TypeOrGroup i
TOGGroup (GroupEntry j -> TypeOrGroup j) -> GroupEntry j -> TypeOrGroup j
forall a b. (a -> b) -> a -> b
$ GroupEntry i -> GroupEntry j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex GroupEntry i
g
instance
( IndexMappable XTerm i j
, IndexMappable XXType2 i j
) =>
IndexMappable GroupEntry i j
where
mapIndex :: GroupEntry i -> GroupEntry j
mapIndex (GroupEntry Maybe OccurrenceIndicator
mo GroupEntryVariant i
gev XTerm i
e) = Maybe OccurrenceIndicator
-> GroupEntryVariant j -> XTerm j -> GroupEntry j
forall i.
Maybe OccurrenceIndicator
-> GroupEntryVariant i -> XTerm i -> GroupEntry i
GroupEntry Maybe OccurrenceIndicator
mo (GroupEntryVariant i -> GroupEntryVariant j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex GroupEntryVariant i
gev) (XTerm i -> XTerm j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XTerm i
e)
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable GroupEntryVariant i j
where
mapIndex :: GroupEntryVariant i -> GroupEntryVariant j
mapIndex (GEType Maybe (MemberKey i)
mk Type0 i
t) = Maybe (MemberKey j) -> Type0 j -> GroupEntryVariant j
forall i. Maybe (MemberKey i) -> Type0 i -> GroupEntryVariant i
GEType (MemberKey i -> MemberKey j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (MemberKey i -> MemberKey j)
-> Maybe (MemberKey i) -> Maybe (MemberKey j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (MemberKey i)
mk) (Type0 j -> GroupEntryVariant j) -> Type0 j -> GroupEntryVariant j
forall a b. (a -> b) -> a -> b
$ Type0 i -> Type0 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type0 i
t
mapIndex (GERef Name
n Maybe (GenericArg i)
ma) = Name -> Maybe (GenericArg j) -> GroupEntryVariant j
forall i. Name -> Maybe (GenericArg i) -> GroupEntryVariant i
GERef Name
n (GenericArg i -> GenericArg j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericArg i -> GenericArg j)
-> Maybe (GenericArg i) -> Maybe (GenericArg j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (GenericArg i)
ma)
mapIndex (GEGroup Group i
g) = Group j -> GroupEntryVariant j
forall i. Group i -> GroupEntryVariant i
GEGroup (Group i -> Group j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Group i
g)
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable MemberKey i j
where
mapIndex :: MemberKey i -> MemberKey j
mapIndex (MKType Type1 i
t) = Type1 j -> MemberKey j
forall i. Type1 i -> MemberKey i
MKType (Type1 j -> MemberKey j) -> Type1 j -> MemberKey j
forall a b. (a -> b) -> a -> b
$ Type1 i -> Type1 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type1 i
t
mapIndex (MKBareword Name
n) = Name -> MemberKey j
forall i. Name -> MemberKey i
MKBareword Name
n
mapIndex (MKValue Value
x) = Value -> MemberKey j
forall i. Value -> MemberKey i
MKValue Value
x
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable Type0 i j
where
mapIndex :: Type0 i -> Type0 j
mapIndex (Type0 NonEmpty (Type1 i)
ts) = NonEmpty (Type1 j) -> Type0 j
forall i. NonEmpty (Type1 i) -> Type0 i
Type0 (NonEmpty (Type1 j) -> Type0 j) -> NonEmpty (Type1 j) -> Type0 j
forall a b. (a -> b) -> a -> b
$ Type1 i -> Type1 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (Type1 i -> Type1 j) -> NonEmpty (Type1 i) -> NonEmpty (Type1 j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Type1 i)
ts
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable Type1 i j
where
mapIndex :: Type1 i -> Type1 j
mapIndex (Type1 Type2 i
t Maybe (TyOp, Type2 i)
mo XTerm i
e) = Type2 j -> Maybe (TyOp, Type2 j) -> XTerm j -> Type1 j
forall i. Type2 i -> Maybe (TyOp, Type2 i) -> XTerm i -> Type1 i
Type1 (Type2 i -> Type2 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type2 i
t) ((Type2 i -> Type2 j) -> (TyOp, Type2 i) -> (TyOp, Type2 j)
forall b c a. (b -> c) -> (a, b) -> (a, c)
forall (p :: * -> * -> *) b c a.
Bifunctor p =>
(b -> c) -> p a b -> p a c
second Type2 i -> Type2 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex ((TyOp, Type2 i) -> (TyOp, Type2 j))
-> Maybe (TyOp, Type2 i) -> Maybe (TyOp, Type2 j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (TyOp, Type2 i)
mo) (XTerm i -> XTerm j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XTerm i
e)
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable Type2 i j
where
mapIndex :: Type2 i -> Type2 j
mapIndex (T2Value Value
v) = Value -> Type2 j
forall i. Value -> Type2 i
T2Value Value
v
mapIndex (T2Name Name
n Maybe (GenericArg i)
mg) = Name -> Maybe (GenericArg j) -> Type2 j
forall i. Name -> Maybe (GenericArg i) -> Type2 i
T2Name Name
n (GenericArg i -> GenericArg j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericArg i -> GenericArg j)
-> Maybe (GenericArg i) -> Maybe (GenericArg j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (GenericArg i)
mg)
mapIndex (T2Group Type0 i
t) = Type0 j -> Type2 j
forall i. Type0 i -> Type2 i
T2Group (Type0 j -> Type2 j) -> Type0 j -> Type2 j
forall a b. (a -> b) -> a -> b
$ Type0 i -> Type0 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type0 i
t
mapIndex (T2Map Group i
g) = Group j -> Type2 j
forall i. Group i -> Type2 i
T2Map (Group j -> Type2 j) -> Group j -> Type2 j
forall a b. (a -> b) -> a -> b
$ Group i -> Group j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Group i
g
mapIndex (T2Array Group i
a) = Group j -> Type2 j
forall i. Group i -> Type2 i
T2Array (Group j -> Type2 j) -> Group j -> Type2 j
forall a b. (a -> b) -> a -> b
$ Group i -> Group j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Group i
a
mapIndex (T2Unwrapped Name
n Maybe (GenericArg i)
mg) = Name -> Maybe (GenericArg j) -> Type2 j
forall i. Name -> Maybe (GenericArg i) -> Type2 i
T2Unwrapped Name
n (GenericArg i -> GenericArg j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericArg i -> GenericArg j)
-> Maybe (GenericArg i) -> Maybe (GenericArg j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (GenericArg i)
mg)
mapIndex (T2Enum Group i
g) = Group j -> Type2 j
forall i. Group i -> Type2 i
T2Enum (Group j -> Type2 j) -> Group j -> Type2 j
forall a b. (a -> b) -> a -> b
$ Group i -> Group j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Group i
g
mapIndex (T2EnumRef Name
n Maybe (GenericArg i)
mg) = Name -> Maybe (GenericArg j) -> Type2 j
forall i. Name -> Maybe (GenericArg i) -> Type2 i
T2EnumRef Name
n (GenericArg i -> GenericArg j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GenericArg i -> GenericArg j)
-> Maybe (GenericArg i) -> Maybe (GenericArg j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (GenericArg i)
mg)
mapIndex (T2Tag Maybe Word64
mt Type0 i
t) = Maybe Word64 -> Type0 j -> Type2 j
forall i. Maybe Word64 -> Type0 i -> Type2 i
T2Tag Maybe Word64
mt (Type0 j -> Type2 j) -> Type0 j -> Type2 j
forall a b. (a -> b) -> a -> b
$ Type0 i -> Type0 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex Type0 i
t
mapIndex (T2DataItem Word8
t Maybe Word64
mt) = Word8 -> Maybe Word64 -> Type2 j
forall i. Word8 -> Maybe Word64 -> Type2 i
T2DataItem Word8
t Maybe Word64
mt
mapIndex Type2 i
T2Any = Type2 j
forall i. Type2 i
T2Any
mapIndex (XXType2 XXType2 i
e) = XXType2 j -> Type2 j
forall i. XXType2 i -> Type2 i
XXType2 (XXType2 j -> Type2 j) -> XXType2 j -> Type2 j
forall a b. (a -> b) -> a -> b
$ XXType2 i -> XXType2 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XXType2 i
e
instance
( IndexMappable XXType2 i j
, IndexMappable XTerm i j
) =>
IndexMappable GenericArg i j
where
mapIndex :: GenericArg i -> GenericArg j
mapIndex (GenericArg NonEmpty (Type1 i)
g) = NonEmpty (Type1 j) -> GenericArg j
forall i. NonEmpty (Type1 i) -> GenericArg i
GenericArg (NonEmpty (Type1 j) -> GenericArg j)
-> NonEmpty (Type1 j) -> GenericArg j
forall a b. (a -> b) -> a -> b
$ Type1 i -> Type1 j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (Type1 i -> Type1 j) -> NonEmpty (Type1 i) -> NonEmpty (Type1 j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Type1 i)
g
instance
( IndexMappable XTerm i j
, IndexMappable XXType2 i j
) =>
IndexMappable Group i j
where
mapIndex :: Group i -> Group j
mapIndex (Group NonEmpty (GrpChoice i)
g) = NonEmpty (GrpChoice j) -> Group j
forall i. NonEmpty (GrpChoice i) -> Group i
Group (NonEmpty (GrpChoice j) -> Group j)
-> NonEmpty (GrpChoice j) -> Group j
forall a b. (a -> b) -> a -> b
$ GrpChoice i -> GrpChoice j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GrpChoice i -> GrpChoice j)
-> NonEmpty (GrpChoice i) -> NonEmpty (GrpChoice j)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (GrpChoice i)
g
instance
( IndexMappable XTerm i j
, IndexMappable XXType2 i j
) =>
IndexMappable GrpChoice i j
where
mapIndex :: GrpChoice i -> GrpChoice j
mapIndex (GrpChoice [GroupEntry i]
gs XTerm i
e) = [GroupEntry j] -> XTerm j -> GrpChoice j
forall i. [GroupEntry i] -> XTerm i -> GrpChoice i
GrpChoice (GroupEntry i -> GroupEntry j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex (GroupEntry i -> GroupEntry j) -> [GroupEntry i] -> [GroupEntry j]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [GroupEntry i]
gs) (XTerm j -> GrpChoice j) -> XTerm j -> GrpChoice j
forall a b. (a -> b) -> a -> b
$ XTerm i -> XTerm j
forall {k} (f :: k -> *) (i :: k) (j :: k).
IndexMappable f i j =>
f i -> f j
mapIndex XTerm i
e
instance IndexMappable XCddl ParserStage PrettyStage where
mapIndex :: XCddl ParserStage -> XCddl PrettyStage
mapIndex (ParserXCddl [Comment]
c) = [Comment] -> XCddl PrettyStage
PrettyXCddl [Comment]
c
instance IndexMappable XTerm ParserStage PrettyStage where
mapIndex :: XTerm ParserStage -> XTerm PrettyStage
mapIndex (ParserXTerm Comment
c) = Comment -> XTerm PrettyStage
PrettyXTerm Comment
c
instance IndexMappable XRule ParserStage PrettyStage where
mapIndex :: XRule ParserStage -> XRule PrettyStage
mapIndex (ParserXRule Comment
c) = Comment -> XRule PrettyStage
PrettyXRule Comment
c
instance IndexMappable XXType2 ParserStage PrettyStage where
mapIndex :: XXType2 ParserStage -> XXType2 PrettyStage
mapIndex (ParserXXType2 Void
v) = Void -> XXType2 PrettyStage
forall a. Void -> a
absurd Void
v
instance IndexMappable XXTopLevel ParserStage PrettyStage where
mapIndex :: XXTopLevel ParserStage -> XXTopLevel PrettyStage
mapIndex (ParserXXTopLevel Comment
c) = Comment -> XXTopLevel PrettyStage
PrettyXXTopLevel Comment
c
instance IndexMappable XCddl ParserStage CTreePhase where
mapIndex :: XCddl ParserStage -> XCddl CTreePhase
mapIndex XCddl ParserStage
_ = XCddl CTreePhase
CTreeXCddl
instance IndexMappable XXType2 ParserStage CTreePhase where
mapIndex :: XXType2 ParserStage -> XXType2 CTreePhase
mapIndex (ParserXXType2 Void
c) = Void -> XXType2 CTreePhase
CTreeXXType2 Void
c
instance IndexMappable XTerm ParserStage CTreePhase where
mapIndex :: XTerm ParserStage -> XTerm CTreePhase
mapIndex XTerm ParserStage
_ = XTerm CTreePhase
CTreeXTerm
instance IndexMappable XRule ParserStage CTreePhase where
mapIndex :: XRule ParserStage -> XRule CTreePhase
mapIndex XRule ParserStage
_ = Maybe CBORGenerator -> XRule CTreePhase
CTreeXRule Maybe CBORGenerator
forall a. Maybe a
Nothing
instance IndexMappable XCddl ParserStage HuddleStage where
mapIndex :: XCddl ParserStage -> XCddl HuddleStage
mapIndex (ParserXCddl [Comment]
c) = [Comment] -> XCddl HuddleStage
HuddleXCddl [Comment]
c
instance IndexMappable XXTopLevel ParserStage HuddleStage where
mapIndex :: XXTopLevel ParserStage -> XXTopLevel HuddleStage
mapIndex (ParserXXTopLevel Comment
c) = Comment -> XXTopLevel HuddleStage
HuddleXXTopLevel Comment
c
instance IndexMappable XXType2 ParserStage HuddleStage where
mapIndex :: XXType2 ParserStage -> XXType2 HuddleStage
mapIndex (ParserXXType2 Void
c) = Void -> XXType2 HuddleStage
HuddleXXType2 Void
c
instance IndexMappable XTerm ParserStage HuddleStage where
mapIndex :: XTerm ParserStage -> XTerm HuddleStage
mapIndex (ParserXTerm Comment
c) = Comment -> XTerm HuddleStage
HuddleXTerm Comment
c
instance IndexMappable XCddl HuddleStage CTreePhase where
mapIndex :: XCddl HuddleStage -> XCddl CTreePhase
mapIndex XCddl HuddleStage
_ = XCddl CTreePhase
CTreeXCddl
instance IndexMappable XXType2 HuddleStage CTreePhase where
mapIndex :: XXType2 HuddleStage -> XXType2 CTreePhase
mapIndex (HuddleXXType2 Void
c) = Void -> XXType2 CTreePhase
CTreeXXType2 Void
c
instance IndexMappable XTerm HuddleStage CTreePhase where
mapIndex :: XTerm HuddleStage -> XTerm CTreePhase
mapIndex XTerm HuddleStage
_ = XTerm CTreePhase
CTreeXTerm
instance IndexMappable XRule HuddleStage CTreePhase where
mapIndex :: XRule HuddleStage -> XRule CTreePhase
mapIndex (HuddleXRule Comment
_ Maybe CBORGenerator
g) = Maybe CBORGenerator -> XRule CTreePhase
CTreeXRule Maybe CBORGenerator
g
instance IndexMappable XCddl HuddleStage PrettyStage where
mapIndex :: XCddl HuddleStage -> XCddl PrettyStage
mapIndex (HuddleXCddl [Comment]
c) = [Comment] -> XCddl PrettyStage
PrettyXCddl [Comment]
c
instance IndexMappable XXTopLevel HuddleStage PrettyStage where
mapIndex :: XXTopLevel HuddleStage -> XXTopLevel PrettyStage
mapIndex (HuddleXXTopLevel Comment
c) = Comment -> XXTopLevel PrettyStage
PrettyXXTopLevel Comment
c
instance IndexMappable XXType2 HuddleStage PrettyStage where
mapIndex :: XXType2 HuddleStage -> XXType2 PrettyStage
mapIndex (HuddleXXType2 Void
c) = Void -> XXType2 PrettyStage
forall a. Void -> a
absurd Void
c
instance IndexMappable XTerm HuddleStage PrettyStage where
mapIndex :: XTerm HuddleStage -> XTerm PrettyStage
mapIndex (HuddleXTerm Comment
c) = Comment -> XTerm PrettyStage
PrettyXTerm Comment
c
instance IndexMappable XRule HuddleStage PrettyStage where
mapIndex :: XRule HuddleStage -> XRule PrettyStage
mapIndex (HuddleXRule Comment
c Maybe CBORGenerator
_) = Comment -> XRule PrettyStage
PrettyXRule Comment
c
instance IndexMappable XCddl ParserStage ParserStage
instance IndexMappable XXTopLevel ParserStage ParserStage
instance IndexMappable XXType2 ParserStage ParserStage
instance IndexMappable XTerm ParserStage ParserStage
instance IndexMappable XRule ParserStage ParserStage