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