    {-# OPTIONS_GHC -Wunused-imports #-}

    {-# OPTIONS_GHC -fno-warn-orphans #-}

    module Agda.TypeChecking.Serialise.Instances.Abstract where

    import Control.Monad
    import Data.Void (Void)
    import qualified Data.Map as Map
    import qualified Data.Set as Set

    import Agda.Syntax.Common
    import qualified Agda.Syntax.Abstract as A
    import Agda.Syntax.Abstract.Pattern ( noDotOrEqPattern )
    import Agda.Syntax.Info
    import Agda.Syntax.Scope.Base
    import Agda.Syntax.Fixity

    import Agda.TypeChecking.Serialise.Base
    import Agda.TypeChecking.Serialise.Instances.Common () --instance only

    import Agda.Utils.Functor
    import Agda.Utils.Lens
    import Agda.Utils.Null
    import Agda.Utils.Impossible

    -- Don't serialize the tactic.
    instance EmbPrj A.BindName where
      icod_ :: BindName -> S Word32
    icod_ (A.BindName Name
    a) = (Name -> BindName)
    -> Arrows (Domains (Name -> BindName)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Name -> BindName
    A.BindName Name
    a
      value :: Word32 -> R BindName
    value = (Name -> BindName) -> Word32 -> R (CoDomain (Name -> BindName))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN Name -> BindName
    A.BindName

    instance EmbPrj Scope where
      icod_ :: Scope -> S Word32
    icod_ (Scope ModuleName
    a [ModuleName]
    b ScopeNameSpaces
    c Map QName ModuleName
    d Maybe DataOrRecordModule
    e) = (ModuleName
     -> [ModuleName]
     -> ScopeNameSpaces
     -> Map QName ModuleName
     -> Maybe DataOrRecordModule
     -> Scope)
    -> Arrows
         (Domains
            (ModuleName
             -> [ModuleName]
             -> ScopeNameSpaces
             -> Map QName ModuleName
             -> Maybe DataOrRecordModule
             -> Scope))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' ModuleName
    -> [ModuleName]
    -> ScopeNameSpaces
    -> Map QName ModuleName
    -> Maybe DataOrRecordModule
    -> Scope
    Scope ModuleName
    a [ModuleName]
    b ScopeNameSpaces
    c Map QName ModuleName
    d Maybe DataOrRecordModule
    e

      value :: Word32 -> R Scope
    value = (ModuleName
     -> [ModuleName]
     -> ScopeNameSpaces
     -> Map QName ModuleName
     -> Maybe DataOrRecordModule
     -> Scope)
    -> Word32
    -> R (CoDomain
            (ModuleName
             -> [ModuleName]
             -> ScopeNameSpaces
             -> Map QName ModuleName
             -> Maybe DataOrRecordModule
             -> Scope))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN ModuleName
    -> [ModuleName]
    -> ScopeNameSpaces
    -> Map QName ModuleName
    -> Maybe DataOrRecordModule
    -> Scope
    Scope

    instance EmbPrj DataOrRecordModule where
      icod_ :: DataOrRecordModule -> S Word32
    icod_ DataOrRecordModule
    IsDataModule   = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    0
      icod_ DataOrRecordModule
    IsRecordModule = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    1

      value :: Word32 -> R DataOrRecordModule
    value = \case
        Word32
    0 -> DataOrRecordModule -> R DataOrRecordModule
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure DataOrRecordModule
    IsDataModule
        Word32
    1 -> DataOrRecordModule -> R DataOrRecordModule
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure DataOrRecordModule
    IsRecordModule
        Word32
    _ -> R DataOrRecordModule
    forall a. R a
    malformed

    instance EmbPrj NameSpaceId where
      icod_ :: NameSpaceId -> S Word32
    icod_ NameSpaceId
    PublicNS        = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    0
      icod_ NameSpaceId
    PrivateNS       = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    1
      icod_ NameSpaceId
    ImportedNS      = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    2

      value :: Word32 -> R NameSpaceId
    value = \case
        Word32
    0 -> NameSpaceId -> R NameSpaceId
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure NameSpaceId
    PublicNS
        Word32
    1 -> NameSpaceId -> R NameSpaceId
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure NameSpaceId
    PrivateNS
        Word32
    2 -> NameSpaceId -> R NameSpaceId
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure NameSpaceId
    ImportedNS
        Word32
    _ -> R NameSpaceId
    forall a. R a
    malformed

    instance EmbPrj Access where
      icod_ :: Access -> S Word32
    icod_ (PrivateAccess KwRange
    _ Origin
    UserWritten) = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    0
      icod_ PrivateAccess{}               = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    1
      icod_ Access
    PublicAccess                  = Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    2

      value :: Word32 -> R Access
    value = \case
        Word32
    0 -> Access -> R Access
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Access -> R Access) -> Access -> R Access
    forall a b. (a -> b) -> a -> b
    $ KwRange -> Origin -> Access
    PrivateAccess KwRange
    forall a. Null a => a
    empty Origin
    UserWritten
        Word32
    1 -> Access -> R Access
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Access -> R Access) -> Access -> R Access
    forall a b. (a -> b) -> a -> b
    $ Access
    privateAccessInserted
        Word32
    2 -> Access -> R Access
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Access
    PublicAccess
        Word32
    _ -> R Access
    forall a. R a
    malformed

    instance EmbPrj NameSpace where
      icod_ :: NameSpace -> S Word32
    icod_ (NameSpace NamesInScope
    a ModulesInScope
    b InScopeSet
    c) = (NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace)
    -> Arrows
         (Domains
            (NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace
    NameSpace NamesInScope
    a ModulesInScope
    b InScopeSet
    c

      value :: Word32 -> R NameSpace
    value = (NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace)
    -> Word32
    -> R (CoDomain
            (NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN NamesInScope -> ModulesInScope -> InScopeSet -> NameSpace
    NameSpace

    instance EmbPrj WhyInScope where
      icod_ :: WhyInScope -> S Word32
    icod_ WhyInScope
    Defined       = WhyInScope -> Arrows (Domains WhyInScope) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' WhyInScope
    Defined
      icod_ (Opened QName
    a WhyInScope
    b)  = Word32
    -> (QName -> WhyInScope -> WhyInScope)
    -> Arrows (Domains (QName -> WhyInScope -> WhyInScope)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    0 QName -> WhyInScope -> WhyInScope
    Opened QName
    a WhyInScope
    b
      icod_ (Applied QName
    a WhyInScope
    b) = Word32
    -> (QName -> WhyInScope -> WhyInScope)
    -> Arrows (Domains (QName -> WhyInScope -> WhyInScope)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    1 QName -> WhyInScope -> WhyInScope
    Applied QName
    a WhyInScope
    b

      value :: Word32 -> R WhyInScope
    value = ([Word32] -> R WhyInScope) -> Word32 -> R WhyInScope
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R WhyInScope
    valu where
        valu :: [Word32]
    -> Arrows
         (Constant Word32 (Domains WhyInScope)) (R (CoDomain WhyInScope))
    valu []        = WhyInScope
    -> Arrows
         (Constant Word32 (Domains WhyInScope)) (R (CoDomain WhyInScope))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN WhyInScope
    Defined
        valu [Word32
    0, Word32
    a, Word32
    b] = (QName -> WhyInScope -> WhyInScope)
    -> Arrows
         (Constant Word32 (Domains (QName -> WhyInScope -> WhyInScope)))
         (R (CoDomain (QName -> WhyInScope -> WhyInScope)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN QName -> WhyInScope -> WhyInScope
    Opened Word32
    a Word32
    b
        valu [Word32
    1, Word32
    a, Word32
    b] = (QName -> WhyInScope -> WhyInScope)
    -> Arrows
         (Constant Word32 (Domains (QName -> WhyInScope -> WhyInScope)))
         (R (CoDomain (QName -> WhyInScope -> WhyInScope)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN QName -> WhyInScope -> WhyInScope
    Applied Word32
    a Word32
    b
        valu [Word32]
    _         = R WhyInScope
    Arrows
      (Constant Word32 (Domains WhyInScope)) (R (CoDomain WhyInScope))
    forall a. R a
    malformed

    -- Issue #1346: QNames are shared on their nameIds, so serializing will lose fixity information for
    -- rebound fixities. We don't care about that in terms, but in the scope it's important to keep the
    -- right fixity. Thus serialize the fixity separately.

    data AbsNameWithFixity = AbsNameWithFixity Fixity A.QName KindOfName WhyInScope NameMetadata

    toAbsName :: AbsNameWithFixity -> AbstractName
    toAbsName :: AbsNameWithFixity -> AbstractName
    toAbsName (AbsNameWithFixity Fixity
    fx QName
    a KindOfName
    b WhyInScope
    c NameMetadata
    d) = QName -> KindOfName -> WhyInScope -> NameMetadata -> AbstractName
    AbsName (Lens' QName Fixity -> LensSet QName Fixity
    forall o i. Lens' o i -> LensSet o i
    set (Fixity -> f Fixity) -> QName -> f QName
    forall a. LensFixity a => Lens' a Fixity
    Lens' QName Fixity
    lensFixity Fixity
    fx QName
    a) KindOfName
    b WhyInScope
    c NameMetadata
    d

    fromAbsName :: AbstractName -> AbsNameWithFixity
    fromAbsName :: AbstractName -> AbsNameWithFixity
    fromAbsName (AbsName QName
    a KindOfName
    b WhyInScope
    c NameMetadata
    d) = Fixity
    -> QName
    -> KindOfName
    -> WhyInScope
    -> NameMetadata
    -> AbsNameWithFixity
    AbsNameWithFixity (QName
    a QName -> Lens' QName Fixity -> Fixity
    forall o i. o -> Lens' o i -> i
    ^. (Fixity -> f Fixity) -> QName -> f QName
    forall a. LensFixity a => Lens' a Fixity
    Lens' QName Fixity
    lensFixity) QName
    a KindOfName
    b WhyInScope
    c NameMetadata
    d

    instance EmbPrj AbsNameWithFixity where
      icod_ :: AbsNameWithFixity -> S Word32
    icod_ (AbsNameWithFixity Fixity
    a QName
    b KindOfName
    c WhyInScope
    d NameMetadata
    e) = (Fixity
     -> QName
     -> KindOfName
     -> WhyInScope
     -> NameMetadata
     -> AbsNameWithFixity)
    -> Arrows
         (Domains
            (Fixity
             -> QName
             -> KindOfName
             -> WhyInScope
             -> NameMetadata
             -> AbsNameWithFixity))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Fixity
    -> QName
    -> KindOfName
    -> WhyInScope
    -> NameMetadata
    -> AbsNameWithFixity
    AbsNameWithFixity Fixity
    a QName
    b KindOfName
    c WhyInScope
    d NameMetadata
    e
      value :: Word32 -> R AbsNameWithFixity
    value = (Fixity
     -> QName
     -> KindOfName
     -> WhyInScope
     -> NameMetadata
     -> AbsNameWithFixity)
    -> Word32
    -> R (CoDomain
            (Fixity
             -> QName
             -> KindOfName
             -> WhyInScope
             -> NameMetadata
             -> AbsNameWithFixity))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN Fixity
    -> QName
    -> KindOfName
    -> WhyInScope
    -> NameMetadata
    -> AbsNameWithFixity
    AbsNameWithFixity

    instance EmbPrj AbstractName where
      icod_ :: AbstractName -> S Word32
    icod_ AbstractName
    a = AbsNameWithFixity -> S Word32
    forall a. EmbPrj a => a -> S Word32
    icod_ (AbstractName -> AbsNameWithFixity
    fromAbsName AbstractName
    a)
      value :: Word32 -> R AbstractName
    value = AbsNameWithFixity -> AbstractName
    toAbsName (AbsNameWithFixity -> AbstractName)
    -> (Word32 -> R AbsNameWithFixity) -> Word32 -> R AbstractName
    forall (m :: * -> *) b c a.
    Functor m =>
    (b -> c) -> (a -> m b) -> a -> m c
    <.> Word32 -> R AbsNameWithFixity
    forall a. EmbPrj a => Word32 -> R a
    value

    instance EmbPrj NameMetadata where
      icod_ :: NameMetadata -> S Word32
    icod_ NameMetadata
    NoMetadata                  = NameMetadata -> Arrows (Domains NameMetadata) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' NameMetadata
    NoMetadata
      icod_ (GeneralizedVarsMetadata Map QName Name
    a) = (Map QName Name -> NameMetadata)
    -> Arrows (Domains (Map QName Name -> NameMetadata)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Map QName Name -> NameMetadata
    GeneralizedVarsMetadata Map QName Name
    a

      value :: Word32 -> R NameMetadata
    value = ([Word32] -> R NameMetadata) -> Word32 -> R NameMetadata
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R NameMetadata
    valu where
        valu :: [Word32]
    -> Arrows
         (Constant Word32 (Domains NameMetadata))
         (R (CoDomain NameMetadata))
    valu []  = NameMetadata
    -> Arrows
         (Constant Word32 (Domains NameMetadata))
         (R (CoDomain NameMetadata))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN NameMetadata
    NoMetadata
        valu [Word32
    a] = (Map QName Name -> NameMetadata)
    -> Arrows
         (Constant Word32 (Domains (Map QName Name -> NameMetadata)))
         (R (CoDomain (Map QName Name -> NameMetadata)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Map QName Name -> NameMetadata
    GeneralizedVarsMetadata Word32
    a
        valu [Word32]
    _   = R NameMetadata
    Arrows
      (Constant Word32 (Domains NameMetadata))
      (R (CoDomain NameMetadata))
    forall a. R a
    malformed

    instance EmbPrj A.Suffix where
      icod_ :: Suffix -> S Word32
    icod_ Suffix
    A.NoSuffix   = Suffix -> Arrows (Domains Suffix) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Suffix
    A.NoSuffix
      icod_ (A.Suffix Integer
    a) = (Integer -> Suffix)
    -> Arrows (Domains (Integer -> Suffix)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Integer -> Suffix
    A.Suffix Integer
    a

      value :: Word32 -> R Suffix
    value = ([Word32] -> R Suffix) -> Word32 -> R Suffix
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R Suffix
    valu where
        valu :: [Word32]
    -> Arrows (Constant Word32 (Domains Suffix)) (R (CoDomain Suffix))
    valu []  = Suffix
    -> Arrows (Constant Word32 (Domains Suffix)) (R (CoDomain Suffix))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Suffix
    A.NoSuffix
        valu [Word32
    a] = (Integer -> Suffix)
    -> Arrows
         (Constant Word32 (Domains (Integer -> Suffix)))
         (R (CoDomain (Integer -> Suffix)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Integer -> Suffix
    A.Suffix Word32
    a
        valu [Word32]
    _   = R Suffix
    Arrows (Constant Word32 (Domains Suffix)) (R (CoDomain Suffix))
    forall a. R a
    malformed

    instance EmbPrj AbstractModule where
      icod_ :: AbstractModule -> S Word32
    icod_ (AbsModule ModuleName
    a WhyInScope
    b) = (ModuleName -> WhyInScope -> AbstractModule)
    -> Arrows
         (Domains (ModuleName -> WhyInScope -> AbstractModule)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' ModuleName -> WhyInScope -> AbstractModule
    AbsModule ModuleName
    a WhyInScope
    b

      value :: Word32 -> R AbstractModule
    value = (ModuleName -> WhyInScope -> AbstractModule)
    -> Word32
    -> R (CoDomain (ModuleName -> WhyInScope -> AbstractModule))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN ModuleName -> WhyInScope -> AbstractModule
    AbsModule

    instance EmbPrj KindOfName where
      -- -- Enums have a generic EmbPrj
      --
      -- icod_ DefName        = icodeN' DefName
      -- icod_ ConName        = icodeN 1 ConName
      -- icod_ FldName        = icodeN 2 FldName
      -- icod_ PatternSynName = icodeN 3 PatternSynName
      -- icod_ QuotableName   = icodeN 4 QuotableName
      -- icod_ MacroName      = icodeN 5 MacroName
      -- icod_ GeneralizeName = icodeN 6 GeneralizeName
      -- icod_ DisallowedGeneralizeName = icodeN 7 DisallowedGeneralizeName

      -- value = vcase valu where
      --   valu []  = valuN DefName
      --   valu [1] = valuN ConName
      --   valu [2] = valuN FldName
      --   valu [3] = valuN PatternSynName
      --   valu [4] = valuN QuotableName
      --   valu [5] = valuN MacroName
      --   valu [6] = valuN GeneralizeName
      --   valu [7] = valuN DisallowedGeneralizeName
      --   valu _   = malformed

    instance EmbPrj BindingSource where
      icod_ :: BindingSource -> S Word32
    icod_ = \case
        BindingSource
    LambdaBound     -> Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    0
        PatternBound Hiding
    _  -> Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    1
        BindingSource
    LetBound        -> Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    2
        BindingSource
    WithBound       -> Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    3
        BindingSource
    MacroBound      -> Word32 -> S Word32
    forall a. a -> ReaderT Dict IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Word32
    4

      value :: Word32 -> R BindingSource
    value = \case
        Word32
    0 -> BindingSource -> R BindingSource
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure BindingSource
    LambdaBound
        Word32
    1 -> BindingSource -> R BindingSource
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (BindingSource -> R BindingSource)
    -> BindingSource -> R BindingSource
    forall a b. (a -> b) -> a -> b
    $ Hiding -> BindingSource
    PatternBound Hiding
    forall a. Null a => a
    empty
        Word32
    2 -> BindingSource -> R BindingSource
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure BindingSource
    LetBound
        Word32
    3 -> BindingSource -> R BindingSource
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure BindingSource
    WithBound
        Word32
    4 -> BindingSource -> R BindingSource
    forall a. a -> StateT St IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure BindingSource
    MacroBound
        Word32
    _ -> R BindingSource
    forall a. R a
    malformed

    instance EmbPrj LocalVar where
      icod_ :: LocalVar -> S Word32
    icod_ (LocalVar Name
    a BindingSource
    b [AbstractName]
    c)  = (Name -> BindingSource -> [AbstractName] -> LocalVar)
    -> Arrows
         (Domains (Name -> BindingSource -> [AbstractName] -> LocalVar))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Name -> BindingSource -> [AbstractName] -> LocalVar
    LocalVar Name
    a BindingSource
    b [AbstractName]
    c

      value :: Word32 -> R LocalVar
    value = (Name -> BindingSource -> [AbstractName] -> LocalVar)
    -> Word32
    -> R (CoDomain
            (Name -> BindingSource -> [AbstractName] -> LocalVar))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN Name -> BindingSource -> [AbstractName] -> LocalVar
    LocalVar

    instance EmbPrj ConPatInfo where
      icod_ :: ConPatInfo -> S Word32
    icod_ (ConPatInfo ConOrigin
    a PatInfo
    _ ConPatLazy
    b) = (ConOrigin -> ConPatLazy -> ConPatInfo)
    -> Arrows
         (Domains (ConOrigin -> ConPatLazy -> ConPatInfo)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' (\ConOrigin
    a ConPatLazy
    b -> ConOrigin -> PatInfo -> ConPatLazy -> ConPatInfo
    ConPatInfo ConOrigin
    a PatInfo
    patNoRange ConPatLazy
    b) ConOrigin
    a ConPatLazy
    b

      value :: Word32 -> R ConPatInfo
    value = (ConOrigin -> ConPatLazy -> ConPatInfo)
    -> Word32 -> R (CoDomain (ConOrigin -> ConPatLazy -> ConPatInfo))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN ((ConOrigin -> ConPatLazy -> ConPatInfo)
     -> Word32 -> R (CoDomain (ConOrigin -> ConPatLazy -> ConPatInfo)))
    -> (ConOrigin -> ConPatLazy -> ConPatInfo)
    -> Word32
    -> R (CoDomain (ConOrigin -> ConPatLazy -> ConPatInfo))
    forall a b. (a -> b) -> a -> b
    $ \ConOrigin
    a ConPatLazy
    b -> ConOrigin -> PatInfo -> ConPatLazy -> ConPatInfo
    ConPatInfo ConOrigin
    a PatInfo
    patNoRange ConPatLazy
    b

    instance EmbPrj ConPatLazy

    -- Only for pattern synonyms (where a is Void)
    instance EmbPrj a => EmbPrj (A.Pattern' a) where
      icod_ :: Pattern' a -> S Word32
    icod_ (A.VarP BindName
    a)            = Word32
    -> (BindName -> Pattern' (ZonkAny 0))
    -> Arrows (Domains (BindName -> Pattern' (ZonkAny 0))) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    0 BindName -> Pattern' (ZonkAny 0)
    forall e. BindName -> Pattern' e
    A.VarP BindName
    a
      icod_ (A.ConP ConPatInfo
    a AmbiguousQName
    b NAPs a
    c)        = Word32
    -> (ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a)
    -> Arrows
         (Domains (ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    1 ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
    forall e. ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.ConP ConPatInfo
    a AmbiguousQName
    b NAPs a
    c
      icod_ (A.DefP PatInfo
    p AmbiguousQName
    a NAPs a
    b)        = Word32
    -> (AmbiguousQName -> NAPs a -> Pattern' a)
    -> Arrows
         (Domains (AmbiguousQName -> NAPs a -> Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    2 (PatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
    forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.DefP PatInfo
    p) AmbiguousQName
    a NAPs a
    b
      icod_ t :: Pattern' a
    t@(A.WildP PatInfo
    p)         = Word32 -> Pattern' a -> Arrows (Domains (Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    3 Pattern' a
    t
      icod_ (A.AsP PatInfo
    p BindName
    a Pattern' a
    b)         = Word32
    -> (BindName -> Pattern' a -> Pattern' a)
    -> Arrows
         (Domains (BindName -> Pattern' a -> Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    4 (PatInfo -> BindName -> Pattern' a -> Pattern' a
    forall e. PatInfo -> BindName -> Pattern' e -> Pattern' e
    A.AsP PatInfo
    p) BindName
    a Pattern' a
    b
      icod_ (A.DotP PatInfo
    r a
    a)          = Word32
    -> (a -> Pattern' a)
    -> Arrows (Domains (a -> Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    5 (PatInfo -> a -> Pattern' a
    forall e. PatInfo -> e -> Pattern' e
    A.DotP PatInfo
    r) a
    a
      icod_ t :: Pattern' a
    t@(A.AbsurdP PatInfo
    _)       = Word32 -> Pattern' a -> Arrows (Domains (Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    6 Pattern' a
    t
      icod_ (A.LitP PatInfo
    i Literal
    a)          = Word32
    -> (Literal -> Pattern' (ZonkAny 1))
    -> Arrows (Domains (Literal -> Pattern' (ZonkAny 1))) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    7 (PatInfo -> Literal -> Pattern' (ZonkAny 1)
    forall e. PatInfo -> Literal -> Pattern' e
    A.LitP PatInfo
    i) Literal
    a
      icod_ (A.ProjP PatInfo
    p ProjOrigin
    a AmbiguousQName
    b)       = Word32
    -> (ProjOrigin -> AmbiguousQName -> Pattern' (ZonkAny 2))
    -> Arrows
         (Domains (ProjOrigin -> AmbiguousQName -> Pattern' (ZonkAny 2)))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    8 (PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' (ZonkAny 2)
    forall e. PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
    A.ProjP PatInfo
    p) ProjOrigin
    a AmbiguousQName
    b
      icod_ (A.PatternSynP PatInfo
    p AmbiguousQName
    a NAPs a
    b) = Word32
    -> (AmbiguousQName -> NAPs a -> Pattern' a)
    -> Arrows
         (Domains (AmbiguousQName -> NAPs a -> Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    9 (PatInfo -> AmbiguousQName -> NAPs a -> Pattern' a
    forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.PatternSynP PatInfo
    p) AmbiguousQName
    a NAPs a
    b
      icod_ (A.RecP KwRange
    r ConPatInfo
    a [FieldAssignment' (Pattern' a)]
    b)        = Word32
    -> (ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a)
    -> Arrows
         (Domains
            (ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    10 (KwRange
    -> ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a
    forall e.
    KwRange
    -> ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
    A.RecP KwRange
    r) ConPatInfo
    a [FieldAssignment' (Pattern' a)]
    b
      icod_ (A.EqualP PatInfo
    _ List1 (a, a)
    a)        = S Word32
    forall a. HasCallStack => a
    __IMPOSSIBLE__
      icod_ (A.WithP PatInfo
    i Pattern' a
    a)         = Word32
    -> (Pattern' a -> Pattern' a)
    -> Arrows (Domains (Pattern' a -> Pattern' a)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    11 (PatInfo -> Pattern' a -> Pattern' a
    forall e. PatInfo -> Pattern' e -> Pattern' e
    A.WithP PatInfo
    i) Pattern' a
    a

      value :: Word32 -> R (Pattern' a)
    value = ([Word32] -> R (Pattern' a)) -> Word32 -> R (Pattern' a)
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R (Pattern' a)
    forall {e}.
    (EmbPrj e, EmbPrj (Pattern' e)) =>
    [Word32] -> R (Pattern' e)
    valu where
        valu :: [Word32] -> R (Pattern' e)
    valu [Word32
    0, Word32
    a]       = (BindName -> Pattern' e)
    -> Arrows
         (Constant Word32 (Domains (BindName -> Pattern' e)))
         (R (CoDomain (BindName -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN BindName -> Pattern' e
    forall e. BindName -> Pattern' e
    A.VarP Word32
    a
        valu [Word32
    1, Word32
    a, Word32
    b, Word32
    c] = (ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)
    -> Arrows
         (Constant
            Word32
            (Domains (ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)))
         (R (CoDomain
               (ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    forall e. ConPatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.ConP Word32
    a Word32
    b Word32
    c
        valu [Word32
    2, Word32
    a, Word32
    b]    = (AmbiguousQName -> NAPs e -> Pattern' e)
    -> Arrows
         (Constant
            Word32 (Domains (AmbiguousQName -> NAPs e -> Pattern' e)))
         (R (CoDomain (AmbiguousQName -> NAPs e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.DefP PatInfo
    i) Word32
    a Word32
    b
        valu [Word32
    3]          = Pattern' e
    -> Arrows
         (Constant Word32 (Domains (Pattern' e)))
         (R (CoDomain (Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> Pattern' e
    forall e. PatInfo -> Pattern' e
    A.WildP PatInfo
    i)
        valu [Word32
    4, Word32
    a, Word32
    b]    = (BindName -> Pattern' e -> Pattern' e)
    -> Arrows
         (Constant Word32 (Domains (BindName -> Pattern' e -> Pattern' e)))
         (R (CoDomain (BindName -> Pattern' e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> BindName -> Pattern' e -> Pattern' e
    forall e. PatInfo -> BindName -> Pattern' e -> Pattern' e
    A.AsP PatInfo
    i) Word32
    a Word32
    b
        valu [Word32
    5, Word32
    a]       = (e -> Pattern' e)
    -> Arrows
         (Constant Word32 (Domains (e -> Pattern' e)))
         (R (CoDomain (e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> e -> Pattern' e
    forall e. PatInfo -> e -> Pattern' e
    A.DotP PatInfo
    i) Word32
    a
        valu [Word32
    6]          = Pattern' e
    -> Arrows
         (Constant Word32 (Domains (Pattern' e)))
         (R (CoDomain (Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> Pattern' e
    forall e. PatInfo -> Pattern' e
    A.AbsurdP PatInfo
    i)
        valu [Word32
    7, Word32
    a]       = (Literal -> Pattern' e)
    -> Arrows
         (Constant Word32 (Domains (Literal -> Pattern' e)))
         (R (CoDomain (Literal -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> Literal -> Pattern' e
    forall e. PatInfo -> Literal -> Pattern' e
    A.LitP PatInfo
    i) Word32
    a
        valu [Word32
    8, Word32
    a, Word32
    b]    = (ProjOrigin -> AmbiguousQName -> Pattern' e)
    -> Arrows
         (Constant
            Word32 (Domains (ProjOrigin -> AmbiguousQName -> Pattern' e)))
         (R (CoDomain (ProjOrigin -> AmbiguousQName -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
    forall e. PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' e
    A.ProjP PatInfo
    i) Word32
    a Word32
    b
        valu [Word32
    9, Word32
    a, Word32
    b]    = (AmbiguousQName -> NAPs e -> Pattern' e)
    -> Arrows
         (Constant
            Word32 (Domains (AmbiguousQName -> NAPs e -> Pattern' e)))
         (R (CoDomain (AmbiguousQName -> NAPs e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    forall e. PatInfo -> AmbiguousQName -> NAPs e -> Pattern' e
    A.PatternSynP PatInfo
    i) Word32
    a Word32
    b
        valu [Word32
    10, Word32
    a, Word32
    b]   = (ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e)
    -> Arrows
         (Constant
            Word32
            (Domains
               (ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e)))
         (R (CoDomain
               (ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (KwRange
    -> ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
    forall e.
    KwRange
    -> ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
    A.RecP KwRange
    forall a. Null a => a
    empty) Word32
    a Word32
    b
        valu [Word32
    11, Word32
    a]      = (Pattern' e -> Pattern' e)
    -> Arrows
         (Constant Word32 (Domains (Pattern' e -> Pattern' e)))
         (R (CoDomain (Pattern' e -> Pattern' e)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN (PatInfo -> Pattern' e -> Pattern' e
    forall e. PatInfo -> Pattern' e -> Pattern' e
    A.WithP PatInfo
    i) Word32
    a
        valu [Word32]
    _            = R (Pattern' e)
    forall a. R a
    malformed

        i :: PatInfo
    i = PatInfo
    patNoRange

    -- | Hackish serialization for patterns that deletes dot patterns.
    --   So that we can serialize the 'WithClauseProjectionFixityMismatch'
    --   without having to define serialization of expressions.
    --
    instance {-# OVERLAPS #-} EmbPrj A.Pattern where
      icod_ :: Pattern -> S Word32
    icod_ = Pattern' Void -> S Word32
    forall a. EmbPrj a => a -> S Word32
    icod_ (Pattern' Void -> S Word32)
    -> (Pattern -> ReaderT Dict IO (Pattern' Void))
    -> Pattern
    -> S Word32
    forall (m :: * -> *) b c a.
    Monad m =>
    (b -> m c) -> (a -> m b) -> a -> m c
    <=< ReaderT Dict IO (Pattern' Void)
    -> Pattern -> ReaderT Dict IO (Pattern' Void)
    forall (m :: * -> *) e.
    Monad m =>
    m (Pattern' Void) -> Pattern' e -> m (Pattern' Void)
    noDotOrEqPattern (Pattern' Void -> ReaderT Dict IO (Pattern' Void)
    forall a. a -> ReaderT Dict IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Pattern' Void -> ReaderT Dict IO (Pattern' Void))
    -> Pattern' Void -> ReaderT Dict IO (Pattern' Void)
    forall a b. (a -> b) -> a -> b
    $ PatInfo -> Pattern' Void
    forall e. PatInfo -> Pattern' e
    A.WildP PatInfo
    forall a. Null a => a
    empty)
      value :: Word32 -> R Pattern
    value = (Void -> Expr) -> Pattern' Void -> Pattern
    forall a b. (a -> b) -> Pattern' a -> Pattern' b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Void -> Expr
    forall a. HasCallStack => a
    __IMPOSSIBLE__ :: Void -> A.Expr) (Pattern' Void -> Pattern)
    -> (Word32 -> StateT St IO (Pattern' Void)) -> Word32 -> R Pattern
    forall (m :: * -> *) b c a.
    Functor m =>
    (b -> c) -> (a -> m b) -> a -> m c
    <.> Word32 -> StateT St IO (Pattern' Void)
    forall a. EmbPrj a => Word32 -> R a
    value

    instance EmbPrj ParenPreference where
      icod_ :: ParenPreference -> S Word32
    icod_ ParenPreference
    PreferParen     = ParenPreference -> Arrows (Domains ParenPreference) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' ParenPreference
    PreferParen
      icod_ ParenPreference
    PreferParenless = Word32
    -> ParenPreference -> Arrows (Domains ParenPreference) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    1 ParenPreference
    PreferParenless
      value :: Word32 -> R ParenPreference
    value = ([Word32] -> R ParenPreference) -> Word32 -> R ParenPreference
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R ParenPreference
    forall {a}. (Eq a, Num a) => [a] -> R ParenPreference
    valu where
        valu :: [a]
    -> Arrows
         (Constant Word32 (Domains ParenPreference))
         (R (CoDomain ParenPreference))
    valu []  = ParenPreference
    -> Arrows
         (Constant Word32 (Domains ParenPreference))
         (R (CoDomain ParenPreference))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN ParenPreference
    PreferParen
        valu [a
    1] = ParenPreference
    -> Arrows
         (Constant Word32 (Domains ParenPreference))
         (R (CoDomain ParenPreference))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN ParenPreference
    PreferParenless
        valu [a]
    _   = R ParenPreference
    Arrows
      (Constant Word32 (Domains ParenPreference))
      (R (CoDomain ParenPreference))
    forall a. R a
    malformed

    instance EmbPrj Precedence where
      icod_ :: Precedence -> S Word32
    icod_ Precedence
    TopCtx                 = Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' Precedence
    TopCtx
      icod_ Precedence
    FunctionSpaceDomainCtx = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    1 Precedence
    FunctionSpaceDomainCtx
      icod_ (LeftOperandCtx Fixity
    a)     = Word32
    -> (Fixity -> Precedence)
    -> Arrows (Domains (Fixity -> Precedence)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    2 Fixity -> Precedence
    LeftOperandCtx Fixity
    a
      icod_ (RightOperandCtx Fixity
    a ParenPreference
    b)  = Word32
    -> (Fixity -> ParenPreference -> Precedence)
    -> Arrows
         (Domains (Fixity -> ParenPreference -> Precedence)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    3 Fixity -> ParenPreference -> Precedence
    RightOperandCtx Fixity
    a ParenPreference
    b
      icod_ Precedence
    FunctionCtx            = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    4 Precedence
    FunctionCtx
      icod_ (ArgumentCtx ParenPreference
    a)        = Word32
    -> (ParenPreference -> Precedence)
    -> Arrows (Domains (ParenPreference -> Precedence)) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    5 ParenPreference -> Precedence
    ArgumentCtx ParenPreference
    a
      icod_ Precedence
    InsideOperandCtx       = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    6 Precedence
    InsideOperandCtx
      icod_ Precedence
    WithFunCtx             = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    7 Precedence
    WithFunCtx
      icod_ Precedence
    WithArgCtx             = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    8 Precedence
    WithArgCtx
      icod_ Precedence
    DotPatternCtx          = Word32 -> Precedence -> Arrows (Domains Precedence) (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    Word32 -> t -> Arrows (Domains t) (S Word32)
    icodeN Word32
    9 Precedence
    DotPatternCtx

      value :: Word32 -> R Precedence
    value = ([Word32] -> R Precedence) -> Word32 -> R Precedence
    forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
    vcase [Word32] -> R Precedence
    valu where
        valu :: [Word32]
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    valu []        = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    TopCtx
        valu [Word32
    1]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    FunctionSpaceDomainCtx
        valu [Word32
    2, Word32
    a]    = (Fixity -> Precedence)
    -> Arrows
         (Constant Word32 (Domains (Fixity -> Precedence)))
         (R (CoDomain (Fixity -> Precedence)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Fixity -> Precedence
    LeftOperandCtx Word32
    a
        valu [Word32
    3, Word32
    a, Word32
    b] = (Fixity -> ParenPreference -> Precedence)
    -> Arrows
         (Constant
            Word32 (Domains (Fixity -> ParenPreference -> Precedence)))
         (R (CoDomain (Fixity -> ParenPreference -> Precedence)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Fixity -> ParenPreference -> Precedence
    RightOperandCtx Word32
    a Word32
    b
        valu [Word32
    4]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    FunctionCtx
        valu [Word32
    5, Word32
    a]    = (ParenPreference -> Precedence)
    -> Arrows
         (Constant Word32 (Domains (ParenPreference -> Precedence)))
         (R (CoDomain (ParenPreference -> Precedence)))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN ParenPreference -> Precedence
    ArgumentCtx Word32
    a
        valu [Word32
    6]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    InsideOperandCtx
        valu [Word32
    7]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    WithFunCtx
        valu [Word32
    8]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    WithArgCtx
        valu [Word32
    9]       = Precedence
    -> Arrows
         (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall t.
    (VALU t (IsBase t),
     StrictCurrying (Constant Word32 (Domains t)) (R (CoDomain t)),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Constant Word32 (Domains t)) (R (CoDomain t))
    valuN Precedence
    DotPatternCtx
        valu [Word32]
    _         = R Precedence
    Arrows
      (Constant Word32 (Domains Precedence)) (R (CoDomain Precedence))
    forall a. R a
    malformed

    instance EmbPrj ScopeInfo where
      icod_ :: ScopeInfo -> S Word32
    icod_ (ScopeInfo ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e NameMap
    f ModuleMap
    g InScopeSet
    h Fixities
    i Polarities
    j Map QName (QName, Maybe Induction)
    k) = (ModuleName
     -> Map ModuleName Scope
     -> LocalVars
     -> LocalVars
     -> PrecedenceStack
     -> ScopeInfo)
    -> Arrows
         (Domains
            (ModuleName
             -> Map ModuleName Scope
             -> LocalVars
             -> LocalVars
             -> PrecedenceStack
             -> ScopeInfo))
         (S Word32)
    forall t.
    (ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
     All EmbPrj (Domains t)) =>
    t -> Arrows (Domains t) (S Word32)
    icodeN' (\ ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e -> ModuleName
    -> Map ModuleName Scope
    -> LocalVars
    -> LocalVars
    -> PrecedenceStack
    -> NameMap
    -> ModuleMap
    -> InScopeSet
    -> Fixities
    -> Polarities
    -> Map QName (QName, Maybe Induction)
    -> ScopeInfo
    ScopeInfo ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e NameMap
    f ModuleMap
    g InScopeSet
    h Fixities
    i Polarities
    j Map QName (QName, Maybe Induction)
    k) ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e

      value :: Word32 -> R ScopeInfo
    value = (ModuleName
     -> Map ModuleName Scope
     -> LocalVars
     -> LocalVars
     -> PrecedenceStack
     -> ScopeInfo)
    -> Word32
    -> R (CoDomain
            (ModuleName
             -> Map ModuleName Scope
             -> LocalVars
             -> LocalVars
             -> PrecedenceStack
             -> ScopeInfo))
    forall t.
    (VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
    t -> Word32 -> R (CoDomain t)
    valueN (\ ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e -> ModuleName
    -> Map ModuleName Scope
    -> LocalVars
    -> LocalVars
    -> PrecedenceStack
    -> NameMap
    -> ModuleMap
    -> InScopeSet
    -> Fixities
    -> Polarities
    -> Map QName (QName, Maybe Induction)
    -> ScopeInfo
    ScopeInfo ModuleName
    a Map ModuleName Scope
    b LocalVars
    c LocalVars
    d PrecedenceStack
    e NameMap
    forall k a. Map k a
    Map.empty ModuleMap
    forall k a. Map k a
    Map.empty InScopeSet
    forall a. Set a
    Set.empty Fixities
    forall k a. Map k a
    Map.empty Polarities
    forall k a. Map k a
    Map.empty Map QName (QName, Maybe Induction)
    forall k a. Map k a
    Map.empty)

    instance EmbPrj NameOrModule