reform-0.2.7: reform is an HTML form generation and validation library

Safe HaskellSafe-Inferred
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) 
Functor (Result e) 
Applicative (Result e) 
(Eq e, Eq ok) => Eq (Result e ok) 
(Show e, Show ok) => Show (Result e ok) 

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

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 

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