{-# OPTIONS_HADDOCK not-home #-}
{-# LANGUAGE DeriveLift #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
module Morley.Michelson.Typed.ClassifiedInstr.Internal.Types
( module Morley.Michelson.Typed.ClassifiedInstr.Internal.Types
) where
import Data.Singletons (Sing)
import Language.Haskell.TH.Syntax (Lift)
import Morley.Util.Sing
data NumChildren
= MayHaveChildren
| HasIndirectChildren
| NoChildren
| OneChild
| TwoChildren
deriving stock (Int -> NumChildren -> ShowS
[NumChildren] -> ShowS
NumChildren -> String
(Int -> NumChildren -> ShowS)
-> (NumChildren -> String)
-> ([NumChildren] -> ShowS)
-> Show NumChildren
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NumChildren -> ShowS
showsPrec :: Int -> NumChildren -> ShowS
$cshow :: NumChildren -> String
show :: NumChildren -> String
$cshowList :: [NumChildren] -> ShowS
showList :: [NumChildren] -> ShowS
Show, Int -> NumChildren
NumChildren -> Int
NumChildren -> [NumChildren]
NumChildren -> NumChildren
NumChildren -> NumChildren -> [NumChildren]
NumChildren -> NumChildren -> NumChildren -> [NumChildren]
(NumChildren -> NumChildren)
-> (NumChildren -> NumChildren)
-> (Int -> NumChildren)
-> (NumChildren -> Int)
-> (NumChildren -> [NumChildren])
-> (NumChildren -> NumChildren -> [NumChildren])
-> (NumChildren -> NumChildren -> [NumChildren])
-> (NumChildren -> NumChildren -> NumChildren -> [NumChildren])
-> Enum NumChildren
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: NumChildren -> NumChildren
succ :: NumChildren -> NumChildren
$cpred :: NumChildren -> NumChildren
pred :: NumChildren -> NumChildren
$ctoEnum :: Int -> NumChildren
toEnum :: Int -> NumChildren
$cfromEnum :: NumChildren -> Int
fromEnum :: NumChildren -> Int
$cenumFrom :: NumChildren -> [NumChildren]
enumFrom :: NumChildren -> [NumChildren]
$cenumFromThen :: NumChildren -> NumChildren -> [NumChildren]
enumFromThen :: NumChildren -> NumChildren -> [NumChildren]
$cenumFromTo :: NumChildren -> NumChildren -> [NumChildren]
enumFromTo :: NumChildren -> NumChildren -> [NumChildren]
$cenumFromThenTo :: NumChildren -> NumChildren -> NumChildren -> [NumChildren]
enumFromThenTo :: NumChildren -> NumChildren -> NumChildren -> [NumChildren]
Enum, (forall (m :: * -> *). Quote m => NumChildren -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
NumChildren -> Code m NumChildren)
-> Lift NumChildren
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => NumChildren -> m Exp
forall (m :: * -> *). Quote m => NumChildren -> Code m NumChildren
$clift :: forall (m :: * -> *). Quote m => NumChildren -> m Exp
lift :: forall (m :: * -> *). Quote m => NumChildren -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => NumChildren -> Code m NumChildren
liftTyped :: forall (m :: * -> *). Quote m => NumChildren -> Code m NumChildren
Lift)
data FailureType
= AlwaysFailing
| FailingNormal
deriving stock (Int -> FailureType -> ShowS
[FailureType] -> ShowS
FailureType -> String
(Int -> FailureType -> ShowS)
-> (FailureType -> String)
-> ([FailureType] -> ShowS)
-> Show FailureType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FailureType -> ShowS
showsPrec :: Int -> FailureType -> ShowS
$cshow :: FailureType -> String
show :: FailureType -> String
$cshowList :: [FailureType] -> ShowS
showList :: [FailureType] -> ShowS
Show, Int -> FailureType
FailureType -> Int
FailureType -> [FailureType]
FailureType -> FailureType
FailureType -> FailureType -> [FailureType]
FailureType -> FailureType -> FailureType -> [FailureType]
(FailureType -> FailureType)
-> (FailureType -> FailureType)
-> (Int -> FailureType)
-> (FailureType -> Int)
-> (FailureType -> [FailureType])
-> (FailureType -> FailureType -> [FailureType])
-> (FailureType -> FailureType -> [FailureType])
-> (FailureType -> FailureType -> FailureType -> [FailureType])
-> Enum FailureType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: FailureType -> FailureType
succ :: FailureType -> FailureType
$cpred :: FailureType -> FailureType
pred :: FailureType -> FailureType
$ctoEnum :: Int -> FailureType
toEnum :: Int -> FailureType
$cfromEnum :: FailureType -> Int
fromEnum :: FailureType -> Int
$cenumFrom :: FailureType -> [FailureType]
enumFrom :: FailureType -> [FailureType]
$cenumFromThen :: FailureType -> FailureType -> [FailureType]
enumFromThen :: FailureType -> FailureType -> [FailureType]
$cenumFromTo :: FailureType -> FailureType -> [FailureType]
enumFromTo :: FailureType -> FailureType -> [FailureType]
$cenumFromThenTo :: FailureType -> FailureType -> FailureType -> [FailureType]
enumFromThenTo :: FailureType -> FailureType -> FailureType -> [FailureType]
Enum, (forall (m :: * -> *). Quote m => FailureType -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
FailureType -> Code m FailureType)
-> Lift FailureType
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FailureType -> m Exp
forall (m :: * -> *). Quote m => FailureType -> Code m FailureType
$clift :: forall (m :: * -> *). Quote m => FailureType -> m Exp
lift :: forall (m :: * -> *). Quote m => FailureType -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FailureType -> Code m FailureType
liftTyped :: forall (m :: * -> *). Quote m => FailureType -> Code m FailureType
Lift)
data IsMichelson
= FromMichelson
| Additional
| Phantom
| Structural
deriving stock (Int -> IsMichelson -> ShowS
[IsMichelson] -> ShowS
IsMichelson -> String
(Int -> IsMichelson -> ShowS)
-> (IsMichelson -> String)
-> ([IsMichelson] -> ShowS)
-> Show IsMichelson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> IsMichelson -> ShowS
showsPrec :: Int -> IsMichelson -> ShowS
$cshow :: IsMichelson -> String
show :: IsMichelson -> String
$cshowList :: [IsMichelson] -> ShowS
showList :: [IsMichelson] -> ShowS
Show, Int -> IsMichelson
IsMichelson -> Int
IsMichelson -> [IsMichelson]
IsMichelson -> IsMichelson
IsMichelson -> IsMichelson -> [IsMichelson]
IsMichelson -> IsMichelson -> IsMichelson -> [IsMichelson]
(IsMichelson -> IsMichelson)
-> (IsMichelson -> IsMichelson)
-> (Int -> IsMichelson)
-> (IsMichelson -> Int)
-> (IsMichelson -> [IsMichelson])
-> (IsMichelson -> IsMichelson -> [IsMichelson])
-> (IsMichelson -> IsMichelson -> [IsMichelson])
-> (IsMichelson -> IsMichelson -> IsMichelson -> [IsMichelson])
-> Enum IsMichelson
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: IsMichelson -> IsMichelson
succ :: IsMichelson -> IsMichelson
$cpred :: IsMichelson -> IsMichelson
pred :: IsMichelson -> IsMichelson
$ctoEnum :: Int -> IsMichelson
toEnum :: Int -> IsMichelson
$cfromEnum :: IsMichelson -> Int
fromEnum :: IsMichelson -> Int
$cenumFrom :: IsMichelson -> [IsMichelson]
enumFrom :: IsMichelson -> [IsMichelson]
$cenumFromThen :: IsMichelson -> IsMichelson -> [IsMichelson]
enumFromThen :: IsMichelson -> IsMichelson -> [IsMichelson]
$cenumFromTo :: IsMichelson -> IsMichelson -> [IsMichelson]
enumFromTo :: IsMichelson -> IsMichelson -> [IsMichelson]
$cenumFromThenTo :: IsMichelson -> IsMichelson -> IsMichelson -> [IsMichelson]
enumFromThenTo :: IsMichelson -> IsMichelson -> IsMichelson -> [IsMichelson]
Enum, (forall (m :: * -> *). Quote m => IsMichelson -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
IsMichelson -> Code m IsMichelson)
-> Lift IsMichelson
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => IsMichelson -> m Exp
forall (m :: * -> *). Quote m => IsMichelson -> Code m IsMichelson
$clift :: forall (m :: * -> *). Quote m => IsMichelson -> m Exp
lift :: forall (m :: * -> *). Quote m => IsMichelson -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => IsMichelson -> Code m IsMichelson
liftTyped :: forall (m :: * -> *). Quote m => IsMichelson -> Code m IsMichelson
Lift)
data HasAnns
= DoesNotHaveAnns
| DoesHaveStandardAnns
| DoesHaveNonStandardAnns
deriving stock (Int -> HasAnns -> ShowS
[HasAnns] -> ShowS
HasAnns -> String
(Int -> HasAnns -> ShowS)
-> (HasAnns -> String) -> ([HasAnns] -> ShowS) -> Show HasAnns
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HasAnns -> ShowS
showsPrec :: Int -> HasAnns -> ShowS
$cshow :: HasAnns -> String
show :: HasAnns -> String
$cshowList :: [HasAnns] -> ShowS
showList :: [HasAnns] -> ShowS
Show, Int -> HasAnns
HasAnns -> Int
HasAnns -> [HasAnns]
HasAnns -> HasAnns
HasAnns -> HasAnns -> [HasAnns]
HasAnns -> HasAnns -> HasAnns -> [HasAnns]
(HasAnns -> HasAnns)
-> (HasAnns -> HasAnns)
-> (Int -> HasAnns)
-> (HasAnns -> Int)
-> (HasAnns -> [HasAnns])
-> (HasAnns -> HasAnns -> [HasAnns])
-> (HasAnns -> HasAnns -> [HasAnns])
-> (HasAnns -> HasAnns -> HasAnns -> [HasAnns])
-> Enum HasAnns
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: HasAnns -> HasAnns
succ :: HasAnns -> HasAnns
$cpred :: HasAnns -> HasAnns
pred :: HasAnns -> HasAnns
$ctoEnum :: Int -> HasAnns
toEnum :: Int -> HasAnns
$cfromEnum :: HasAnns -> Int
fromEnum :: HasAnns -> Int
$cenumFrom :: HasAnns -> [HasAnns]
enumFrom :: HasAnns -> [HasAnns]
$cenumFromThen :: HasAnns -> HasAnns -> [HasAnns]
enumFromThen :: HasAnns -> HasAnns -> [HasAnns]
$cenumFromTo :: HasAnns -> HasAnns -> [HasAnns]
enumFromTo :: HasAnns -> HasAnns -> [HasAnns]
$cenumFromThenTo :: HasAnns -> HasAnns -> HasAnns -> [HasAnns]
enumFromThenTo :: HasAnns -> HasAnns -> HasAnns -> [HasAnns]
Enum, (forall (m :: * -> *). Quote m => HasAnns -> m Exp)
-> (forall (m :: * -> *). Quote m => HasAnns -> Code m HasAnns)
-> Lift HasAnns
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => HasAnns -> m Exp
forall (m :: * -> *). Quote m => HasAnns -> Code m HasAnns
$clift :: forall (m :: * -> *). Quote m => HasAnns -> m Exp
lift :: forall (m :: * -> *). Quote m => HasAnns -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => HasAnns -> Code m HasAnns
liftTyped :: forall (m :: * -> *). Quote m => HasAnns -> Code m HasAnns
Lift)
data InstrClass = InstrClass NumChildren FailureType IsMichelson HasAnns
concatMapM genSingletonsType
[''InstrClass,''NumChildren,''FailureType,''IsMichelson,''HasAnns]
class ClassifyInstr k where
type GetClassified (c :: InstrClass) :: k
getClassified :: SingInstrClass c -> Sing (GetClassified c :: k)
instance ClassifyInstr NumChildren where
type GetClassified ('InstrClass a _ _ _) = a
getClassified :: forall (c :: InstrClass).
SingInstrClass c -> Sing (GetClassified c)
getClassified (SInstrClass Sing n
a Sing n
_ Sing n
_ Sing n
_) = Sing n
Sing (GetClassified c)
a
instance ClassifyInstr FailureType where
type GetClassified ('InstrClass _ a _ _) = a
getClassified :: forall (c :: InstrClass).
SingInstrClass c -> Sing (GetClassified c)
getClassified (SInstrClass Sing n
_ Sing n
a Sing n
_ Sing n
_) = Sing n
Sing (GetClassified c)
a
instance ClassifyInstr IsMichelson where
type GetClassified ('InstrClass _ _ a _) = a
getClassified :: forall (c :: InstrClass).
SingInstrClass c -> Sing (GetClassified c)
getClassified (SInstrClass Sing n
_ Sing n
_ Sing n
a Sing n
_) = Sing n
Sing (GetClassified c)
a
instance ClassifyInstr HasAnns where
type GetClassified ('InstrClass _ _ _ a) = a
getClassified :: forall (c :: InstrClass).
SingInstrClass c -> Sing (GetClassified c)
getClassified (SInstrClass Sing n
_ Sing n
_ Sing n
_ Sing n
a) = Sing n
Sing (GetClassified c)
a