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