{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} module Language.Symantic.Type.Int where import Data.Maybe (isJust) import Data.Type.Equality ((:~:)(Refl)) import Language.Symantic.Type.Common import Language.Symantic.Type.Fun import Language.Symantic.Type.Bool import Language.Symantic.Type.Var -- * Type 'Type_Int' -- | The 'Int' type. data Type_Int (root:: * -> *) h where Type_Int :: Type_Int root Int type instance Root_of_Type (Type_Int root) = root type instance Error_of_Type ast (Type_Int root) = No_Error_Type instance -- Type_Eq Type_Eq (Type_Int root) where type_eq Type_Int Type_Int = Just Refl instance -- Eq Eq (Type_Int root h) where x == y = isJust $ x `type_eq` y instance -- String_from_Type String_from_Type (Type_Int root) where string_from_type Type_Int = "Int" instance -- Show Show (Type_Int root h) where show = string_from_type instance Type_Constraint Eq (Type_Int root) where type_constraint _c Type_Int = Just Dict instance Type_Constraint Ord (Type_Int root) where type_constraint _c Type_Int = Just Dict -- | Convenient alias to include a 'Type_Int' within a type. type_int :: Type_Root_Lift Type_Int root => root Int type_int = type_root_lift Type_Int -- * Type 'Type_Fun_Int' -- | Convenient alias. type Type_Fun_Int lam = Type_Root (Type_Alt Type_Var (Type_Alt (Type_Fun lam) Type_Int)) -- * Type 'Type_Fun_Bool_Int' -- | Convenient alias. type Type_Fun_Bool_Int lam = Type_Root (Type_Alt Type_Var (Type_Alt (Type_Fun lam) (Type_Alt Type_Bool Type_Int)))