{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} module Language.LOL.Symantic.Type.Unit where import Data.Maybe (isJust) import Data.Type.Equality ((:~:)(Refl)) import Language.LOL.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) = () instance -- Type_Eq Type_Eq (Type_Unit root) where type_eq Type_Unit Type_Unit = Just Refl instance -- Eq Eq (Type_Unit root h) where x == y = isJust $ x `type_eq` 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 Type_Constraint Eq (Type_Unit root) where type_constraint _c Type_Unit = Just Dict instance Type_Constraint Ord (Type_Unit root) where type_constraint _c Type_Unit = Just Dict -- | 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