]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Int.hs
factorizing Type1_From ast Type0
[haskell/symantic.git] / Language / Symantic / Type / Int.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE PatternSynonyms #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# OPTIONS_GHC -fno-warn-orphans #-}
8 module Language.Symantic.Type.Int where
9
10 import qualified Data.MonoTraversable as MT
11 import Data.Proxy
12
13 import Language.Symantic.Type.Root
14 import Language.Symantic.Type.Type0
15 import Language.Symantic.Type.Constraint
16 import Language.Symantic.Type.Family
17
18 -- * Type 'Type_Int'
19 -- | The 'Int' type.
20 type Type_Int = Type0 (Proxy Int)
21
22 pattern Type_Int :: Type_Int root Int
23 pattern Type_Int = Type0 Proxy
24
25 instance Type0_Constraint Eq (Type_Int root) where
26 type0_constraint _c Type0{} = Just Dict
27 instance Type0_Constraint Ord (Type_Int root) where
28 type0_constraint _c Type0{} = Just Dict
29 instance Type0_Constraint Monoid (Type_Int root)
30 instance Type0_Constraint Num (Type_Int root) where
31 type0_constraint _c Type0{} = Just Dict
32 instance Type0_Constraint Integral (Type_Int root) where
33 type0_constraint _c Type0{} = Just Dict
34 instance Type0_Family Type_Family_MonoElement (Type_Int root)
35 instance Type0_Constraint MT.MonoFunctor (Type_Int root)
36 instance String_from_Type (Type_Int root) where
37 string_from_type _ = "Int"
38
39 -- | Inject 'Type_Int' within a root type.
40 type_int :: Type_Root_Lift Type_Int root => root Int
41 type_int = type0