morley-1.20.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Typed.Scope.Internal.Comparable

Synopsis

Documentation

type ComparabilityImplies t = (ForbidOp t, ForbidNestedBigMaps t, ForbidTicket t, ForbidSaplingState t, ForbidBigMap t, ForbidContract t, ForbidNonComparable t) Source #

Constraints implied by Comparable. This is a little expensive to carry as the superclass of Comparable, hence these can be brought into scope on demand using comparableImplies.

type family RecSuperC c t where ... Source #

Enforce recursive superclass constraints.

Equations

RecSuperC c (_ t1 t2) = (c t1, c t2) 
RecSuperC c (_ t) = c t 
RecSuperC _ _ = () 

comparabilityPresence :: Sing t -> Maybe (Dict (Comparable t)) Source #

Check if type is comparable or not at runtime. This is a Dict version of checkComparability, so the same caveats apply.

>>> comparabilityPresence STOperation
Nothing
>>> comparabilityPresence STAddress
Just Dict

comparableImplies :: forall t proxy. ForbidNonComparable t => proxy t -> Dict (ComparabilityImplies t) Source #

Produce ComparabilityImplies on demand. Carrying it as Comparable superclasses turns out to be a little expensive, considering we can produce evidence on demand in O(1).

checkComparability :: Sing t -> Comparability t Source #

Check if type is comparable or not at runtime. This traverses the singleton, so it has a considerable runtime cost. If you just need to convince GHC, you may be looking for comparableImplies, or perhaps withDeMorganScope.

>>> checkComparability STOperation
CannotBeCompared
>>> checkComparability STAddress
CanBeCompared