1 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# LANGUAGE TypeOperators #-}
8 module Language.Symantic.Type.Bool where
10 import Data.Maybe (isJust)
11 import Data.Type.Equality ((:~:)(Refl))
13 import Language.Symantic.Type.Common
17 data Type_Bool (root:: * -> *) h where
18 Type_Bool :: Type_Bool root Bool
19 type instance Root_of_Type (Type_Bool root) = root
20 type instance Error_of_Type ast (Type_Bool root) = No_Error_Type
23 Type_Eq (Type_Bool root) where
24 type_eq Type_Bool Type_Bool = Just Refl
26 Eq (Type_Bool root h) where
27 x == y = isJust $ x `type_eq` y
28 instance -- String_from_Type
29 String_from_Type (Type_Bool root) where
30 string_from_type Type_Bool = "Bool"
32 Show (Type_Bool root h) where
33 show = string_from_type
34 instance Type_Constraint Eq (Type_Bool root) where
35 type_constraint _c Type_Bool = Just Dict
36 instance Type_Constraint Ord (Type_Bool root) where
37 type_constraint _c Type_Bool = Just Dict
39 -- | Convenient alias to include a 'Type_Bool' within a type.
40 type_bool :: Type_Root_Lift Type_Bool root => root Bool
41 type_bool = type_root_lift Type_Bool