{-# OPTIONS_GHC -Wunused-imports #-}

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

module Agda.TypeChecking.Serialise.Instances.Highlighting where

import qualified Data.Map.Strict as Map
import Data.Strict.Tuple (Pair(..))
import Data.Word (Word32)

import qualified Agda.Interaction.Highlighting.Range   as HR
import qualified Agda.Interaction.Highlighting.Precise as HP
import qualified Agda.Utils.RangeMap                   as RM

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

instance EmbPrj HR.Range where
  icod_ :: Range -> S Word32
icod_ (HR.Range Int
a Int
b) = (Int -> Int -> Range)
-> Arrows (Domains (Int -> Int -> Range)) (S Word32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Word32)
icodeN' Int -> Int -> Range
HR.Range Int
a Int
b

  value :: Word32 -> R Range
value = (Int -> Int -> Range)
-> Word32 -> R (CoDomain (Int -> Int -> Range))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Word32 -> R (CoDomain t)
valueN Int -> Int -> Range
HR.Range

instance EmbPrj HP.NameKind where
  icod_ :: NameKind -> S Word32
icod_ NameKind
HP.Bound           = NameKind -> Arrows (Domains NameKind) (S Word32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Word32)
icodeN' NameKind
HP.Bound
  icod_ (HP.Constructor Induction
a) = Word32
-> (Induction -> NameKind)
-> Arrows (Domains (Induction -> NameKind)) (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 Induction -> NameKind
HP.Constructor Induction
a
  icod_ NameKind
HP.Datatype        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Field           = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Function        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Module          = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Postulate       = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Primitive       = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Record          = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Argument        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Macro           = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ NameKind
HP.Generalizable   = Word32 -> () -> Arrows (Domains ()) (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 ()

  value :: Word32 -> R NameKind
value = ([Word32] -> R NameKind) -> Word32 -> R NameKind
forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
vcase [Word32] -> R NameKind
valu where
    valu :: [Word32]
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
valu []      = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Bound
    valu [Word32
1 , Word32
a] = (Induction -> NameKind)
-> Arrows
     (Constant Word32 (Domains (Induction -> NameKind)))
     (R (CoDomain (Induction -> NameKind)))
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 Induction -> NameKind
HP.Constructor Word32
a
    valu [Word32
2]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Datatype
    valu [Word32
3]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Field
    valu [Word32
4]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Function
    valu [Word32
5]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Module
    valu [Word32
6]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Postulate
    valu [Word32
7]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Primitive
    valu [Word32
8]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Record
    valu [Word32
9]     = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Argument
    valu [Word32
10]    = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Macro
    valu [Word32
11]    = NameKind
-> Arrows
     (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
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 NameKind
HP.Generalizable
    valu [Word32]
_       = R NameKind
Arrows (Constant Word32 (Domains NameKind)) (R (CoDomain NameKind))
forall a. R a
malformed

instance EmbPrj HP.Aspect where
  icod_ :: Aspect -> S Word32
icod_ Aspect
HP.Comment        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Keyword       = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.String        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Number        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Symbol        = Aspect -> Arrows (Domains Aspect) (S Word32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Word32)
icodeN' Aspect
HP.Symbol
  icod_ Aspect
HP.PrimitiveType = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ (HP.Name Maybe NameKind
mk Bool
b)   = Word32
-> (Maybe NameKind -> Bool -> Aspect)
-> Arrows (Domains (Maybe NameKind -> Bool -> Aspect)) (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 Maybe NameKind -> Bool -> Aspect
HP.Name Maybe NameKind
mk Bool
b
  icod_ Aspect
HP.Pragma        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Background    = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Markup        = Word32 -> () -> Arrows (Domains ()) (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 ()
  icod_ Aspect
HP.Hole          = Word32 -> () -> Arrows (Domains ()) (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 ()

  value :: Word32 -> R Aspect
value = ([Word32] -> R Aspect) -> Word32 -> R Aspect
forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
vcase [Word32] -> R Aspect
valu where
    valu :: [Word32]
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
valu [Word32
0]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Comment
    valu [Word32
1]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Keyword
    valu [Word32
2]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.String
    valu [Word32
3]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Number
    valu []         = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Symbol
    valu [Word32
4]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.PrimitiveType
    valu [Word32
5, Word32
mk, Word32
b] = (Maybe NameKind -> Bool -> Aspect)
-> Arrows
     (Constant Word32 (Domains (Maybe NameKind -> Bool -> Aspect)))
     (R (CoDomain (Maybe NameKind -> Bool -> Aspect)))
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 Maybe NameKind -> Bool -> Aspect
HP.Name Word32
mk Word32
b
    valu [Word32
6]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Pragma
    valu [Word32
7]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Background
    valu [Word32
8]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Markup
    valu [Word32
9]        = Aspect
-> Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
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 Aspect
HP.Hole
    valu [Word32]
_          = R Aspect
Arrows (Constant Word32 (Domains Aspect)) (R (CoDomain Aspect))
forall a. R a
malformed

instance EmbPrj HP.OtherAspect where
  icod_ :: OtherAspect -> S Word32
icod_ OtherAspect
HP.Error                = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
0
  icod_ OtherAspect
HP.ErrorWarning         = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
1
  icod_ OtherAspect
HP.DottedPattern        = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
2
  icod_ OtherAspect
HP.UnsolvedMeta         = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
3
  icod_ OtherAspect
HP.TerminationProblem   = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
4
  icod_ OtherAspect
HP.IncompletePattern    = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
5
  icod_ OtherAspect
HP.TypeChecks           = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
6
  icod_ OtherAspect
HP.UnsolvedConstraint   = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
7
  icod_ OtherAspect
HP.PositivityProblem    = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
8
  icod_ OtherAspect
HP.Deadcode             = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
9
  icod_ OtherAspect
HP.CoverageProblem      = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
10
  icod_ OtherAspect
HP.CatchallClause       = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
11
  icod_ OtherAspect
HP.ConfluenceProblem    = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
12
  icod_ OtherAspect
HP.MissingDefinition    = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
13
  icod_ OtherAspect
HP.ShadowingInTelescope = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
14
  icod_ OtherAspect
HP.CosmeticProblem      = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
15
  icod_ OtherAspect
HP.InstanceProblem      = Word32 -> S Word32
forall a. a -> ReaderT Dict IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Word32
16

  value :: Word32 -> R OtherAspect
value = \case
    Word32
0  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.Error
    Word32
1  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.ErrorWarning
    Word32
2  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.DottedPattern
    Word32
3  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.UnsolvedMeta
    Word32
4  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.TerminationProblem
    Word32
5  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.IncompletePattern
    Word32
6  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.TypeChecks
    Word32
7  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.UnsolvedConstraint
    Word32
8  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.PositivityProblem
    Word32
9  -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.Deadcode
    Word32
10 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.CoverageProblem
    Word32
11 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.CatchallClause
    Word32
12 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.ConfluenceProblem
    Word32
13 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.MissingDefinition
    Word32
14 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.ShadowingInTelescope
    Word32
15 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.CosmeticProblem
    Word32
16 -> OtherAspect -> R OtherAspect
forall a. a -> StateT St IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure OtherAspect
HP.InstanceProblem
    Word32
_  -> R OtherAspect
forall a. R a
malformed

instance EmbPrj HP.Aspects where
  icod_ :: Aspects -> S Word32
icod_ (HP.Aspects Maybe Aspect
a Set OtherAspect
b String
c Maybe DefinitionSite
d TokenBased
e) = (Maybe Aspect
 -> Set OtherAspect
 -> String
 -> Maybe DefinitionSite
 -> TokenBased
 -> Aspects)
-> Arrows
     (Domains
        (Maybe Aspect
         -> Set OtherAspect
         -> String
         -> Maybe DefinitionSite
         -> TokenBased
         -> Aspects))
     (S Word32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Word32)
icodeN' Maybe Aspect
-> Set OtherAspect
-> String
-> Maybe DefinitionSite
-> TokenBased
-> Aspects
HP.Aspects Maybe Aspect
a Set OtherAspect
b String
c Maybe DefinitionSite
d TokenBased
e

  value :: Word32 -> R Aspects
value = (Maybe Aspect
 -> Set OtherAspect
 -> String
 -> Maybe DefinitionSite
 -> TokenBased
 -> Aspects)
-> Word32
-> R (CoDomain
        (Maybe Aspect
         -> Set OtherAspect
         -> String
         -> Maybe DefinitionSite
         -> TokenBased
         -> Aspects))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Word32 -> R (CoDomain t)
valueN Maybe Aspect
-> Set OtherAspect
-> String
-> Maybe DefinitionSite
-> TokenBased
-> Aspects
HP.Aspects

instance EmbPrj HP.DefinitionSite where
  icod_ :: DefinitionSite -> S Word32
icod_ (HP.DefinitionSite TopLevelModuleName' Range
a Int
b Bool
c Maybe String
d) = (TopLevelModuleName' Range
 -> Int -> Bool -> Maybe String -> DefinitionSite)
-> Arrows
     (Domains
        (TopLevelModuleName' Range
         -> Int -> Bool -> Maybe String -> DefinitionSite))
     (S Word32)
forall t.
(ICODE t (IsBase t), StrictCurrying (Domains t) (S Word32),
 All EmbPrj (Domains t)) =>
t -> Arrows (Domains t) (S Word32)
icodeN' TopLevelModuleName' Range
-> Int -> Bool -> Maybe String -> DefinitionSite
HP.DefinitionSite TopLevelModuleName' Range
a Int
b Bool
c Maybe String
d

  value :: Word32 -> R DefinitionSite
value = (TopLevelModuleName' Range
 -> Int -> Bool -> Maybe String -> DefinitionSite)
-> Word32
-> R (CoDomain
        (TopLevelModuleName' Range
         -> Int -> Bool -> Maybe String -> DefinitionSite))
forall t.
(VALU t (IsBase t), All EmbPrj (CoDomain t : Domains t)) =>
t -> Word32 -> R (CoDomain t)
valueN TopLevelModuleName' Range
-> Int -> Bool -> Maybe String -> DefinitionSite
HP.DefinitionSite

instance EmbPrj a => EmbPrj (RM.RangeMap a) where
  -- Write the RangeMap as flat list rather than a list of (Int, (Int, x)). Much
  -- like Map, we need to call `convert' in the tail position and so the output
  -- list is written (and read) in reverse order.
  icod_ :: RangeMap a -> S Word32
icod_ (RM.RangeMap Map Int (PairInt a)
f) = Node -> S Word32
icodeNode (Node -> S Word32) -> ReaderT Dict IO Node -> S Word32
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Node -> [(Int, PairInt a)] -> ReaderT Dict IO Node
convert Node
Empty (Map Int (PairInt a) -> [(Int, PairInt a)]
forall k a. Map k a -> [(k, a)]
Map.toAscList Map Int (PairInt a)
f) where
    convert :: Node -> [(Int, RM.PairInt a)] -> S Node
    convert :: Node -> [(Int, PairInt a)] -> ReaderT Dict IO Node
convert !Node
ys [] = Node -> ReaderT Dict IO Node
forall a. a -> ReaderT Dict IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Node
ys
    convert  Node
ys ((Int
start, RM.PairInt (Int
end :!: a
entry)):[(Int, PairInt a)]
xs) = do
      !start <- Int -> S Word32
forall a. EmbPrj a => a -> S Word32
icode Int
start
      !end <- icode end
      !entry <- icode entry
      convert (Cons start (Cons end (Cons entry ys))) xs

  value :: Word32 -> R (RangeMap a)
value = ([Word32] -> R (RangeMap a)) -> Word32 -> R (RangeMap a)
forall a. EmbPrj a => ([Word32] -> R a) -> Word32 -> R a
vcase (([(Int, PairInt a)] -> RangeMap a)
-> StateT St IO [(Int, PairInt a)] -> R (RangeMap a)
forall a b. (a -> b) -> StateT St IO a -> StateT St IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Map Int (PairInt a) -> RangeMap a
forall a. Map Int (PairInt a) -> RangeMap a
RM.RangeMap (Map Int (PairInt a) -> RangeMap a)
-> ([(Int, PairInt a)] -> Map Int (PairInt a))
-> [(Int, PairInt a)]
-> RangeMap a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Int, PairInt a)] -> Map Int (PairInt a)
forall k a. [(k, a)] -> Map k a
Map.fromDistinctAscList) (StateT St IO [(Int, PairInt a)] -> R (RangeMap a))
-> ([Word32] -> StateT St IO [(Int, PairInt a)])
-> [Word32]
-> R (RangeMap a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Int, PairInt a)] -> [Word32] -> StateT St IO [(Int, PairInt a)]
convert []) where
    convert :: [(Int, RM.PairInt a)] -> [Word32] -> R [(Int, RM.PairInt a)]
    convert :: [(Int, PairInt a)] -> [Word32] -> StateT St IO [(Int, PairInt a)]
convert ![(Int, PairInt a)]
ys [] = [(Int, PairInt a)] -> StateT St IO [(Int, PairInt a)]
forall a. a -> StateT St IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [(Int, PairInt a)]
ys
    convert  [(Int, PairInt a)]
ys (Word32
start:Word32
end:Word32
entry:[Word32]
xs) = do
      !start <- Word32 -> R Int
forall a. EmbPrj a => Word32 -> R a
value Word32
start
      !end <- value end
      !entry <- value entry
      convert ((start, RM.PairInt (end :!: entry)):ys) xs
    convert [(Int, PairInt a)]
_ [Word32]
_ = StateT St IO [(Int, PairInt a)]
forall a. R a
malformed

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

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