1 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# LANGUAGE UndecidableInstances #-}
8 module Language.LOL.Symantic.Type.Int where
10 import Data.Maybe (isJust)
11 import Data.Type.Equality ((:~:)(Refl))
13 import Language.LOL.Symantic.Type.Common
14 import Language.LOL.Symantic.Type.Fun
15 import Language.LOL.Symantic.Type.Bool
16 import Language.LOL.Symantic.Type.Var
20 data Type_Int (root:: * -> *) h where
21 Type_Int :: Type_Int root Int
22 type instance Root_of_Type (Type_Int root) = root
23 type instance Error_of_Type ast (Type_Int root) = ()
26 Type_Eq (Type_Int root) where
27 type_eq Type_Int Type_Int = Just Refl
29 Eq (Type_Int root h) where
30 x == y = isJust $ x `type_eq` y
31 instance -- String_from_Type
32 String_from_Type (Type_Int root) where
33 string_from_type Type_Int = "Int"
35 Show (Type_Int root h) where
36 show = string_from_type
38 -- | Convenient alias to include a 'Type_Int' within a type.
39 type_int :: Type_Root_Lift Type_Int root => root Int
40 type_int = type_root_lift Type_Int
42 -- * Type 'Type_Fun_Int'
43 -- | Convenient alias.
45 = Type_Root (Type_Alt Type_Var
46 (Type_Alt (Type_Fun lam)
49 -- * Type 'Type_Fun_Bool_Int'
50 -- | Convenient alias.
51 type Type_Fun_Bool_Int lam
52 = Type_Root (Type_Alt Type_Var
53 (Type_Alt (Type_Fun lam)