descriptive-0.9.4: Self-describing consumers/parsers; forms, cmd-line args, JSON, etc.

Safe Haskell | Safe
Language | Haskell98

Descriptive.Form

Contents

- Combinators
- Description

Description

Validating form with named inputs.

Synopsis

- input :: Monad m => Text -> Consumer (Map Text Text) (Form d) m Text
- validate :: Monad m => d -> (a -> StateT s m (Maybe b)) -> Consumer s (Form d) m a -> Consumer s (Form d) m b
- data Form d
  - = Input !Text
  - | Constraint !d

# Combinators

input :: Monad m => Text -> Consumer (Map Text Text) (Form d) m Text #

Consume any input value.

validate #

Arguments

:: Monad m |
=> d | Description of what it expects.
-> (a -> StateT s m (Maybe b)) | Attempt to parse the value.
-> Consumer s (Form d) m a | Consumer to add validation to.
-> Consumer s (Form d) m b | A new validating consumer.

Validate a form input with a description of what's required.

# Description

data Form d #

Form descriptor.

Constructors

Input !Text |
Constraint !d |

Instances

Eq d => Eq (Form d) # |
Methods (==) :: Form d -> Form d -> Bool # (/=) :: Form d -> Form d -> Bool #
Show d => Show (Form d) # |
Methods showsPrec :: Int -> Form d -> ShowS # show :: Form d -> String # showList :: [Form d] -> ShowS #