rio-0.1.11.0: A standard library for Haskell

Safe HaskellSafe
LanguageHaskell2010

RIO.Partial

Description

Partial functions. Import as:

import qualified RIO.Partial as RIO'
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

read :: Read a => String -> a #

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

toEnum :: Enum a => Int -> a #

Convert from an Int.

pred :: Enum a => a -> a #

the predecessor of a value. For numeric types, pred subtracts 1.

succ :: Enum a => a -> a #

the successor of a value. For numeric types, succ adds 1.