]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Maybe.hs
init
[haskell/symantic.git] / Language / Symantic / Type / Maybe.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE TypeFamilies #-}
4 {-# OPTIONS_GHC -fno-warn-orphans #-}
5 module Language.Symantic.Type.Maybe where
6
7 import Data.Proxy
8
9 import Language.Symantic.Type.Common
10
11 -- * Type 'Type_Maybe'
12 -- | The 'Maybe' type.
13 type Type_Maybe = Type_Type1 Maybe
14
15 instance -- String_from_Type
16 String_from_Type root =>
17 String_from_Type (Type_Maybe root) where
18 string_from_type (Type_Type1 _f a) =
19 "Maybe" ++ " (" ++ string_from_type a ++ ")"
20
21 -- | Inject a 'Type_Maybe' within a root type.
22 type_maybe
23 :: Lift_Type_Root Type_Maybe root
24 => root h_a
25 -> root (Maybe h_a)
26 type_maybe = lift_type_root . Type_Type1 (Proxy::Proxy Maybe)