A library wrapping
Data.List functions that can throw exceptions, such as
!!. Each unsafe function has up to four variants, e.g. with
- tail :: [a] -> [a], raises an error on
- tailMay :: [a] -> Maybe [a], turns errors into
- tailDef :: [a] -> [a] -> [a], takes a default to return on errors.
- tailNote :: String -> [a] -> [a], takes an extra argument which supplements the error message.
- tailSafe :: [a] -> [a], returns some sensible default if possible,
in the case of
This package is divided into three modules:
Safecontains safe variants of
Safe.Foldablecontains safe variants of
Safe.Exactcreates crashing versions of functions like
zip(errors if the lists are not equal) and
take(errors if there are not enough elements), then wraps them to provide safe variants.