{-# OPTIONS_GHC -Wunused-imports #-}

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

module Agda.TypeChecking.Serialise.Instances.Abstract where

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.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 Int32
icod_ (A.BindName Name
a) = (Name -> BindName) -> Arrows (Domains (Name -> BindName)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Int32)
icodeN' Name -> BindName
A.BindName Name
a
  value :: Int32 -> R BindName
value = (Name -> BindName) -> Int32 -> R (CoDomain (Name -> BindName))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> R (CoDomain t)
valueN Name -> BindName
A.BindName

instance EmbPrj Scope where
  icod_ :: Scope -> S Int32
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 Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Int32)
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 :: Int32 -> R Scope
value = (ModuleName
 -> [ModuleName]
 -> ScopeNameSpaces
 -> Map QName ModuleName
 -> Maybe DataOrRecordModule
 -> Scope)
-> Int32
-> R (CoDomain
        (ModuleName
         -> [ModuleName]
         -> ScopeNameSpaces
         -> Map QName ModuleName
         -> Maybe DataOrRecordModule
         -> Scope))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> R (CoDomain t)
valueN ModuleName
-> [ModuleName]
-> ScopeNameSpaces
-> Map QName ModuleName
-> Maybe DataOrRecordModule
-> Scope
Scope

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

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

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

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

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

  value :: Int32 -> R Access
value = \case
    Int32
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
    Int32
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
    Int32
2 -> Access -> R Access
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Access
PublicAccess
    Int32
_ -> R Access
forall a. R a
malformed

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

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

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

  value :: Int32 -> R WhyInScope
value = ([Int32] -> R WhyInScope) -> Int32 -> R WhyInScope
forall a. EmbPrj a => ([Int32] -> R a) -> Int32 -> R a
vcase [Int32] -> R WhyInScope
valu where
    valu :: [Int32]
-> Arrows
     (Constant Int32 (Domains WhyInScope)) (R (CoDomain WhyInScope))
valu []        = WhyInScope
-> Arrows
     (Constant Int32 (Domains WhyInScope)) (R (CoDomain WhyInScope))
forall t.
(VALU t (IsBase t),
 StrictCurrying (Constant Int32 (Domains t)) (R (CoDomain t)),
 All EmbPrj (Domains t)) =>
t -> Arrows (Constant Int32 (Domains t)) (R (CoDomain t))
valuN WhyInScope
Defined
    valu [Int32
0, Int32
a, Int32
b] = (QName -> WhyInScope -> WhyInScope)
-> Arrows
     (Constant Int32 (Domains (QName -> WhyInScope -> WhyInScope)))
     (R (CoDomain (QName -> WhyInScope -> WhyInScope)))
forall t.
(VALU t (IsBase t),
 StrictCurrying (Constant Int32 (Domains t)) (R (CoDomain t)),
 All EmbPrj (Domains t)) =>
t -> Arrows (Constant Int32 (Domains t)) (R (CoDomain t))
valuN QName -> WhyInScope -> WhyInScope
Opened Int32
a Int32
b
    valu [Int32
1, Int32
a, Int32
b] = (QName -> WhyInScope -> WhyInScope)
-> Arrows
     (Constant Int32 (Domains (QName -> WhyInScope -> WhyInScope)))
     (R (CoDomain (QName -> WhyInScope -> WhyInScope)))
forall t.
(VALU t (IsBase t),
 StrictCurrying (Constant Int32 (Domains t)) (R (CoDomain t)),
 All EmbPrj (Domains t)) =>
t -> Arrows (Constant Int32 (Domains t)) (R (CoDomain t))
valuN QName -> WhyInScope -> WhyInScope
Applied Int32
a Int32
b
    valu [Int32]
_         = R WhyInScope
Arrows
  (Constant Int32 (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 Int32
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 Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Int32)
icodeN' Fixity
-> QName
-> KindOfName
-> WhyInScope
-> NameMetadata
-> AbsNameWithFixity
AbsNameWithFixity Fixity
a QName
b KindOfName
c WhyInScope
d NameMetadata
e
  value :: Int32 -> R AbsNameWithFixity
value = (Fixity
 -> QName
 -> KindOfName
 -> WhyInScope
 -> NameMetadata
 -> AbsNameWithFixity)
-> Int32
-> R (CoDomain
        (Fixity
         -> QName
         -> KindOfName
         -> WhyInScope
         -> NameMetadata
         -> AbsNameWithFixity))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> R (CoDomain t)
valueN Fixity
-> QName
-> KindOfName
-> WhyInScope
-> NameMetadata
-> AbsNameWithFixity
AbsNameWithFixity

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

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

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

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

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

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

  value :: Int32 -> R AbstractModule
value = (ModuleName -> WhyInScope -> AbstractModule)
-> Int32
-> R (CoDomain (ModuleName -> WhyInScope -> AbstractModule))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> 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 Int32
icod_ = \case
    BindingSource
LambdaBound    -> Int32 -> S Int32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int32
0
    PatternBound Hiding
_ -> Int32 -> S Int32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int32
1
    BindingSource
LetBound       -> Int32 -> S Int32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int32
2
    BindingSource
WithBound      -> Int32 -> S Int32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int32
3

  value :: Int32 -> R BindingSource
value = \case
    Int32
0 -> BindingSource -> R BindingSource
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure BindingSource
LambdaBound
    Int32
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
    Int32
2 -> BindingSource -> R BindingSource
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure BindingSource
LetBound
    Int32
3 -> BindingSource -> R BindingSource
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure BindingSource
WithBound
    Int32
_ -> R BindingSource
forall a. R a
malformed

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

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

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

  value :: Int32 -> R ConPatInfo
value = (ConOrigin -> ConPatLazy -> ConPatInfo)
-> Int32 -> R (CoDomain (ConOrigin -> ConPatLazy -> ConPatInfo))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> R (CoDomain t)
valueN ((ConOrigin -> ConPatLazy -> ConPatInfo)
 -> Int32 -> R (CoDomain (ConOrigin -> ConPatLazy -> ConPatInfo)))
-> (ConOrigin -> ConPatLazy -> ConPatInfo)
-> Int32
-> 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 Int32
icod_ (A.VarP BindName
a)            = Int32
-> (BindName -> Pattern' Any)
-> Arrows (Domains (BindName -> Pattern' Any)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
0 BindName -> Pattern' Any
forall e. BindName -> Pattern' e
A.VarP BindName
a
  icod_ (A.ConP ConPatInfo
a AmbiguousQName
b NAPs a
c)        = Int32
-> (ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a)
-> Arrows
     (Domains (ConPatInfo -> AmbiguousQName -> NAPs a -> Pattern' a))
     (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
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)        = Int32
-> (AmbiguousQName -> NAPs a -> Pattern' a)
-> Arrows
     (Domains (AmbiguousQName -> NAPs a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
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)         = Int32 -> Pattern' a -> Arrows (Domains (Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
3 Pattern' a
t
  icod_ (A.AsP PatInfo
p BindName
a Pattern' a
b)         = Int32
-> (BindName -> Pattern' a -> Pattern' a)
-> Arrows
     (Domains (BindName -> Pattern' a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
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
p a
a)          = Int32
-> (a -> Pattern' a)
-> Arrows (Domains (a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
5 (PatInfo -> a -> Pattern' a
forall e. PatInfo -> e -> Pattern' e
A.DotP PatInfo
p) a
a
  icod_ t :: Pattern' a
t@(A.AbsurdP PatInfo
_)       = Int32 -> Pattern' a -> Arrows (Domains (Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
6 Pattern' a
t
  icod_ (A.LitP PatInfo
i Literal
a)          = Int32
-> (Literal -> Pattern' Any)
-> Arrows (Domains (Literal -> Pattern' Any)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
7 (PatInfo -> Literal -> Pattern' Any
forall e. PatInfo -> Literal -> Pattern' e
A.LitP PatInfo
i) Literal
a
  icod_ (A.ProjP PatInfo
p ProjOrigin
a AmbiguousQName
b)       = Int32
-> (ProjOrigin -> AmbiguousQName -> Pattern' Any)
-> Arrows
     (Domains (ProjOrigin -> AmbiguousQName -> Pattern' Any)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
8 (PatInfo -> ProjOrigin -> AmbiguousQName -> Pattern' Any
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) = Int32
-> (AmbiguousQName -> NAPs a -> Pattern' a)
-> Arrows
     (Domains (AmbiguousQName -> NAPs a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
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 ConPatInfo
a [FieldAssignment' (Pattern' a)]
b)          = Int32
-> (ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a)
-> Arrows
     (Domains
        (ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a))
     (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
10 ConPatInfo -> [FieldAssignment' (Pattern' a)] -> Pattern' a
forall e.
ConPatInfo -> [FieldAssignment' (Pattern' e)] -> Pattern' e
A.RecP ConPatInfo
a [FieldAssignment' (Pattern' a)]
b
  icod_ (A.EqualP PatInfo
_ [(a, a)]
a)        = S Int32
forall a. HasCallStack => a
__IMPOSSIBLE__
  icod_ (A.WithP PatInfo
i Pattern' a
a)         = Int32
-> (Pattern' a -> Pattern' a)
-> Arrows (Domains (Pattern' a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
11 (PatInfo -> Pattern' a -> Pattern' a
forall e. PatInfo -> Pattern' e -> Pattern' e
A.WithP PatInfo
i) Pattern' a
a
  icod_ (A.AnnP PatInfo
i a
a Pattern' a
p)        = Int32
-> (a -> Pattern' a -> Pattern' a)
-> Arrows (Domains (a -> Pattern' a -> Pattern' a)) (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
Int32 -> t -> Arrows (Domains t) (S Int32)
icodeN Int32
12 (PatInfo -> a -> Pattern' a -> Pattern' a
forall e. PatInfo -> e -> Pattern' e -> Pattern' e
A.AnnP PatInfo
i) a
a Pattern' a
p

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

    i :: PatInfo
i = PatInfo
patNoRange

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

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

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

instance EmbPrj ScopeInfo where
  icod_ :: ScopeInfo -> S Int32
icod_ (ScopeInfo ModuleName
a Map ModuleName Scope
b LocalVars
c LocalVars
d PrecedenceStack
e NameMap
f ModuleMap
g InScopeSet
h Fixities
i Polarities
j) = (ModuleName
 -> Map ModuleName Scope
 -> LocalVars
 -> LocalVars
 -> PrecedenceStack
 -> ScopeInfo)
-> Arrows
     (Domains
        (ModuleName
         -> Map ModuleName Scope
         -> LocalVars
         -> LocalVars
         -> PrecedenceStack
         -> ScopeInfo))
     (S Int32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Int32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Int32)
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
-> ScopeInfo
ScopeInfo ModuleName
a Map ModuleName Scope
b LocalVars
c LocalVars
d PrecedenceStack
e NameMap
f ModuleMap
g InScopeSet
h Fixities
i Polarities
j) ModuleName
a Map ModuleName Scope
b LocalVars
c LocalVars
d PrecedenceStack
e

  value :: Int32 -> R ScopeInfo
value = (ModuleName
 -> Map ModuleName Scope
 -> LocalVars
 -> LocalVars
 -> PrecedenceStack
 -> ScopeInfo)
-> Int32
-> R (CoDomain
        (ModuleName
         -> Map ModuleName Scope
         -> LocalVars
         -> LocalVars
         -> PrecedenceStack
         -> ScopeInfo))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Int32 -> 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
-> 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)

instance EmbPrj NameOrModule