envparse-0.4: Parse environment variables

Safe HaskellSafe
LanguageHaskell2010

Env.Internal.Error

Description

This module contains an extensible error infrastructure.

Each kind of errors gets a separate type class which encodes a Prism (roughly a getter and a constructor). The Readers, then, have the constraints for precisely the set of errors they can return.

Synopsis

Documentation

data Error #

The type of errors returned by envparse's Readers. These fall into 3 categories:

  • Variables that are unset in the environment.
  • Variables whose value is empty.
  • Variables whose value cannot be parsed using the Read instance.

Instances

Eq Error # 

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Show Error # 

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

AsUnread Error # 
AsEmpty Error # 

Methods

empty :: Error #

tryEmpty :: Error -> Maybe () #

AsUnset Error # 

Methods

unset :: Error #

tryUnset :: Error -> Maybe () #

class AsUnset e where #

The class of types that contain and can be constructed from the error returned from parsing unset variables.

Minimal complete definition

unset, tryUnset

Methods

unset :: e #

tryUnset :: e -> Maybe () #

Instances

AsUnset Error # 

Methods

unset :: Error #

tryUnset :: Error -> Maybe () #

class AsEmpty e where #

The class of types that contain and can be constructed from the error returned from parsing variables whose value is empty.

Minimal complete definition

empty, tryEmpty

Methods

empty :: e #

tryEmpty :: e -> Maybe () #

Instances

AsEmpty Error # 

Methods

empty :: Error #

tryEmpty :: Error -> Maybe () #

class AsUnread e where #

The class of types that contain and can be constructed from the error returned from parsing variable whose value cannot be parsed using the Read instance.

Minimal complete definition

unread, tryUnread

Methods

unread :: String -> e #

tryUnread :: e -> Maybe String #

Instances