1 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 module Language.Symantic.Type.Int where
9 import Data.Maybe (isJust)
10 import Data.Type.Equality ((:~:)(Refl))
12 import Language.Symantic.Type.Common
13 import Language.Symantic.Type.Fun
14 import Language.Symantic.Type.Bool
15 import Language.Symantic.Type.Var
19 data Type_Int (root:: * -> *) h where
20 Type_Int :: Type_Int root Int
21 type instance Root_of_Type (Type_Int root) = root
22 type instance Error_of_Type ast (Type_Int root) = No_Error_Type
25 Type_Eq (Type_Int root) where
26 type_eq Type_Int Type_Int = Just Refl
28 Eq (Type_Int root h) where
29 x == y = isJust $ x `type_eq` y
30 instance -- String_from_Type
31 String_from_Type (Type_Int root) where
32 string_from_type Type_Int = "Int"
34 Show (Type_Int root h) where
35 show = string_from_type
36 instance Type_Constraint Eq (Type_Int root) where
37 type_constraint _c Type_Int = Just Dict
38 instance Type_Constraint Ord (Type_Int root) where
39 type_constraint _c Type_Int = Just Dict
41 -- | Convenient alias to include a 'Type_Int' within a type.
42 type_int :: Type_Root_Lift Type_Int root => root Int
43 type_int = type_root_lift Type_Int
45 -- * Type 'Type_Fun_Int'
46 -- | Convenient alias.
48 = Type_Root (Type_Alt Type_Var
49 (Type_Alt (Type_Fun lam)
52 -- * Type 'Type_Fun_Bool_Int'
53 -- | Convenient alias.
54 type Type_Fun_Bool_Int lam
55 = Type_Root (Type_Alt Type_Var
56 (Type_Alt (Type_Fun lam)