module Lorentz.Constraints.Derivative
( NiceParameterFull
, DupableDecision (..)
, decideOnDupable
) where
import Lorentz.Constraints.Scopes
import Lorentz.Entrypoints.Core
import Michelson.Typed.Haskell.Value
import Michelson.Typed.Scope
type NiceParameterFull cp = (Typeable cp, ParameterDeclaresEntrypoints cp)
data DupableDecision a
= Dupable a => IsDupable
| IsNotDupable
decideOnDupable
:: forall a. (KnownValue a) => DupableDecision a
decideOnDupable :: DupableDecision a
decideOnDupable =
case CheckScope (DupableScope (ToT a)) =>
Either BadTypeForScope (Dict (DupableScope (ToT a)))
forall (c :: Constraint).
CheckScope c =>
Either BadTypeForScope (Dict c)
checkScope @(DupableScope (ToT a)) of
Right Dict (DupableScope (ToT a))
Dict -> DupableDecision a
forall a. Dupable a => DupableDecision a
IsDupable
Left BadTypeForScope
_ -> DupableDecision a
forall a. DupableDecision a
IsNotDupable