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