Package Info

ghc-safe


Library of safe (exception free) functions


Unspecified

A library wrapping 'Prelude'/'Data.List' functions that can throw exceptions, such as 'head' and '!!'. Each unsafe function has up to four variants, e.g. with 'tail':

  • 'tail :: [a] -> [a]', raises an error on 'tail []'.

  • 'tailMay :: [a] -> /Maybe/ [a]', turns errors into 'Nothing'.

  • '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 'tail'.

This package is divided into three modules:

  • "Safe" contains safe variants of 'Prelude' and 'Data.List' functions.

  • "Safe.Foldable" contains safe variants of 'Foldable' functions.

  • "Safe.Exact" creates 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.


License: BSD-3-Clause
URL: https://hackage.haskell.org/package/safe

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
0.3.19-150500.1.1 info GA Release 2022-12-13 15 SP5 Subpackages
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.19-bp154.1.12 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.18-bp153.1.20 info GA Release 2021-04-08 15 SP3
  • AArch64
  • ppc64le
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.18-bp152.1.16 info GA Release 2020-06-16 15 SP2
  • AArch64
  • ppc64le
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.17-bp151.2.2 info GA Release 2019-07-17 15 SP1
  • ppc64le
  • s390x
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.17-bp151.1.12 info GA Release 2019-05-31 15 SP1
  • AArch64
  • ghc-safe
  • ghc-safe-devel
0.3.15-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • x86-64
  • ghc-safe
  • ghc-safe-devel
0.3.9-2.5 info 5585 2016-09-14 12 GA-SP5
  • ppc64le
  • ghc-safe
  • ghc-safe-devel
0.3.9-2.12 info 5585 2016-09-14 12 GA-SP5
  • AArch64
  • s390x
  • x86-64
  • ghc-safe
  • ghc-safe-devel