]> gitweb @ CieloNegro.org - hs-rrdtool.git/blob - Types/Data/Maybe.hs
997c93ba77ec81afd3491761e55354ed7b77d387
[hs-rrdtool.git] / Types / Data / Maybe.hs
1 {-# LANGUAGE
2   EmptyDataDecls,
3   TypeFamilies
4   #-}
5 module Types.Data.Maybe
6     ( Maybe
7     , Nothing
8     , Just
9
10     , IsNothing
11     , IsJust
12
13     , FromJust
14     , FromMaybe
15     )
16     where
17
18 import Prelude ()
19 import Types.Data.Bool
20
21
22 data Nothing
23 data Just a
24
25 class    Maybe a
26 instance Maybe Nothing
27 instance Maybe (Just a)
28
29 type family   IsNothing m
30 type instance IsNothing Nothing  = True
31 type instance IsNothing (Just a) = False
32
33 type family   IsJust m
34 type instance IsJust Nothing  = False
35 type instance IsJust (Just a) = True
36
37 type family   FromJust m
38 type instance FromJust (Just a) = a
39
40 type family   FromMaybe a m
41 type instance FromMaybe a Nothing   = a
42 type instance FromMaybe a (Just a') = a'