Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.Utils.Empty

Description

An empty type with some useful instances.

Synopsis

Documentation

data Empty Source #

A type with no inhabitants.

Note that Empty and Void are NOT interchangable, as they have different NFData instances. In particular, the NFData instance for Void forces the value. This is typically not desirable, as we often want to use Empty as a proxy for an __IMPOSSIBLE__.

Instances

Instances details
NFData Empty Source #

Values of type Empty are not forced.

Instance details

Defined in Mikan.Utils.Empty

Methods

rnf :: Empty -> () #

Show Empty Source # 
Instance details

Defined in Mikan.Utils.Empty

Methods

showsPrec :: Int -> Empty -> ShowS #

show :: Empty -> String #

showList :: [Empty] -> ShowS #

Eq Empty Source # 
Instance details

Defined in Mikan.Utils.Empty

Methods

(==) :: Empty -> Empty -> Bool #

(/=) :: Empty -> Empty -> Bool #

Ord Empty Source # 
Instance details

Defined in Mikan.Utils.Empty

Methods

compare :: Empty -> Empty -> Ordering #

(<) :: Empty -> Empty -> Bool #

(<=) :: Empty -> Empty -> Bool #

(>) :: Empty -> Empty -> Bool #

(>=) :: Empty -> Empty -> Bool #

max :: Empty -> Empty -> Empty #

min :: Empty -> Empty -> Empty #

absurd :: Empty -> a Source #

Force an Empty.

toImpossible :: Empty -> IO Impossible Source #

toImpossible e extracts the Impossible value raised via __IMPOSSIBLE__ to create the element e of type Empty.

It proceeds by evaluating e to weak head normal form and catching the exception. We are forced to wrap things in a Maybe because of catchImpossible's type.