{-# LANGUAGE TemplateHaskellQuotes #-} module Data.Array.Nested.Internal.Arith.Lists where import Data.Int import Language.Haskell.TH data Commutative = Comm | NonComm deriving (Show, Eq) data ArithType = ArithType { atType :: Name -- ''Int32 , atCName :: String -- "i32" } typesList :: [ArithType] typesList = [ArithType ''Int32 "i32" ,ArithType ''Int64 "i64" ,ArithType ''Float "float" ,ArithType ''Double "double" ] data ArithBOp = ArithBOp { aboName :: String -- "add" , aboComm :: Commutative -- Comm , aboScalFun :: ArithType -> Name -- \_ -> '(+) } binopsList :: [ArithBOp] binopsList = [ArithBOp "add" Comm (\_ -> '(+)) ,ArithBOp "sub" NonComm (\_ -> '(-)) ,ArithBOp "mul" Comm (\_ -> '(*)) ] data ArithUOp = ArithUOp { auoName :: String -- "neg" } unopsList :: [ArithUOp] unopsList = [ArithUOp "neg" ,ArithUOp "abs" ,ArithUOp "signum" ]