Shpadoinkle-widgets-0.2.0.1: A collection of common reusable types and components.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Widgets.Types.Form

Documentation

class Validate (f :: Status -> Type) where Source #

Minimal complete definition

rules

Methods

validate :: f Edit -> f Errors Source #

validate :: Generic (f Edit) => Generic (f Rules) => Generic (f Errors) => ValidateG (Rep (f Rules)) (Rep (f Edit)) (Rep (f Errors)) => f Edit -> f Errors Source #

getValid :: f Errors -> Maybe (f Valid) Source #

getValid :: Generic (f Errors) => Generic (f Valid) => ValidG (Rep (f Errors)) (Rep (f Valid)) => f Errors -> Maybe (f Valid) Source #

rules :: f Rules Source #

class ValidG err valid where Source #

Methods

validg :: err a -> Maybe (valid a) Source #

Instances
ValidG (U1 :: Type -> Type) (U1 :: Type -> Type) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: U1 a -> Maybe (U1 a) Source #

ValidG (K1 i (Validated t a) :: Type -> Type) (K1 i' a :: Type -> Type) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: K1 i (Validated t a) a0 -> Maybe (K1 i' a a0) Source #

(ValidG a c, ValidG b d) => ValidG (a :+: b) (c :+: d) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: (a :+: b) a0 -> Maybe ((c :+: d) a0) Source #

(ValidG a c, ValidG b d) => ValidG (a :*: b) (c :*: d) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: (a :*: b) a0 -> Maybe ((c :*: d) a0) Source #

ValidG a b => ValidG (M1 i c a) (M1 i' c' b) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: M1 i c a a0 -> Maybe (M1 i' c' b a0) Source #

class ValidateG rules edit errs where Source #

Methods

validateg :: rules a -> edit a -> errs a Source #

Instances
ValidateG (U1 :: Type -> Type) (U1 :: Type -> Type) (U1 :: Type -> Type) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validateg :: U1 a -> U1 a -> U1 a Source #

(Control c, Monoid v, Val c a ~ v, Ord a) => ValidateG (K1 i (v -> b) :: Type -> Type) (K1 i' (c a) :: Type -> Type) (K1 i'' b :: Type -> Type) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validateg :: K1 i (v -> b) a0 -> K1 i' (c a) a0 -> K1 i'' b a0 Source #

(ValidateG a b c, ValidateG d e f, Alternative (c :+: f)) => ValidateG (a :+: d) (b :+: e) (c :+: f) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validateg :: (a :+: d) a0 -> (b :+: e) a0 -> (c :+: f) a0 Source #

(ValidateG a b c, ValidateG d e f) => ValidateG (a :*: d) (b :*: e) (c :*: f) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validateg :: (a :*: d) a0 -> (b :*: e) a0 -> (c :*: f) a0 Source #

ValidateG a b c => ValidateG (M1 i x a) (M1 i' x' b) (M1 i'' x'' c) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validateg :: M1 i x a a0 -> M1 i' x' b a0 -> M1 i'' x'' c a0 Source #

type family Field (s :: Status) (e :: Type) (f :: Type -> Type) (x :: Type) :: Type where ... Source #

Equations

Field Valid _ _ a = a 
Field Errors e _ a = Validated e a 
Field Edit _ f a = f a 
Field Rules e f a = Val f a -> Validated e a 

data Status Source #

Constructors

Edit 
Rules 
Valid 
Errors 

data Validated e a Source #

Constructors

Validated a 
Invalid e [e] 
Instances
MonadError e (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

throwError :: e -> Validated e a Source #

catchError :: Validated e a -> (e -> Validated e a) -> Validated e a Source #

Monad (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(>>=) :: Validated e a -> (a -> Validated e b) -> Validated e b Source #

(>>) :: Validated e a -> Validated e b -> Validated e b Source #

return :: a -> Validated e a Source #

fail :: String -> Validated e a Source #

Functor (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

fmap :: (a -> b) -> Validated e a -> Validated e b Source #

(<$) :: a -> Validated e b -> Validated e a Source #

Applicative (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

pure :: a -> Validated e a Source #

(<*>) :: Validated e (a -> b) -> Validated e a -> Validated e b Source #

liftA2 :: (a -> b -> c) -> Validated e a -> Validated e b -> Validated e c Source #

(*>) :: Validated e a -> Validated e b -> Validated e b Source #

(<*) :: Validated e a -> Validated e b -> Validated e a Source #

Foldable (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

fold :: Monoid m => Validated e m -> m Source #

foldMap :: Monoid m => (a -> m) -> Validated e a -> m Source #

foldr :: (a -> b -> b) -> b -> Validated e a -> b Source #

foldr' :: (a -> b -> b) -> b -> Validated e a -> b Source #

foldl :: (b -> a -> b) -> b -> Validated e a -> b Source #

foldl' :: (b -> a -> b) -> b -> Validated e a -> b Source #

foldr1 :: (a -> a -> a) -> Validated e a -> a Source #

foldl1 :: (a -> a -> a) -> Validated e a -> a Source #

toList :: Validated e a -> [a] Source #

null :: Validated e a -> Bool Source #

length :: Validated e a -> Int Source #

elem :: Eq a => a -> Validated e a -> Bool Source #

maximum :: Ord a => Validated e a -> a Source #

minimum :: Ord a => Validated e a -> a Source #

sum :: Num a => Validated e a -> a Source #

product :: Num a => Validated e a -> a Source #

Traversable (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

traverse :: Applicative f => (a -> f b) -> Validated e a -> f (Validated e b) Source #

sequenceA :: Applicative f => Validated e (f a) -> f (Validated e a) Source #

mapM :: Monad m => (a -> m b) -> Validated e a -> m (Validated e b) Source #

sequence :: Monad m => Validated e (m a) -> m (Validated e a) Source #

(Eq a, Eq e) => Eq (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(==) :: Validated e a -> Validated e a -> Bool Source #

(/=) :: Validated e a -> Validated e a -> Bool Source #

(Ord a, Ord e) => Ord (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

compare :: Validated e a -> Validated e a -> Ordering Source #

(<) :: Validated e a -> Validated e a -> Bool Source #

(<=) :: Validated e a -> Validated e a -> Bool Source #

(>) :: Validated e a -> Validated e a -> Bool Source #

(>=) :: Validated e a -> Validated e a -> Bool Source #

max :: Validated e a -> Validated e a -> Validated e a Source #

min :: Validated e a -> Validated e a -> Validated e a Source #

(Read a, Read e) => Read (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

(Show a, Show e) => Show (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Generic (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

type Rep (Validated e a) :: Type -> Type Source #

Methods

from :: Validated e a -> Rep (Validated e a) x Source #

to :: Rep (Validated e a) x -> Validated e a Source #

Semigroup (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(<>) :: Validated e a -> Validated e a -> Validated e a Source #

sconcat :: NonEmpty (Validated e a) -> Validated e a Source #

stimes :: Integral b => b -> Validated e a -> Validated e a Source #

(Arbitrary a, Arbitrary b) => Arbitrary (Validated a b) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

arbitrary :: Gen (Validated a b) Source #

shrink :: Validated a b -> [Validated a b] Source #

(NFData a, NFData e) => NFData (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

rnf :: Validated e a -> () Source #

(ToJSON e, ToJSON a) => ToJSON (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

(FromJSON a, FromJSON e) => FromJSON (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

ValidG (K1 i (Validated t a) :: Type -> Type) (K1 i' a :: Type -> Type) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

validg :: K1 i (Validated t a) a0 -> Maybe (K1 i' a a0) Source #

type Rep (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Rep (Validated e a) = D1 (MetaData "Validated" "Shpadoinkle.Widgets.Types.Form" "Shpadoinkle-widgets-0.2.0.1-HaWUIlNGtuO41rdsllvehE" False) (C1 (MetaCons "Validated" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) :+: C1 (MetaCons "Invalid" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 e) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [e])))

newtype Placeholder Source #

Constructors

Placeholder 

Fields

Instances
Eq Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Ord Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Read Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Show Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

IsString Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Generic Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

type Rep Placeholder :: Type -> Type Source #

Semigroup Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Monoid Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

NFData Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

rnf :: Placeholder -> () Source #

ToJSON Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

FromJSON Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Rep Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Rep Placeholder = D1 (MetaData "Placeholder" "Shpadoinkle.Widgets.Types.Form" "Shpadoinkle-widgets-0.2.0.1-HaWUIlNGtuO41rdsllvehE" True) (C1 (MetaCons "Placeholder" PrefixI True) (S1 (MetaSel (Just "unPlaceholder") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

class Control g where Source #

Associated Types

type Val g a :: Type Source #

Methods

hygiene :: Applicative f => (Hygiene -> f Hygiene) -> g a -> f (g a) Source #

value :: (Applicative f, Ord a) => (Val g a -> f (Val g a)) -> g a -> f (g a) Source #

Instances
Control Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

type Val Input a :: Type Source #

Methods

hygiene :: Applicative f => (Hygiene -> f Hygiene) -> Input a -> f (Input a) Source #

value :: (Applicative f, Ord a) => (Val Input a -> f (Val Input a)) -> Input a -> f (Input a) Source #

Control (Dropdown One) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Form.Dropdown

Associated Types

type Val (Dropdown One) a :: Type Source #

Methods

hygiene :: Applicative f => (Hygiene -> f Hygiene) -> Dropdown One a -> f (Dropdown One a) Source #

value :: (Applicative f, Ord a) => (Val (Dropdown One) a -> f (Val (Dropdown One) a)) -> Dropdown One a -> f (Dropdown One a) Source #

Control (Dropdown AtleastOne) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Form.Dropdown

Associated Types

type Val (Dropdown AtleastOne) a :: Type Source #

data Input a Source #

Constructors

Input 

Fields

Instances
Monad Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(>>=) :: Input a -> (a -> Input b) -> Input b Source #

(>>) :: Input a -> Input b -> Input b Source #

return :: a -> Input a Source #

fail :: String -> Input a Source #

Functor Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

fmap :: (a -> b) -> Input a -> Input b Source #

(<$) :: a -> Input b -> Input a Source #

Applicative Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

pure :: a -> Input a Source #

(<*>) :: Input (a -> b) -> Input a -> Input b Source #

liftA2 :: (a -> b -> c) -> Input a -> Input b -> Input c Source #

(*>) :: Input a -> Input b -> Input b Source #

(<*) :: Input a -> Input b -> Input a Source #

Foldable Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

fold :: Monoid m => Input m -> m Source #

foldMap :: Monoid m => (a -> m) -> Input a -> m Source #

foldr :: (a -> b -> b) -> b -> Input a -> b Source #

foldr' :: (a -> b -> b) -> b -> Input a -> b Source #

foldl :: (b -> a -> b) -> b -> Input a -> b Source #

foldl' :: (b -> a -> b) -> b -> Input a -> b Source #

foldr1 :: (a -> a -> a) -> Input a -> a Source #

foldl1 :: (a -> a -> a) -> Input a -> a Source #

toList :: Input a -> [a] Source #

null :: Input a -> Bool Source #

length :: Input a -> Int Source #

elem :: Eq a => a -> Input a -> Bool Source #

maximum :: Ord a => Input a -> a Source #

minimum :: Ord a => Input a -> a Source #

sum :: Num a => Input a -> a Source #

product :: Num a => Input a -> a Source #

Traversable Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

traverse :: Applicative f => (a -> f b) -> Input a -> f (Input b) Source #

sequenceA :: Applicative f => Input (f a) -> f (Input a) Source #

mapM :: Monad m => (a -> m b) -> Input a -> m (Input b) Source #

sequence :: Monad m => Input (m a) -> m (Input a) Source #

Control Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

type Val Input a :: Type Source #

Methods

hygiene :: Applicative f => (Hygiene -> f Hygiene) -> Input a -> f (Input a) Source #

value :: (Applicative f, Ord a) => (Val Input a -> f (Val Input a)) -> Input a -> f (Input a) Source #

Eq a => Eq (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(==) :: Input a -> Input a -> Bool Source #

(/=) :: Input a -> Input a -> Bool Source #

Ord a => Ord (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

compare :: Input a -> Input a -> Ordering Source #

(<) :: Input a -> Input a -> Bool Source #

(<=) :: Input a -> Input a -> Bool Source #

(>) :: Input a -> Input a -> Bool Source #

(>=) :: Input a -> Input a -> Bool Source #

max :: Input a -> Input a -> Input a Source #

min :: Input a -> Input a -> Input a Source #

Read a => Read (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Show a => Show (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Generic (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

type Rep (Input a) :: Type -> Type Source #

Methods

from :: Input a -> Rep (Input a) x Source #

to :: Rep (Input a) x -> Input a Source #

Semigroup a => Semigroup (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

(<>) :: Input a -> Input a -> Input a Source #

sconcat :: NonEmpty (Input a) -> Input a Source #

stimes :: Integral b => b -> Input a -> Input a Source #

Monoid a => Monoid (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

mempty :: Input a Source #

mappend :: Input a -> Input a -> Input a Source #

mconcat :: [Input a] -> Input a Source #

Arbitrary a => Arbitrary (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

arbitrary :: Gen (Input a) Source #

shrink :: Input a -> [Input a] Source #

NFData a => NFData (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

rnf :: Input a -> () Source #

ToJSON a => ToJSON (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

FromJSON a => FromJSON (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Val Input a Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Val Input a = a
type Rep (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

type Rep (Input a) = D1 (MetaData "Input" "Shpadoinkle.Widgets.Types.Form" "Shpadoinkle-widgets-0.2.0.1-HaWUIlNGtuO41rdsllvehE" False) (C1 (MetaCons "Input" PrefixI True) (S1 (MetaSel (Just "_hygiene") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Hygiene) :*: S1 (MetaSel (Just "_value") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

getValue :: (Ord a, Monoid (Val g a), Control g) => g a -> Val g a Source #