]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Bool.hs
init
[haskell/symantic.git] / Language / Symantic / Type / Bool.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE GADTs #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# LANGUAGE TypeOperators #-}
8 {-# OPTIONS_GHC -fno-warn-missing-methods #-}
9 module Language.Symantic.Type.Bool where
10
11 import Data.Maybe (isJust)
12 import Data.Type.Equality ((:~:)(Refl))
13
14 import Language.Symantic.Type.Common
15
16 -- * Type 'Type_Bool'
17 -- | The 'Bool' type.
18 data Type_Bool (root:: * -> *) h where
19 Type_Bool :: Type_Bool root Bool
20 type instance Root_of_Type (Type_Bool root) = root
21 type instance Error_of_Type ast (Type_Bool root) = No_Error_Type
22
23 instance -- Eq_Type
24 Eq_Type (Type_Bool root) where
25 eq_type Type_Bool Type_Bool = Just Refl
26 instance -- Eq
27 Eq (Type_Bool root h) where
28 x == y = isJust $ x `eq_type` y
29 instance -- String_from_Type
30 String_from_Type (Type_Bool root) where
31 string_from_type Type_Bool = "Bool"
32 instance -- Show
33 Show (Type_Bool root h) where
34 show = string_from_type
35 instance Constraint_Type Eq (Type_Bool root) where
36 constraint_type _c Type_Bool = Just Dict
37 instance Constraint_Type Ord (Type_Bool root) where
38 constraint_type _c Type_Bool = Just Dict
39 instance Unlift_Type1 Type_Bool
40 instance Eq_Type1 (Type_Bool root)
41
42 -- | Convenient alias to include a 'Type_Bool' within a type.
43 type_bool :: Type_Root_Lift Type_Bool root => root Bool
44 type_bool = type_root_lift Type_Bool