spork-0.4.0: Catch errors from pure computations in a Maybe/Either
Copyright© 2009 Matt Morrow & Dan Peebles © 2013 Liyang HU
Licensesee LICENSE
Maintainerspoon@liyang.hu
Stabilityexperimental
Portabilitynon-portable (Scoped Type Variables)
Safe HaskellNone
LanguageHaskell2010

Control.Spoon

Description

Two functions for catching pureish exceptions in pure values. This library considers pureish to be any error call or undefined, failed pattern matches, arithmetic exceptions, and array bounds exceptions.

Synopsis

Documentation

type Handles a = [Handler (Maybe a)] Source #

spoon :: NFData a => a -> Maybe a Source #

Evaluate a value to normal form and return Nothing if any exceptions are thrown during evaluation. For any error-free value, spoon = Just.

spoonWithHandles :: NFData a => Handles a -> a -> Maybe a Source #

Evaluate a value to normal form and return Nothing if any exceptions are thrown during evaluation. For any error-free value, spoon = Just.

teaspoon :: a -> Maybe a Source #

Like spoon, but only evaluates to WHNF.