module Copilot.Core.Operators
( Op1 (..)
, Op2 (..)
, Op3 (..)
) where
import Copilot.Core.Type (Type)
import Data.Bits
data Op1 a b where
Not :: Op1 Bool Bool
Abs :: Num a => Type a -> Op1 a a
Sign :: Num a => Type a -> Op1 a a
Recip :: Fractional a => Type a -> Op1 a a
Exp :: Floating a => Type a -> Op1 a a
Sqrt :: Floating a => Type a -> Op1 a a
Log :: Floating a => Type a -> Op1 a a
Sin :: Floating a => Type a -> Op1 a a
Tan :: Floating a => Type a -> Op1 a a
Cos :: Floating a => Type a -> Op1 a a
Asin :: Floating a => Type a -> Op1 a a
Atan :: Floating a => Type a -> Op1 a a
Acos :: Floating a => Type a -> Op1 a a
Sinh :: Floating a => Type a -> Op1 a a
Tanh :: Floating a => Type a -> Op1 a a
Cosh :: Floating a => Type a -> Op1 a a
Asinh :: Floating a => Type a -> Op1 a a
Atanh :: Floating a => Type a -> Op1 a a
Acosh :: Floating a => Type a -> Op1 a a
BwNot :: Bits a => Type a -> Op1 a a
Cast :: (Integral a, Num b) => Type a -> Type b -> Op1 a b
data Op2 a b c where
And :: Op2 Bool Bool Bool
Or :: Op2 Bool Bool Bool
Add :: Num a => Type a -> Op2 a a a
Sub :: Num a => Type a -> Op2 a a a
Mul :: Num a => Type a -> Op2 a a a
Mod :: Integral a => Type a -> Op2 a a a
Div :: Integral a => Type a -> Op2 a a a
Fdiv :: Fractional a => Type a -> Op2 a a a
Pow :: Floating a => Type a -> Op2 a a a
Logb :: Floating a => Type a -> Op2 a a a
Eq :: Eq a => Type a -> Op2 a a Bool
Ne :: Eq a => Type a -> Op2 a a Bool
Le :: Ord a => Type a -> Op2 a a Bool
Ge :: Ord a => Type a -> Op2 a a Bool
Lt :: Ord a => Type a -> Op2 a a Bool
Gt :: Ord a => Type a -> Op2 a a Bool
BwAnd :: Bits a => Type a -> Op2 a a a
BwOr :: Bits a => Type a -> Op2 a a a
BwXor :: Bits a => Type a -> Op2 a a a
BwShiftL :: ( Bits a, Integral b ) => Type a -> Type b -> Op2 a b a
BwShiftR :: ( Bits a, Integral b ) => Type a -> Type b -> Op2 a b a
data Op3 a b c d where
Mux :: Type a -> Op3 Bool a a a