X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Types%2FData%2FMaybe.hs;fp=Types%2FData%2FMaybe.hs;h=997c93ba77ec81afd3491761e55354ed7b77d387;hb=66d175582375d19adfa8747c9e1c468138d47583;hp=0000000000000000000000000000000000000000;hpb=000307857df5266907964aff4ecc9e118314fe3f;p=hs-rrdtool.git diff --git a/Types/Data/Maybe.hs b/Types/Data/Maybe.hs new file mode 100644 index 0000000..997c93b --- /dev/null +++ b/Types/Data/Maybe.hs @@ -0,0 +1,42 @@ +{-# LANGUAGE + EmptyDataDecls, + TypeFamilies + #-} +module Types.Data.Maybe + ( Maybe + , Nothing + , Just + + , IsNothing + , IsJust + + , FromJust + , FromMaybe + ) + where + +import Prelude () +import Types.Data.Bool + + +data Nothing +data Just a + +class Maybe a +instance Maybe Nothing +instance Maybe (Just a) + +type family IsNothing m +type instance IsNothing Nothing = True +type instance IsNothing (Just a) = False + +type family IsJust m +type instance IsJust Nothing = False +type instance IsJust (Just a) = True + +type family FromJust m +type instance FromJust (Just a) = a + +type family FromMaybe a m +type instance FromMaybe a Nothing = a +type instance FromMaybe a (Just a') = a'