Library of safe (exception free) functions

Version on this page:0.3.8
Stackage Nightly 2017-08-20:0.3.15
LTS Haskell 9.1:0.3.15
Stackage Nightly 2017-08-20:0.3.15
Latest on Hackage:0.3.15
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.


Changelog for Safe

Support QuickCheck 2.10
#20, fix for GHC 7.10.1
#20, require GHC 7.4 or above
#19, add Safe.Partial exposing a Partial typeclass
#19, add support for GHC call stacks
#16, add Safe succ and pred
#16, add readEitherSafe for better errors than readEither
#14, add Safe zip3Exact
#15, add Safe cycle
#9, add Safe toEnum
#8, remove unnecessary Ord constraints from Foldable functions
Add Def variants of the Exact functions
#6, remove unnecessary Ord constraints from maximumBy/minimumBy
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
#1, improve the string clipping in readNote
#494, add foldl1' wrappings
Add a Safe.Foldable module
Add findJust, safe wrapping of fromJust/find
Start of changelog
Depends on:
Used by 277 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, brittany, 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, eventful-dynamodb, eventful-memory, exact-cover, 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, haskeline-repl, 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, hpqtypes-extras, hs-scrape, hs-snowtify, 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, imprevu, imprevu-happstack, indieweb-algorithms, inilist, intricacy, intro, introduction, iptables-helpers, iptadmin, jmacro, jose, jsons-to-schema, kawaii, kawhi, keystore, legion-extra, lifted-protolude, linode, logic-classes, macbeth-lib, mathgenealogy, mbox, memis, microformats2-parser, midair, minirotate, montage, montage-client, newt, noether, nomyx-api, nomyx-core, nomyx-language, nomyx-library, nomyx-server, nomyx-web, on-a-horse, pager, paypal-rest-client, phoityne, phoityne-vscode, pipeclip, postgrest, preamble, pregame, presto-hdbc, protolude, prove-everywhere-server, 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, rset, rss-conduit, rss2irc, ruff, salvia, salvia-protocol, salvia-sessions, scyther-proof, servant-auth-token-acid, servant-auth-token-leveldb, servant-auth-token-rocksdb, servant-client, servant-haxl-client, servant-server, shadower, shelltestrunner, shopify, skylighting, snap-extras, snaplet-mongoDB, snaplet-persistent, snm, snowtify, source-code-server, spiros, sprinkles, stack, stackage-curator, stackage-types, statistics-linreg, store, structural-induction, syntaxnet-haskell, t3-game, t3-server, tabl, taffybar, tak, tamarin-prover, tamarin-prover-term, tamarin-prover-theory, tamper, th-reify-many, threepenny-gui, tidal, time-warp, trurl, ttask, typerbole, universum, uri, util-plus, virthualenv, waldo, web-fpco, wobsurv, wsedit, xlsx, y0l0bot, yesod-auth, yesod-core, yesod-crud, yesod-platform, yi-keymap-vim, zifter, zifter-cabal, zifter-google-java-format, zifter-hindent, zifter-hlint, zifter-stack, zipkin
comments powered byDisqus