-- | Functions for the 'Defined' type.

module Data.Defined where

import FFI

-- | Convert from defined to maybe.
fromDefined :: Defined a -> Maybe a
fromDefined :: Defined a -> Maybe a
fromDefined (Defined a
x) = a -> Maybe a
forall a. a -> Maybe a
Just a
x
fromDefined Defined a
Undefined = Maybe a
forall a. Maybe a
Nothing

-- | Convert from maybe to defined.
toDefined :: Maybe a -> Defined a
toDefined :: Maybe a -> Defined a
toDefined (Just a
x) = a -> Defined a
forall a. a -> Defined a
Defined a
x
toDefined Maybe a
Nothing = Defined a
forall a. Defined a
Undefined