safe

Library of safe (exception free) functions https://github.com/ndmitchell/safe#readme

Version on this page:0.3.8
LTS Haskell 8.2:0.3.14
Stackage Nightly 2017-02-20:0.3.14
Latest on Hackage:0.3.14
BSD3 licensed and maintained by Neil Mitchell

Module documentation for 0.3.8

There are no documented modules for this package.

Safe Hackage version Build Status

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.

Changes

Changelog for Safe

0.3.14
#20, fix for GHC 7.10.1
0.3.13
#20, require GHC 7.4 or above
0.3.12
#19, add Safe.Partial exposing a Partial typeclass
#19, add support for GHC call stacks
0.3.11
#16, add Safe succ and pred
#16, add readEitherSafe for better errors than readEither
#14, add Safe zip3Exact
0.3.10
#15, add Safe cycle
0.3.9
#9, add Safe toEnum
0.3.8
#8, remove unnecessary Ord constraints from Foldable functions
0.3.7
Add Def variants of the Exact functions
0.3.6
#6, remove unnecessary Ord constraints from maximumBy/minimumBy
0.3.5
Add Safe elemIndexJust/findIndexJust functions
Add Safe scan functions
Add Safe minimumBy/maximumBy functions
Add a module of Exact functions
Add Foldable minimum functions
Clean up the Foldable module, deprecate the Safe variants
0.3.4
#1, improve the string clipping in readNote
0.3.3
#494, add foldl1' wrappings
0.3.2
Add a Safe.Foldable module
0.3.1
Add findJust, safe wrapping of fromJust/find
0.3
Start of changelog
Depends on:
Used by 246 packages:
BlogLiterately-diagrams, Coadjute, DP, DarcsHelpers, Deadpan-DDP, GoogleCodeJam, HGE2D, HStringTemplateHelpers, Lykah, MailchimpSimple, Nomyx, Nomyx-Core, Nomyx-Language, Nomyx-Rules, Nomyx-Web, Tic-Tac-Toe, acid-state-dist, agentx, amby, antigate, api-tools, arena, arion, authoring, avers, aws, aws-elastic-transcoder, aws-sdk, aws-sdk-text-converter, aws-sign4, bake, basic-prelude, black-jewel, blacktip, blaze-html-contrib, buchhaltung, cblrepo, cgen, cgrep, chorale, citation-resolve, clac, clanki, cmaes, codecov-haskell, concorde, conduit-parse, configifier, convert-annotation, crockford, csv-enumerator, cubicspline, cursedcsv, darcsden, darcswatch, data-easy, data-structure-inferrer, data-variant, dequeue, dicom, digestive-functors-aeson, dns, doi, draw-poker, dustme, easy-bitcoin, ecma262, eddie, errors, exference, fastedit, fay, fay-builder, fpco-api, ftdi, geek, gendocs, ghc-imported-from, ghc-mod, ginger, git-sanity, gitignore, gitit, goat, graph-core, grasp, gridland, hack2-handler-mongrel2-http, hack2-interface-wai, halberd, happs-tutorial, happstack-helpers, haskell-aliyun, haskell-gi, haskell-tools-ast-fromghc, haskell-tools-backend-ghc, haskellscrabble, haskoon, hbro, hbro-contrib, hdbi-postgresql, hellage, hellnet, hipbot, hledger, hledger-api, hledger-chart, hledger-lib, hledger-ui, hledger-vty, hledger-web, hmark, hmt, hold-em, hpaco-lib, hpaste, hpasteit, hpc-coveralls, hs-scrape, hsc3, hsc3-data, hsc3-db, hsc3-lisp, hscurses-fish-ex, hsenv, hspec-stack-rerun, hstradeking, http-trace, httpspec, hw-bits, hw-eliasfano, hw-excess, hw-packed-vector, hw-rankselect-base, idris, indieweb-algorithms, inilist, intricacy, intro, introduction, iptables-helpers, iptadmin, jmacro, jose, kawaii, kawhi, keystore, legion-extra, lifted-protolude, linode, logic-classes, macbeth-lib, mathgenealogy, mbox, memis, microformats2-parser, midair, minirotate, montage, montage-client, newt, on-a-horse, pager, paypal-rest-client, phoityne, phoityne-vscode, pipeclip, postgrest, preamble, pregame, presto-hdbc, protolude, prove-everywhere-server, pub, puffytools, pure-io, purescript, pushme, putlenses, quenya-verb, quickbench, reflex-dom, reflex-dom-contrib, respond, rest-core, rest-example, rest-gen, rest-snap, roundtrip, roundtrip-xml, rss-conduit, rss2irc, ruff, salvia, salvia-protocol, salvia-sessions, scyther-proof, servant-auth-token-acid, servant-client, servant-haxl-client, servant-server, shadower, shelltestrunner, skylighting, snap-extras, snaplet-mongoDB, snaplet-persistent, snm, source-code-server, sprinkles, stack, stackage-curator, stackage-types, statistics-linreg, store, structural-induction, t3-game, t3-server, tabl, taffybar, tak, tamarin-prover, tamarin-prover-term, tamarin-prover-theory, tamper, th-reify-many, threepenny-gui, time-warp, trurl, ttask, typerbole, universum, uri, virthualenv, web-fpco, wobsurv, wsedit, xlsx, y0l0bot, yesod-auth, yesod-core, yesod-crud, yesod-platform, yi-core, yi-keymap-vim, zipkin
comments powered byDisqus