{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-missing-methods #-} module Language.Symantic.Type.Unit where import Data.Maybe (isJust) import Data.Type.Equality ((:~:)(Refl)) import Language.Symantic.Type.Common -- * Type 'Type_Unit' -- | The unit type. data Type_Unit (root:: * -> *) h where Type_Unit :: Type_Unit root () type instance Root_of_Type (Type_Unit root) = root type instance Error_of_Type ast (Type_Unit root) = No_Error_Type instance -- Eq_Type Eq_Type (Type_Unit root) where eq_type Type_Unit Type_Unit = Just Refl instance -- Eq Eq (Type_Unit root h) where x == y = isJust $ x `eq_type` y instance -- String_from_Type String_from_Type (Type_Unit root) where string_from_type Type_Unit = "Unit" instance -- Show Show (Type_Unit root h) where show = string_from_type instance Constraint_Type Eq (Type_Unit root) where constraint_type _c Type_Unit = Just Dict instance Constraint_Type Ord (Type_Unit root) where constraint_type _c Type_Unit = Just Dict instance Unlift_Type1 Type_Unit instance Eq_Type1 (Type_Unit root) -- | Convenient alias to include a 'Type_Unit' within a type. type_unit :: Type_Root_Lift Type_Unit root => root () type_unit = type_root_lift Type_Unit