-- | Nullable functions.

module Data.Nullable where

import FFI
import Prelude

-- | Convert from nullable to maybe.
fromNullable :: Nullable a -> Maybe a
fromNullable :: Nullable a -> Maybe a
fromNullable (Nullable a
x) = a -> Maybe a
forall a. a -> Maybe a
Just a
x
fromNullable Nullable a
Null = Maybe a
forall a. Maybe a
Nothing

-- | Convert from maybe to nullable.
toNullable :: Maybe a -> Nullable a
toNullable :: Maybe a -> Nullable a
toNullable (Just a
x) = a -> Nullable a
forall a. a -> Nullable a
Nullable a
x
toNullable Maybe a
Nothing = Nullable a
forall a. Nullable a
Null