digestive-functors-0.6.0.0: A practical formlet library

Safe HaskellNone

Text.Digestive.Form.Internal

Contents

Description

This module mostly meant for internal usage, and might change between minor releases.

Synopsis

Documentation

type Form v m a = FormTree m v m aSource

Base type for a form.

The three type parameters are:

  • v: the type for textual information, displayed to the user. For example, error messages are of this type. v stands for view.
  • m: the monad in which validators operate. The classical example is when validating input requires access to a database, in which case this m should be an instance of MonadIO.
  • a: the type of the value returned by the form, used for its Applicative instance.

data FormTree t v m a whereSource

Constructors

Ref :: Ref -> FormTree t v m a -> FormTree t v m a 
Pure :: Field v a -> FormTree t v m a 
App :: FormTree t v m (b -> a) -> FormTree t v m b -> FormTree t v m a 
Map :: (b -> m (Result v a)) -> FormTree t v m b -> FormTree t v m a 
Monadic :: t (FormTree t v m a) -> FormTree t v m a 
List :: DefaultList (FormTree t v m a) -> FormTree t v m [Int] -> FormTree t v m [a] 

Instances

Monad m => Functor (FormTree t v m) 
(Functor (FormTree t v m), Monad m, Monoid v) => Applicative (FormTree t v m) 
Show (FormTree Identity v m a) 

data SomeForm v m Source

Constructors

forall a . SomeForm (FormTree Identity v m a) 

Instances

Show (SomeForm v m) 

transform :: Monad m => (a -> m (Result v b)) -> FormTree t v m a -> FormTree t v m bSource

monadic :: m (Form v m a) -> Form v m aSource

toFormTree :: Monad m => Form v m a -> m (FormTree Identity v m a)Source

(.:) :: Monad m => Text -> Form v m a -> Form v m aSource

Operator to set a name for a subform.

lookupList :: Path -> FormTree Identity v m a -> SomeForm v mSource

Always returns a List

queryField :: Path -> FormTree Identity v m a -> (forall b. Field v b -> c) -> cSource

eval :: Monad m => Method -> Env m -> FormTree Identity v m a -> m (Result [(Path, v)] a, [(Path, FormInput)])Source

formMapView :: Monad m => (v -> w) -> FormTree Identity v m a -> FormTree Identity w m aSource

Debugging

debugFormPaths :: Monad m => FormTree Identity v m a -> [Path]Source

Debugging purposes