{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-missing-methods #-} -- | Type variable. module Language.Symantic.Type.Var ( module Language.Symantic.Type.Var , module Language.Symantic.Lib.Data.Peano ) where import Data.Maybe (isJust) import Language.Symantic.Type.Common import Language.Symantic.Lib.Data.Peano -- * Type 'Type_Var' -- | The variable type. data Type_Var (root:: * -> *) p where Type_Var :: SPeano p -> Type_Var root p type instance Root_of_Type (Type_Var root) = root type instance Error_of_Type ast (Type_Var root) = No_Error_Type instance -- Eq_Type Eq_Type (Type_Var root) where eq_type (Type_Var x) (Type_Var y) = x `peano_eq` y instance -- Eq Eq (Type_Var root h) where x == y = isJust $ x `eq_type` y instance -- String_from_Type String_from_Type (Type_Var root) where string_from_type (Type_Var p) = "t" ++ show (integral_from_peano p::Integer) instance -- Show Show (Type_Var root h) where show = string_from_type instance Constraint_Type Eq (Type_Var root) instance Constraint_Type Ord (Type_Var root) instance Unlift_Type1 Type_Var instance Eq_Type1 (Type_Var root) -- | Convenient alias to include a 'Type_Var' within a type. type_var :: Lift_Type_Root Type_Var root => SPeano p -> root p type_var = lift_type_root . Type_Var