module CC.Backend.Dumb(builtins) where import qualified Data.Map.Strict as Map import CC.AST.Typed import CC.Context builtins :: Builtins builtins = let values = Map.fromList [ ("print", TInt ==> TTup []) , ("fst", TTup [t1, t2] ==> t1) , ("snd", TTup [t1, t2] ==> t2) , ("_add", TInt ==> TInt ==> TInt) , ("_sub", TInt ==> TInt ==> TInt) , ("_mul", TInt ==> TInt ==> TInt) ] prelude = "type Nil = ()\n\ \type Cons a = (a, List a)\n\ \alias List a = { Nil | Cons a }\n" in Builtins values prelude where t1 = TyVar Instantiable 1 t2 = TyVar Instantiable 2 infixr ==> (==>) = TFun