rio-0.1.8.0: A standard library for Haskell

RIO.Partial

Description

Partial functions.

Synopsis

# Documentation

fromJust :: Maybe a -> a #

The fromJust function extracts the element out of a Just and throws an error if its argument is Nothing.

#### Examples

Expand

Basic usage:

>>> fromJust (Just 1)
1

>>> 2 * (fromJust (Just 10))
20

>>> 2 * (fromJust Nothing)
*** Exception: Maybe.fromJust: Nothing


The read function reads input from a string, which must be completely consumed by the input process. read fails with an error if the parse is unsuccessful, and it is therefore discouraged from being used in real applications. Use readMaybe or readEither for safe alternatives.
>>> read "123" :: Int
123

>>> read "hello" :: Int
*** Exception: Prelude.read: no parse

Convert from an Int.