]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Integer.hs
MonoFunctor
[haskell/symantic.git] / Language / Symantic / Type / Integer.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.Integer 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
16 -- * Type 'Type_Integer'
17 -- | The 'Integer' type.
18 type Type_Integer = Type_Type0 (Proxy Integer)
19
20 pattern Type_Integer :: Type_Integer root Integer
21 pattern Type_Integer = Type_Type0 Proxy
22
23 instance Constraint_Type Eq (Type_Integer root) where
24 constraint_type _c Type_Type0{} = Just Dict
25 instance Constraint_Type Ord (Type_Integer root) where
26 constraint_type _c Type_Type0{} = Just Dict
27 instance Constraint_Type Monoid (Type_Integer root)
28 instance Constraint_Type Num (Type_Integer root) where
29 constraint_type _c Type_Type0{} = Just Dict
30 instance Constraint_Type Integral (Type_Integer root) where
31 constraint_type _c Type_Type0{} = Just Dict
32 instance Constraint_Type MT.MonoFunctor (Type_Integer root)
33 instance String_from_Type (Type_Integer root) where
34 string_from_type _ = "Integer"
35
36 -- | Inject 'Type_Integer' within a root type.
37 type_integer :: Lift_Type_Root Type_Integer root => root Integer
38 type_integer = type_type0