simple-form-0.5.0: Forms that configure themselves based on type

Safe HaskellNone
LanguageHaskell98

SimpleForm.Validation

Contents

Synopsis

Documentation

data Validation a Source

Either try to parse the submitted values, or have a list of allowed values

Constructors

Check ([Text] -> Maybe a) 
Includes (GroupedCollection' a) 

Instances

Wrappers

newtype ShowRead a Source

Wrapper for types that should be rendered using show

Constructors

ShowRead a 

Instances

Eq a => Eq (ShowRead a) 
Ord a => Ord (ShowRead a) 
Read a => Read (ShowRead a) 
(Show a, Read a) => Show (ShowRead a) 
(Show a, Read a) => DefaultWidget (ShowRead a) 
Read a => DefaultValidation (ShowRead a) 

newtype SelectEnum a Source

Wrapper for select boxes on enumerable types

Constructors

SelectEnum a 

Instances

Bounded a => Bounded (SelectEnum a) 
Enum a => Enum (SelectEnum a) 
Eq a => Eq (SelectEnum a) 
Ord a => Ord (SelectEnum a) 
Read a => Read (SelectEnum a) 
(Show a, Read a) => Show (SelectEnum a) 
(Show a, Read a, Bounded a, Enum a) => DefaultWidget (SelectEnum a) 
(Show a, Read a, Bounded a, Enum a) => DefaultValidation (SelectEnum a) 

Validations

Text-like

Dates and times

Collections

type GroupedCollection' a = [(Text, [(a, (Text, Text))])] Source

GroupedCollection including the parsed value

type Collection' a = [(a, (Text, Text))] Source

Collection including the parsed value

Helpers

pmap :: (a -> Maybe b) -> Validation a -> Validation b Source

Map over a Validation with a partial function

selectEnum :: (Show a, Read a, Bounded a, Enum a) => Collection' a Source

Derive a collection from an enumerable type

selectEnumIdx :: (Show a, Bounded a, Enum a) => Collection' a Source

Derive an indexed collection from an enumerable type

enumIdx :: (Show a, Bounded a, Enum a) => (GroupedCollection' a -> Validation a) -> Validation a Source

Feed a collection Validation from an enumerable type

multiEnum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> Validation [a]) -> Validation [a] Source

Feed a multi-select collection Validation from an enumerable type

multiEnumIdx :: (Show a, Bounded a, Enum a) => (GroupedCollection' a -> Validation [a]) -> Validation [a] Source

Feed a multi-select collection Validation from an enumerable type