reform-0.2.7.4: reform is a type-safe HTML form generation and validation library

Safe HaskellSafe
LanguageHaskell98

Text.Reform.Result

Description

Module for the core result type, and related functions

Synopsis

Documentation

data Result e ok Source #

Type for failing computations

Constructors

Error [(FormRange, e)] 
Ok ok 
Instances
Monad (Result e) Source # 
Instance details

Defined in Text.Reform.Result

Methods

(>>=) :: Result e a -> (a -> Result e b) -> Result e b #

(>>) :: Result e a -> Result e b -> Result e b #

return :: a -> Result e a #

fail :: String -> Result e a #

Functor (Result e) Source # 
Instance details

Defined in Text.Reform.Result

Methods

fmap :: (a -> b) -> Result e a -> Result e b #

(<$) :: a -> Result e b -> Result e a #

Applicative (Result e) Source # 
Instance details

Defined in Text.Reform.Result

Methods

pure :: a -> Result e a #

(<*>) :: Result e (a -> b) -> Result e a -> Result e b #

liftA2 :: (a -> b -> c) -> Result e a -> Result e b -> Result e c #

(*>) :: Result e a -> Result e b -> Result e b #

(<*) :: Result e a -> Result e b -> Result e a #

(Eq e, Eq ok) => Eq (Result e ok) Source # 
Instance details

Defined in Text.Reform.Result

Methods

(==) :: Result e ok -> Result e ok -> Bool #

(/=) :: Result e ok -> Result e ok -> Bool #

(Show e, Show ok) => Show (Result e ok) Source # 
Instance details

Defined in Text.Reform.Result

Methods

showsPrec :: Int -> Result e ok -> ShowS #

show :: Result e ok -> String #

showList :: [Result e ok] -> ShowS #

getResult :: Result e ok -> Maybe ok Source #

convert a Result to Maybe discarding the error message on Error

data FormId Source #

An ID used to identify forms

Instances
Eq FormId Source # 
Instance details

Defined in Text.Reform.Result

Methods

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

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

Ord FormId Source # 
Instance details

Defined in Text.Reform.Result

Show FormId Source # 
Instance details

Defined in Text.Reform.Result

zeroId :: String -> FormId Source #

The zero ID, i.e. the first ID that is usable

mapId :: ([Integer] -> [Integer]) -> FormId -> FormId Source #

map a function over the [Integer] inside a FormId

formIdList :: FormId -> [Integer] Source #

Stack indicating field. Head is most specific to this item

data FormRange Source #

A range of ID's to specify a group of forms

Constructors

FormRange FormId FormId 
Instances
Eq FormRange Source # 
Instance details

Defined in Text.Reform.Result

Show FormRange Source # 
Instance details

Defined in Text.Reform.Result

incrementFormId :: FormId -> FormId Source #

Increment a form ID

isInRange Source #

Arguments

:: FormId

Id to check for

-> FormRange

Range

-> Bool

If the range contains the id

Check if a FormId is contained in a FormRange

isSubRange Source #

Arguments

:: FormRange

Sub-range

-> FormRange

Larger range

-> Bool

If the sub-range is contained in the larger range

Check if a FormRange is contained in another FormRange

retainErrors :: FormRange -> [(FormRange, e)] -> [e] Source #

Select the errors for a certain range

retainChildErrors :: FormRange -> [(FormRange, e)] -> [e] Source #

Select the errors originating from this form or from any of the children of this form