error-or-utils-0.1.1: Utilities using ErrorOr datatype
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.ErrorOr.Utils

Description

A few utility functions with improved error reporting.

Synopsis

Documentation

tryRead :: (Read a, Show a, MonadFail m) => String -> m a Source #

A read with better error messages.

lookup :: (OverloadedLookup t k v, Show k, Show t, MonadFail m, Applicative m) => k -> t -> m v Source #

Overloaded lookup with good error messages.

lookupIn :: (OverloadedLookup t k v, Show k, MonadFail m, Applicative m) => Text -> k -> t -> m v Source #

This is a version of lookup for where there is no Show instance for the collection.

class OverloadedLookup t k v | t -> k, t -> v where Source #

A class used to implement lookup and lookupIn.

Methods

overloadedLookup :: k -> t -> Maybe v Source #

Instances

Instances details
Eq k => OverloadedLookup [(k, v)] k v Source # 
Instance details

Defined in Data.ErrorOr.Utils

Methods

overloadedLookup :: k -> [(k, v)] -> Maybe v Source #

Ord k => OverloadedLookup (Map k v) k v Source # 
Instance details

Defined in Data.ErrorOr.Utils

Methods

overloadedLookup :: k -> Map k v -> Maybe v Source #