Shpadoinkle-widgets-0.0.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 #

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

Monad (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

return :: a -> Validated e a #

fail :: String -> Validated e a #

Functor (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

Applicative (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

pure :: a -> Validated e a #

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

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

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

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

Foldable (Validated e) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

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

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

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

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

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

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

null :: Validated e a -> Bool #

length :: Validated e a -> Int #

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

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

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

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

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

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) #

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

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

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

(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 #

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

(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 #

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

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

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

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

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

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

(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

Methods

showsPrec :: Int -> Validated e a -> ShowS #

show :: Validated e a -> String #

showList :: [Validated e a] -> ShowS #

Generic (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

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

Methods

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

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

Semigroup (Validated e a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

(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.0.0.1-2e7ySQOzQveLMoCBVBP1hf" 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 #

Semigroup Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Monoid Placeholder Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

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.0.0.1-2e7ySQOzQveLMoCBVBP1hf" 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 #

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

return :: a -> Input a #

fail :: String -> Input a #

Functor Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

Applicative Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

pure :: a -> Input a #

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

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

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

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

Foldable Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

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

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

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

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

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

toList :: Input a -> [a] #

null :: Input a -> Bool #

length :: Input a -> Int #

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

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

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

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

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

Traversable Input Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

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

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 #

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

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

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

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

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

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

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

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

Methods

showsPrec :: Int -> Input a -> ShowS #

show :: Input a -> String #

showList :: [Input a] -> ShowS #

Generic (Input a) Source # 
Instance details

Defined in Shpadoinkle.Widgets.Types.Form

Associated Types

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

Methods

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

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

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

Defined in Shpadoinkle.Widgets.Types.Form

Methods

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

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

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

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

Defined in Shpadoinkle.Widgets.Types.Form

Methods

mempty :: Input a #

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

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

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.0.0.1-2e7ySQOzQveLMoCBVBP1hf" 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 #