Safe Haskell  SafeInferred 

A library for safe functions, based on standard functions that may crash.
In general, each unsafe function has up to 4 forms.
Since tail
has all the possible forms, it is fully documented.
The others all follow the same pattern.

Note
, takes an extra argument which supplements the error message,tailNote

Def
, take an extra argument to give when a crash would otherwise happen,tailDef

May
, wraps the result in a Maybe,tailMay

Safe
, returns a default type if possible,tailSafe
This library also introduces three brand new functions:

at
 synonym for(!!)

lookupJust
 defined aslookupJust k = fromJust . lookup k

findJust
 defined asfindJust f = fromJust . find f

abort
 same aserror
, but different intended meaning
 tailDef :: [a] > [a] > [a]
 tailMay :: [a] > Maybe [a]
 tailNote :: String > [a] > [a]
 tailSafe :: [a] > [a]
 initDef :: [a] > [a] > [a]
 initMay :: [a] > Maybe [a]
 initNote :: String > [a] > [a]
 initSafe :: [a] > [a]
 headDef :: a > [a] > a
 headMay :: [a] > Maybe a
 headNote :: String > [a] > a
 lastDef :: a > [a] > a
 lastMay :: [a] > Maybe a
 lastNote :: String > [a] > a
 minimumDef :: Ord a => a > [a] > a
 minimumMay :: Ord a => [a] > Maybe a
 minimumNote :: Ord a => String > [a] > a
 maximumDef :: Ord a => a > [a] > a
 maximumMay :: Ord a => [a] > Maybe a
 maximumNote :: Ord a => String > [a] > a
 foldr1Def :: a > (a > a > a) > [a] > a
 foldr1May :: (a > a > a) > [a] > Maybe a
 foldr1Note :: String > (a > a > a) > [a] > a
 foldl1Def :: a > (a > a > a) > [a] > a
 foldl1May :: (a > a > a) > [a] > Maybe a
 foldl1Note :: String > (a > a > a) > [a] > a
 foldl1Def' :: a > (a > a > a) > [a] > a
 foldl1May' :: (a > a > a) > [a] > Maybe a
 foldl1Note' :: String > (a > a > a) > [a] > a
 fromJustDef :: a > Maybe a > a
 fromJustNote :: String > Maybe a > a
 assertNote :: String > Bool > a > a
 at :: [a] > Int > a
 atDef :: a > [a] > Int > a
 atMay :: [a] > Int > Maybe a
 atNote :: String > [a] > Int > a
 readDef :: Read a => a > String > a
 readMay :: Read a => String > Maybe a
 readNote :: Read a => String > String > a
 lookupJust :: Eq a => a > [(a, b)] > b
 lookupJustDef :: Eq a => b > a > [(a, b)] > b
 lookupJustNote :: Eq a => String > a > [(a, b)] > b
 findJust :: (a > Bool) > [a] > a
 findJustDef :: a > (a > Bool) > [a] > a
 findJustNote :: String > (a > Bool) > [a] > a
 abort :: String > a
Documentation
tailNote :: String > [a] > [a]Source
tail "help me" [] = error "Pattern match failure, tail [], help me" tail "help me" [1,3,4] = [3,4]
minimumDef :: Ord a => a > [a] > aSource
minimumMay :: Ord a => [a] > Maybe aSource
minimumNote :: Ord a => String > [a] > aSource
maximumDef :: Ord a => a > [a] > aSource
maximumMay :: Ord a => [a] > Maybe aSource
maximumNote :: Ord a => String > [a] > aSource
foldr1Note :: String > (a > a > a) > [a] > aSource
foldl1Note :: String > (a > a > a) > [a] > aSource
foldl1Def' :: a > (a > a > a) > [a] > aSource
foldl1May' :: (a > a > a) > [a] > Maybe aSource
foldl1Note' :: String > (a > a > a) > [a] > aSource
fromJustDef :: a > Maybe a > aSource
See fromMaybe
fromJustNote :: String > Maybe a > aSource
assertNote :: String > Bool > a > aSource
lookupJust :: Eq a => a > [(a, b)] > bSource
lookupJust key = fromJust . lookup key
lookupJustDef :: Eq a => b > a > [(a, b)] > bSource
lookupJustNote :: Eq a => String > a > [(a, b)] > bSource
findJustDef :: a > (a > Bool) > [a] > aSource
findJustNote :: String > (a > Bool) > [a] > aSource