| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Michelson.Typed.Arith
Description
Module, containing some boilerplate for support of arithmetic operations in Michelson language.
Synopsis
- class ArithOp aop (n :: T) (m :: T) where
- class UnaryArithOp aop (n :: T) where
- type UnaryArithRes aop n :: T
- evalUnaryArithOp :: proxy aop -> Value' instr n -> Value' instr (UnaryArithRes aop n)
- data ArithError n m
- data ArithErrorType
- data Add
- data Sub
- data Mul
- data Abs
- data Neg
- data Or
- data And
- data Xor
- data Not
- data Lsl
- data Lsr
- data Compare
- data Eq'
- data Neq
- data Lt
- data Gt
- data Le
- data Ge
- compareOp :: forall t i. (Comparable t, SingI t) => Value' i t -> Value' i t -> Integer
Documentation
class ArithOp aop (n :: T) (m :: T) where Source #
Class for binary arithmetic operation.
Takes binary operation marker as op parameter,
types of left operand n and right operand m.
Associated Types
type ArithRes aop n m :: T Source #
Type family ArithRes denotes the type resulting from
computing operation op from operands of types n and m.
For instance, adding integer to natural produces integer,
which is reflected in following instance of type family:
ArithRes Add CNat CInt = CInt.
Methods
convergeArith :: proxy aop -> Notes n -> Notes m -> Either AnnConvergeError (Notes (ArithRes aop n m)) Source #
Converge the notes of given operands.
evalOp :: proxy aop -> Value' instr n -> Value' instr m -> Either (ArithError (Value' instr n) (Value' instr m)) (Value' instr (ArithRes aop n m)) Source #
Evaluate arithmetic operation on given operands.
Instances
class UnaryArithOp aop (n :: T) where Source #
Marker data type for add operation.
Associated Types
type UnaryArithRes aop n :: T Source #
Methods
evalUnaryArithOp :: proxy aop -> Value' instr n -> Value' instr (UnaryArithRes aop n) Source #
Instances
| UnaryArithOp Ge 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Le 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Gt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Lt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Neq 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Eq' 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Not 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Not 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Not 'TBool Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Neg 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Neg 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Abs 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
data ArithError n m Source #
Represents an arithmetic error of the operation.
Constructors
| MutezArithError ArithErrorType n m | |
| ShiftArithError ArithErrorType n m |
Instances
data ArithErrorType Source #
Denotes the error type occured in the arithmetic operation.
Constructors
| AddOverflow | |
| MulOverflow | |
| SubUnderflow | |
| LslOverflow | |
| LsrUnderflow |
Instances
Instances
Instances
Instances
Instances
| UnaryArithOp Abs 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Abs 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Neg 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Neg 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Neg 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Neg 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| ArithOp Or 'TNat 'TNat Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Or -> Notes 'TNat -> Notes 'TNat -> Either AnnConvergeError (Notes (ArithRes Or 'TNat 'TNat)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Or -> Value' instr 'TNat -> Value' instr 'TNat -> Either (ArithError (Value' instr 'TNat) (Value' instr 'TNat)) (Value' instr (ArithRes Or 'TNat 'TNat)) Source # | |
| ArithOp Or 'TBool 'TBool Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Or -> Notes 'TBool -> Notes 'TBool -> Either AnnConvergeError (Notes (ArithRes Or 'TBool 'TBool)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Or -> Value' instr 'TBool -> Value' instr 'TBool -> Either (ArithError (Value' instr 'TBool) (Value' instr 'TBool)) (Value' instr (ArithRes Or 'TBool 'TBool)) Source # | |
| type ArithRes Or 'TNat 'TNat Source # | |
| type ArithRes Or 'TBool 'TBool Source # | |
Instances
Instances
| ArithOp Xor 'TNat 'TNat Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Xor -> Notes 'TNat -> Notes 'TNat -> Either AnnConvergeError (Notes (ArithRes Xor 'TNat 'TNat)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Xor -> Value' instr 'TNat -> Value' instr 'TNat -> Either (ArithError (Value' instr 'TNat) (Value' instr 'TNat)) (Value' instr (ArithRes Xor 'TNat 'TNat)) Source # | |
| ArithOp Xor 'TBool 'TBool Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Xor -> Notes 'TBool -> Notes 'TBool -> Either AnnConvergeError (Notes (ArithRes Xor 'TBool 'TBool)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Xor -> Value' instr 'TBool -> Value' instr 'TBool -> Either (ArithError (Value' instr 'TBool) (Value' instr 'TBool)) (Value' instr (ArithRes Xor 'TBool 'TBool)) Source # | |
| type ArithRes Xor 'TNat 'TNat Source # | |
| type ArithRes Xor 'TBool 'TBool Source # | |
Instances
| UnaryArithOp Not 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Not 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
| UnaryArithOp Not 'TBool Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Not 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Not 'TNat Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Not 'TBool Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| ArithOp Lsl 'TNat 'TNat Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Lsl -> Notes 'TNat -> Notes 'TNat -> Either AnnConvergeError (Notes (ArithRes Lsl 'TNat 'TNat)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Lsl -> Value' instr 'TNat -> Value' instr 'TNat -> Either (ArithError (Value' instr 'TNat) (Value' instr 'TNat)) (Value' instr (ArithRes Lsl 'TNat 'TNat)) Source # | |
| type ArithRes Lsl 'TNat 'TNat Source # | |
Instances
| ArithOp Lsr 'TNat 'TNat Source # | |
Defined in Michelson.Typed.Arith Methods convergeArith :: proxy Lsr -> Notes 'TNat -> Notes 'TNat -> Either AnnConvergeError (Notes (ArithRes Lsr 'TNat 'TNat)) Source # evalOp :: forall proxy (instr :: [T] -> [T] -> Type). proxy Lsr -> Value' instr 'TNat -> Value' instr 'TNat -> Either (ArithError (Value' instr 'TNat) (Value' instr 'TNat)) (Value' instr (ArithRes Lsr 'TNat 'TNat)) Source # | |
| type ArithRes Lsr 'TNat 'TNat Source # | |
Instances
| UnaryArithOp Eq' 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Eq' 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Neq 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Neq 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Lt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Lt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Gt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Gt 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Le 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Le 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
Instances
| UnaryArithOp Ge 'TInt Source # | |
Defined in Michelson.Typed.Arith | |
| type UnaryArithRes Ge 'TInt Source # | |
Defined in Michelson.Typed.Arith | |