Search results
withJust :: forall a b m. Applicative m => Maybe a -> (a -> m b) -> m Unit
assure :: forall a e g f. ErrorControl f g e => Monad f => g a -> (a -> Maybe e) -> f a
bind :: forall m a b. Bind m => m a -> (a -> m b) -> m b
discard :: forall a f b. Discard a => Bind f => f a -> (a -> f b) -> f b
bind' :: forall v1 v0 m c. HasBind c m => ObjectOf c v0 => ObjectOf c (m v1) => Restrictable Function c => m v0 -> (v0 -> (m v1)) -> m v1
bind :: forall c b a. HasChain a => a b -> (b -> a c) -> a c
A version of chain with the arguments flipped. This is provided only to
support desugaring do notation. It is not recommended to use explicitly.
fairConjunction :: forall b a m. MonadLogic m => m a -> (a -> m b) -> m b
hummingbird :: forall m b a. Bind m => m a -> (a -> m b) -> m b
H combinator - hummingbird
BW(BC)
Λ a b c (a → b → a → c) → a → b → c
λ f x y . f x y x
when :: forall b a m. MonadLogic m => m a -> (a -> m b) -> m b
for1_ :: forall t f a b. Foldable1 t => Apply f => t a -> (a -> f b) -> f Unit
A version of traverse1_ with its arguments flipped.
This can be useful when running an action written using do notation for every element in a data structure:
for_ :: forall a b f m. Applicative m => Foldable f => f a -> (a -> m b) -> m Unit
A version of traverse_ with its arguments flipped.
This can be useful when running an action written using do notation for every element in a data structure:
For example:
for_ [1, 2, 3] \n -> do
print n
trace "squared is"
print (n * n)
for_ :: forall f m a. Foldable f => MonadRec m => f a -> (a -> m Unit) -> m Unit
Safely traverse a foldable container.
discard :: forall a f. Apply f => f Unit -> (Unit -> f a) -> f a
forM_ :: forall f m a. MonadRec m => Foldable f => f a -> (a -> m Unit) -> m Unit
catchError :: forall e m a. MonadError e m => m a -> (e -> m a) -> m a
controlError :: forall f g e a. ErrorControl f g e => f a -> (e -> g a) -> g a
alt :: forall f a. Alt f => f a -> (Unit -> f a) -> f a
discard :: forall f a. Alt f => f a -> (Unit -> f a) -> f a
discard :: forall f m a. Parallel f m => Alt f => m a -> (Unit -> m a) -> m a
when :: forall a m. Monad m => m Boolean -> (Unit -> m a) -> m Unit
Run a given computation when a monadic boolean is true.
mapFlipped :: forall f a b. Functor f => f a -> (a -> b) -> f b
mapFlipped is map with its arguments reversed. For example:
[1, 2, 3] <#> \n -> n * n
flippedMap :: forall f a b. Functor f => f a -> (a -> b) -> f b
delay :: forall m a b. Delay m => a -> (a -> m b) -> m b
for :: forall a b m t. Applicative m => Traversable t => t a -> (a -> m b) -> m (t b)
A version of traverse with its arguments flipped.
This can be useful when running an action written using do notation for every element in a data structure:
For example:
for [1, 2, 3] \n -> do
print n
return (n * n)
bindMaybe :: forall m a b. Bind m => Compactable m => m a -> (a -> m (Maybe b)) -> m b
forkAction :: forall m a b. MonadEffect m => MonadAff m => Plus m => m a -> (m a -> m b) -> m b
A common pattern - running a long running action and keeping the GUI responsive Because the action can't be restarted on every gui event, we must fork it off in the beginning
fromMaybeS :: forall a f. Selective f => f a -> f (Maybe a) -> f a
fromMaybeS :: forall @f @a. Select f => f a -> f (Maybe a) -> f a
If the second action is Nothing, run and return the first
shouldNotSatisfyM :: forall m a. MonadThrow Error m => Show a => a -> (a -> m Boolean) -> m Unit
shouldSatisfyM :: forall m a. MonadThrow Error m => Show a => a -> (a -> m Boolean) -> m Unit
cmapFlipped :: forall a b f. Contravariant f => f a -> (b -> a) -> f b
cmapFlipped is cmap with its arguments reversed.
whileJust_ :: forall m b a. Monad m => m (Maybe a) -> (a -> m b) -> m Unit
As long as the supplied "Maybe" expression returns "Just _", the loop body will be called and passed the value contained in the 'Just'. Results are discarded.
whileJust_ :: forall m b a. MonadRec m => m (Maybe a) -> (a -> m b) -> m Unit
As long as the supplied "Maybe" expression returns "Just _", the loop body will be called and passed the value contained in the 'Just'. Results are discarded.
intercept :: forall a e g f. ErrorControl f g e => f a -> (e -> a) -> g a
bind :: forall f a. Alt f => f a -> (f a -> f a) -> f a
bind :: forall f m a. Parallel f m => Alt f => m a -> (m a -> m a) -> m a
freads :: forall m r s a. MonadEffect m => Refer s r => r -> (s -> a) -> m a
fmodify_ :: forall m r s. MonadEffect m => Refer s r => r -> (s -> s) -> m Unit
pCompare1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe Ordering
pGreaterThan1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe Boolean
pGreaterThanOrEq1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe Boolean
pLessThan1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe Boolean
pLessThanOrEq1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe Boolean
extendFlipped :: forall b a w. Extend w => w a -> (w a -> b) -> w b
A version of extend with its arguments flipped.
fmodify :: forall m r s. MonadEffect m => Refer s r => r -> (s -> s) -> m s
whileJust :: forall m b a. Monad m => m (Maybe a) -> (a -> m b) -> m (Array b)
As long as the supplied Maybe expression returns Just, the loop body will be called and passed the value contained in the 'Just'. Results are collected into an array.
whileJust :: forall m b a. MonadRec m => m (Maybe a) -> (a -> m b) -> m (Array b)
As long as the supplied "Maybe" expression returns "Just _", the loop body will be called and passed the value contained in the 'Just'. Results are collected into an array.
whileJust' :: forall b f a m. Monad m => Applicative f => Monoid (f b) => m (Maybe a) -> (a -> m b) -> m (f b)
As long as the supplied Maybe expression returns Just, the loop
body will be called and passed the value contained in the Just.
Results are collected into an arbitrary Applicative monoidal structure.
whileJust' :: forall m f b a. MonadRec m => Applicative f => Monoid (f b) => m (Maybe a) -> (a -> m b) -> m (f b)
As long as the supplied "Maybe" expression returns "Just _", the loop body will be called and passed the value contained in the 'Just'. Results are collected into an arbitrary MonadPlus container.
div :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLDivElement
span :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLSpanElement
table :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLTableElement
td :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLTableCellElement
th :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLTableCellElement
tr :: forall m f1 f2. MonadEffect m => Foldable f1 => Foldable f2 => f1 (String /\ String) -> f2 (m Node) -> m HTMLTableRowElement
appendsNodesM :: forall m p f. NodeOp p => Foldable f => MonadEffect m => m p -> f (m Node) -> m p
applyFlipped :: forall a b. a -> (a -> b) -> b
Applies an argument to a function. This is primarily used as the (#)
operator, which allows parentheses to be omitted in some cases, or as a
natural way to apply a value to a chain of composed functions.
applySecond :: forall a b f. Apply f => f a -> f b -> f b
Combine two effectful actions, keeping only the result of the second.
voidLeft :: forall f a b. Functor f => f a -> b -> f b
A version of voidRight with its arguments flipped.
mulNat :: forall proxy a b c. ProductNat a b c => proxy a -> proxy b -> proxy c
plus :: forall proxy a b c. SumInt a b c => proxy a -> proxy b -> proxy c
plusNat :: forall proxy a b c. SumNat a b c => proxy a -> proxy b -> proxy c
powNat :: forall proxy a b c. ExponentiationNat a b c => proxy a -> proxy b -> proxy c
> powNat d2 d3
8 -- : NProxy D8
a raised to the power of b a^b = c
prod :: forall proxy a b c. ProductInt a b c => proxy a -> proxy b -> proxy c
sampleOnLeft_ :: forall event a b. IsEvent event => event a -> event b -> event b
fromMaybe' :: forall a. Maybe a -> a -> a
An infix form of fromMaybe with arguments flipped.
divides :: forall a. Divisible a => a -> a -> Maybe a
concat :: forall xs ys zs lproxy. Concat xs ys zs => lproxy xs -> lproxy ys -> lproxy zs
downcast :: forall ctor from to. ctor -> from -> Maybe to
Attempt to cast to a type given a constructor for it
drop :: forall n xs ys lproxy iproxy. Drop n xs ys => iproxy n -> lproxy xs -> lproxy ys
map :: forall f xs ys fproxy kproxy lproxy. Map f xs ys => fproxy f -> kproxy xs -> lproxy ys
take :: forall n xs ys lproxy iproxy. Take n xs ys => iproxy n -> lproxy xs -> lproxy ys
zip :: forall x y z lproxy. Zip x y z => lproxy x -> lproxy y -> lproxy z
applySecond :: forall v1 v0 f c. HasApply c f => HasConst c => HasIdentity c => HasMap c f => ObjectOf c v0 => ObjectOf c v1 => ObjectOf c (c v1 v1) => ObjectOf c (c v0 (c v1 v1)) => ObjectOf c (c (c v1 v1) (c v0 (c v1 v1))) => f v0 -> f v1 -> f v1
downcast :: forall ctor from to. ctor -> from -> Maybe to
Attempt to cast to a type given a constructor for it
lookup :: forall c k r. Lookup c k r => c -> k -> Maybe r
Given some type and a key on that type, extract some value that corresponds to that key.
lookup :: forall c k r. Lookup c k r => c -> k -> Maybe r
Given some type and a key on that type, extract some value that corresponds to that key.
getOrAlt :: forall v s r' r l h g f. Alternative h => Cons s v r' r => RowToList r l => RGetOrAlt f g s l r => g s -> f r -> h v
max :: forall a. PartialOrd a => a -> a -> Maybe a
min :: forall a. PartialOrd a => a -> a -> Maybe a
pMax :: forall a. PartialOrd a => a -> a -> Maybe a
pMin :: forall a. PartialOrd a => a -> a -> Maybe a
rsingleton :: forall f g s v r. RSingleton f g s => Cons s v () r => Lacks s () => g s -> v -> f r
singleton :: forall v s r g f. Cons s v () r => Lacks s () => RSingleton f g s => g s -> v -> f r
_call :: forall b a. a -> (a -> b) -> b
after :: forall k f. Eq k => Foldable f => k -> f k -> Maybe k
always_ :: forall a i. i -> a -> Maybe i
before :: forall k f. Eq k => Foldable f => k -> f k -> Maybe k
bind :: forall a. Semigroup a => a -> (a -> a) -> a
extract :: forall r x a. TypeEquals r x => r -> (x -> a) -> a
functorDecorateFlipped :: forall b a f. Functor f => Decorate b a => f a -> b -> f b
nmapFlipped :: forall b a fb fa. NestedFunctor fa fb a b => fa -> (a -> b) -> fb
t :: forall b a. a -> (a -> b) -> b
Reverse application which is
probably exist inside Lens module
t :: forall b a. a -> (a -> b) -> b
thrush :: forall b a. a -> (a -> b) -> b
T combinator - thrush
CI
Λ a b . a → (a → b) → b
λ x f . f x
shouldContain :: forall m f a. MonadThrow Error m => Show a => Eq a => Show (f a) => Foldable f => f a -> a -> m Unit
shouldNotContain :: forall m f a. MonadThrow Error m => Show a => Eq a => Show (f a) => Foldable f => f a -> a -> m Unit
shouldNotReturn :: forall m t. MonadThrow Error m => Eq t => Show t => m t -> t -> m Unit
Asserts that m t does not return t
shouldReturn :: forall m t. MonadThrow Error m => Eq t => Show t => m t -> t -> m Unit
Asserts that m t returns t
trace :: forall a b. DebugWarning => a -> (Unit -> b) -> b
Log any PureScript value to the console for debugging purposes and then
return a value. This will log the value's underlying representation for
low-level debugging, so it may be desireable to show the value first.
The return value is thunked so it is not evaluated until after the message has been printed, to preserve a predictable console output.
For example:
doSomething = trace "Hello" \_ -> ... some value or computation ...
gate :: forall a event. IsEvent event => event Boolean -> event a -> event a
Sample the events that are fired while a boolean event is true. Note that,
until the boolean event fires, it will be assumed to be false, and events
will be blocked.
gate :: forall event a. IsEvent event => event Boolean -> event a -> event a
Sample the events that are fired while a boolean event is true. Note that,
until the boolean event fires, it will be assumed to be false, and events
will be blocked.
local :: forall m r a. Alt m => MonadRec m => MonadEffect m => MonadAff m => Plus m => a -> (Wire m a -> m r) -> m r
Setup a local environment with a wire
compare :: forall a. PartialOrd a => a -> a -> Maybe Ordering
pCompare :: forall a. PartialOrd a => a -> a -> Maybe Ordering
pGreaterThan :: forall a. PartialOrd a => a -> a -> Maybe Boolean
pGreaterThanOrEq :: forall a. PartialOrd a => a -> a -> Maybe Boolean
pLessThan :: forall a. PartialOrd a => a -> a -> Maybe Boolean
pLessThanOrEq :: forall a. PartialOrd a => a -> a -> Maybe Boolean
pMax1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe (f a)
pMin1 :: forall f a. PartialOrd1 f => f a -> f a -> Maybe (f a)
addClasses :: forall m n f. MonadEffect m => ElementOp n => Foldable f => f String -> n -> m n
addClassesM :: forall m n f. MonadEffect m => ElementOp n => Foldable f => f String -> m n -> m n
applySecond :: forall a d. Syntax d => d Unit -> d a -> d a
This variant of <*> ignores its left result. In contrast to its
counterpart derived from the Apply class, the ignored parts have type
d Unit rather than d b because otherwise information relevant for
pretty-printing would be lost.
applyTuple :: forall f a b. Apply f => f a -> f b -> f (a /\ b)
buildStub :: forall params fun. StubBuilder params fun => Maybe MockName -> params -> fun
chainM :: forall m a. Testable m => m Element -> m a -> m a
Used in its operator form >>, this function chains two DOM operations
together, taking the output of the first operation and making it context of
the second one. For example:
buttonInsideDiv <- find "div" >> find "button"
inputValue <- find "input" >> attr "value"
discard :: forall a. Semigroup a => a -> (Unit -> a) -> a
findFirstDifference :: forall obj2 obj1. obj1 -> obj2 -> Maybe Change
Take two raw objects, diff them and return the path to the first difference alongside the type of that difference (changed, deleted, created).
longestTail' :: forall a t. Unconsable t => t a -> t a -> Maybe (t a)
Less polymorphic version of longestTail.
maxLen :: forall m e. MonadEffect m => ElementOp e => m e -> m (Maybe Int)
Get the max length setting.
rmCss :: forall m n f. MonadEffect m => HTMLElementOp n => Foldable f => f String -> n -> m n
rmCssM :: forall m n f. MonadEffect m => HTMLElementOp n => Foldable f => f String -> m n -> m n
sbind :: forall a. Semigroup a => a -> (Unit -> a) -> a
Utility function so you can define formats with do notation. For example:
myFormat = do
ifNegative $ literal "("
currencyCode
literal space
amount
ifNegative $ literal ")"
where discard = sbind
setAttrs :: forall e f m. Foldable f => ElementOp e => MonadEffect m => f (String /\ String) -> e -> m e
Sets the attributes of an element. Existing attributes of the same names are overwritten. New names create new attributes. The element is returned.
setAttrsM :: forall e f m. Foldable f => ElementOp e => MonadEffect m => f (String /\ String) -> m e -> m e
Sets the attributes of an element. Existing attributes of the same names are overwritten. New names create new attributes. The element is returned.
setCss :: forall m n f. MonadEffect m => HTMLElementOp n => Foldable f => f (String /\ String) -> n -> m n
setCssM :: forall m n f. MonadEffect m => HTMLElementOp n => Foldable f => f (String /\ String) -> m n -> m n
shouldContain :: forall m f a. MonadEffect m => Show a => Eq a => Show (f a) => Foldable f => f a -> a -> m Unit
shouldEqualM :: forall m a. MonadThrow Error m => Eq a => Show a => m a -> a -> m Unit
shouldNotContain :: forall m f a. MonadEffect m => Show a => Eq a => Show (f a) => Foldable f => f a -> a -> m Unit
shouldNotEqualM :: forall m a. MonadThrow Error m => Eq a => Show a => m a -> a -> m Unit
whileM_ :: forall m a. Monad m => m Boolean -> m a -> m Unit
Execute an action repeatedly as long as the given boolean expression
returns true. The condition is evaluated before the loop body.
Ignores the results of loop body execution.
whileM_ :: forall m a. MonadRec m => m Boolean -> m a -> m Unit
Execute an action repeatedly as long as the given boolean expression
returns true. The condition is evaluated before the loop body.
Ignores the results of loop body execution.
loopState :: forall m a s. Monad m => s -> (s -> m (Either s a)) -> m a
A very useful combinator for widgets with localised state
appendsNodes :: forall m p f. NodeOp p => Foldable f => MonadEffect m => p -> f (m Node) -> m p
applyFirst :: forall a b f. Apply f => f a -> f b -> f a
Combine two effectful actions, keeping only the result of the first.
alt :: forall f a. Alt f => f a -> f a -> f a
optional :: forall f a. Alt f => Applicative f => f a -> f (Maybe a)
One or none.
optional empty = pure Nothing
The behaviour of optional (pure x) depends on whether the Alt instance
satisfy the left catch law (pure a <|> b = pure a).
Either e does:
optional (Right x) = Right (Just x)
But Array does not:
optional [x] = [Just x, Nothing]
choose :: forall m a. MonadGen m => m a -> m a -> m a
Creates a generator that outputs a value chosen from one of two existing existing generators with even probability.
genMaybe :: forall m a. MonadGen m => m a -> m (Maybe a)
Creates a generator that outputs Maybe values, choosing a value from
another generator for the inner value. The generator has a 75% chance of
returning a Just over a Nothing.
evaluateExample :: forall t arg m. Example t arg m => t -> (ActionWith m arg -> m Unit) -> m Unit
sampleOnRight_ :: forall event a b. IsEvent event => event a -> event b -> event a
Create an Event which samples the latest values from the first event
at the times when the second event fires, ignoring the values produced by
the second event.
optional :: forall f a. Alt f => Applicative f => f a -> f (Maybe a)
addU :: forall repr u. UnitArith repr => repr u -> repr u -> repr u
Add two values with the same unit
addUnitOp :: forall repr u. UnitArith repr => repr u -> repr u -> repr u
subU :: forall repr u. UnitArith repr => repr u -> repr u -> repr u
Subtract two values with the same unit
subUnitOp :: forall repr u. UnitArith repr => repr u -> repr u -> repr u
sampleOn_ :: forall b a event. IsEvent event => event a -> event b -> event a
Create an Event which samples the latest values from the first event
at the times when the second event fires, ignoring the values produced by
the second event.
applyFirst :: forall v1 v0 f c. HasApply c f => HasConst c => HasMap c f => ObjectOf c v0 => ObjectOf c v1 => ObjectOf c (c v1 v0) => f v0 -> f v1 -> f v0