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