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

Safe HaskellNone
LanguageHaskell98

SimpleForm.Combined

Contents

Description

Forms that configure themselves based on type

The Combined module both renders to Html and also parses input.

Synopsis

Documentation

type Widget a = Maybe a -> Maybe Text -> Text -> InputOptions -> Input Source

The type of a widget renderer

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

Options

data InputOptions Source

The setup for rendering an input. Blank is mempty

Constructors

InputOptions 

data Label Source

A block label, inline label, or implied value label

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) 

Widgets

Text-like

Numbers

number :: (Num a, Show a, Read a) => (Widget a, Validation a) Source

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

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

Derive a collection from an enumerable type

enum :: (Show a, Read a, Bounded a, Enum a) => (GroupedCollection' a -> (Widget Text, Validation a)) -> (Widget a, Validation a) Source

Feed a collection Widget and Validation from an enumerable type

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

Feed a multi-select collection Widget and Validation from an enumerable type

humanize :: Text -> Text Source

Format identifiers nicely for humans to read