Search results
compose2 :: forall a b x y. (a -> b) -> (x -> y -> a) -> x -> y -> b
\f g x y -> f (g x y)
composeSecondFlipped :: forall a b x y. (y -> b) -> (x -> b -> a) -> x -> y -> a
over2 :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (a -> a -> b) -> t -> t -> s
Lifts a binary function to operate over newtypes.
newtype Meter = Meter Int
derive newtype instance newtypeMeter :: Newtype Meter _
newtype SquareMeter = SquareMeter Int
derive newtype instance newtypeSquareMeter :: Newtype SquareMeter _
area :: Meter -> Meter -> SquareMeter
area = over2 Meter (*)
The above example also demonstrates that the return type is polymorphic here too.
under2 :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (t -> t -> s) -> a -> a -> b
The opposite of over2: lowers a binary function that operates on Newtyped
values to operate on the wrapped value instead.
traverse :: forall f t a. Coercible (f a) (f t) => Newtype t a => (a -> t) -> (a -> f a) -> t -> f t
Similar to the function from the Traversable class, but operating within
a newtype instead.
applySecondFlipped :: forall x y a. x -> (y -> x -> a) -> y -> a
compose :: forall c b a. (b -> c) -> (a -> b) -> (a -> c)
Returns a new function that calls the first function with the result of calling the second.
let addTwo x = x + 2
let double x = x * 2
let addTwoThenDouble x = addTwo :compose double
addTwoThenDouble 3 -- 10
This is function composition.
finch :: forall c b a. a -> (c -> a -> b) -> c -> b
F combinator - finch
ETTET
Λ a b c . a → b → (b → a → c) → c
λ x y f . f y x
robin :: forall c b a. a -> (b -> a -> c) -> b -> c
R combinator - robin
BBT
Λ a b c . a → (b → a → c) → b → c
λ x f y . f y x
over :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (a -> b) -> t -> s
Lifts a function operate over newtypes. This can be used to lift a
function to manipulate the contents of a single newtype, somewhat like
map does for a Functor:
newtype Label = Label String
derive instance newtypeLabel :: Newtype Label _
toUpperLabel :: Label -> Label
toUpperLabel = over Label String.toUpper
But the result newtype is polymorphic, meaning the result can be returned as an alternative newtype:
newtype UppercaseLabel = UppercaseLabel String
derive instance newtypeUppercaseLabel :: Newtype UppercaseLabel _
toUpperLabel' :: Label -> UppercaseLabel
toUpperLabel' = over Label String.toUpper
under :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (t -> s) -> a -> b
The opposite of over: lowers a function that operates on Newtyped
values to operate on the wrapped value instead.
newtype Degrees = Degrees Number
derive instance newtypeDegrees :: Newtype Degrees _
newtype NormalDegrees = NormalDegrees Number
derive instance newtypeNormalDegrees :: Newtype NormalDegrees _
normaliseDegrees :: Degrees -> NormalDegrees
normaliseDegrees (Degrees deg) = NormalDegrees (deg % 360.0)
asNormalDegrees :: Number -> Number
asNormalDegrees = under Degrees normaliseDegrees
As with over the Newtype is polymorphic, as illustrated in the example
above - both Degrees and NormalDegrees are instances of Newtype,
so even though normaliseDegrees changes the result type we can still put
a Number in and get a Number out via under.
memoCompose :: forall a b c. (a -> b) -> (b -> c) -> a -> c
Memoize the composition of two functions
foldingWithIndex :: forall f i x y z. FoldingWithIndex f i x y z => f -> i -> x -> y -> z
mapmap :: forall f g a b. Functor f => Functor g => (a -> b) -> f (g a) -> f (g b)
mmap :: forall a b f g. Functor f => Functor g => (a -> b) -> f (g a) -> f (g b)
foldingWithIndex :: forall f i x y z. FoldingWithIndex f i x y z => f -> i -> x -> y -> z
new3 :: forall b a3 a2 a1 o. o -> a1 -> a2 -> a3 -> b
worbler :: forall b a. b -> (b -> b -> a) -> a
W1 combinator - converse warbler
CW
Λ a b . a → (a → a → b) → b
λ x f = f x x
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)
mkQ :: forall a b r. Typeable a => Typeable b => r -> (b -> r) -> a -> r
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
catchError :: forall e m a. MonadError e m => m a -> (e -> m a) -> m a
applyOp :: forall event a b. Applicative event => event a -> event (a -> b) -> event b
sampleOnLeft :: forall event a b. IsEvent event => event a -> event (a -> b) -> event b
sampleOnRight :: forall event a b. IsEvent event => event a -> event (a -> b) -> event b
apApplyFlipped :: forall f b a. Apply f => f a -> f (a -> b) -> f b
sampleOn :: forall event b a. IsEvent event => event a -> event (a -> b) -> event 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.
controlError :: forall f g e a. ErrorControl f g e => f a -> (e -> g a) -> g a
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
apply :: forall a b. (a -> b) -> a -> b
Applies a function to an argument. This is primarily used as the operator
($) which allows parentheses to be omitted in some cases, or as a
natural way to apply a chain of composed functions to a value.
liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b
liftA1 provides a default implementation of (<$>) for any
Applicative functor, without using (<$>) as provided
by the Functor-Applicative superclass
relationship.
liftA1 can therefore be used to write Functor instances
as follows:
instance functorF :: Functor F where
map = liftA1
liftM1 :: forall m a b. Monad m => (a -> b) -> m a -> m b
liftM1 provides a default implementation of (<$>) for any
Monad, without using (<$>) as provided by the
Functor-Monad superclass relationship.
liftM1 can therefore be used to write Functor instances
as follows:
instance functorF :: Functor F where
map = liftM1
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
un :: forall t a. Newtype t a => (a -> t) -> t -> a
Given a constructor for a Newtype, this returns the appropriate unwrap
function.
all :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b
all f is the same as and <<< map f; map a function over the structure,
and then get the conjunction of the results.
any :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b
any f is the same as or <<< map f; map a function over the structure,
and then get the disjunction of the results.
foldMap :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m
foldMap1 :: forall t a m. Foldable1 t => Semigroup m => (a -> m) -> t a -> m
foldMap1DefaultL :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1 using foldl1.
Note: when defining a Foldable1 instance, this function is unsafe to use
in combination with foldl1Default.
foldMap1DefaultR :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1 using foldr1.
Note: when defining a Foldable1 instance, this function is unsafe to use
in combination with foldr1Default.
foldMapDefault :: forall i f a m. FoldableWithIndex i f => Monoid m => (a -> m) -> f a -> m
A default implementation of foldMap using foldMapWithIndex
foldMapDefaultL :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m
A default implementation of foldMap using foldl.
Note: when defining a Foldable instance, this function is unsafe to use
in combination with foldlDefault.
foldMapDefaultR :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m
A default implementation of foldMap using foldr.
Note: when defining a Foldable instance, this function is unsafe to use
in combination with foldrDefault.
mapDefault :: forall i f a b. FunctorWithIndex i f => (a -> b) -> f a -> f b
A default implementation of Functor's map in terms of mapWithIndex
cmap :: forall f a b. Contravariant f => (b -> a) -> f a -> f b
cmapFlipped :: forall a b f. Contravariant f => f a -> (b -> a) -> f b
cmapFlipped is cmap with its arguments reversed.
asks :: forall e1 e2 w a. ComonadAsk e1 w => (e1 -> e2) -> w a -> e2
Get a value which depends on the environment.
tracks :: forall w a t. ComonadTraced t w => (a -> t) -> w a -> a
Extracts a value at a relative position which depends on the current value.
squigglyMap :: forall f a b. Functor f => (a -> b) -> f a -> f b
areads :: forall m r s a. MonadEffect m => Refer s r => (s -> a) -> r -> m a
memoize :: forall a b. Tabulate a => (a -> b) -> a -> b
Memoize a function of one argument
delay :: forall m a b. Delay m => a -> (a -> m b) -> m b
map :: forall p q a b. Dissect p q => (a -> b) -> p a -> p b
A tail-recursive map operation, implemented in terms of Dissect.
memoize :: forall b a. Tabulate a => (a -> b) -> a -> b
Memoize a function of one argument
over :: forall s t a b @sym lenses. IsSymbol sym => ParseSymbol sym lenses => ConstructBarlow lenses Function s t a b => (a -> b) -> s -> t
applicator :: forall b a. (a -> b) -> a -> b
A combinator - applicator
Λ a b . (a → b) → a → b
λ f x . f x
defaultFilter :: forall a h f. BooleanEq h => Applicative f => Foldable f => Monoid (f a) => (a -> h) -> f a -> f a
filter :: forall f h a. Filterable f => BooleanEq h => (a -> h) -> f a -> f a
foldMap :: forall a b s. Convert s (Statements a) => Monoid b => (a -> b) -> s -> b
idstar :: forall b a. (a -> b) -> a -> b
I* combinator - id bird once removed
S(SK)
Λ a b . (a → b) → a → b
λ f x . f x
intercept :: forall a e g f. ErrorControl f g e => f a -> (e -> a) -> g a
liftF :: forall b a f. Applicative f => (a -> b) -> a -> f b
local :: forall a b r. (a -> b) -> (Ask b => r) -> (Ask a => r)
Run a function over an implicit parameter
Note: Be careful while using this to map over the value without updating the type.
-- evaluates to `1`, not `2` provide 1 (local ((*) 2) (ask @Int))
map :: forall a c b. HasMap a => (b -> c) -> a b -> a c
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
mapUndefined :: forall b a. (a -> b) -> a -> b
memoize :: forall a b. (a -> b) -> a -> b
Memoize the function f. If the argument of f differs from the previous call, then f is recomputed.
moldMap :: forall t e m. Moldable t e => Monoid m => (e -> m) -> t -> m
moldMapDefaultL :: forall m e t. Moldable t e => Monoid m => (e -> m) -> t -> m
moldMapDefaultR :: forall m e t. Moldable t e => Monoid m => (e -> m) -> t -> m
A default implementation of moldMap based on moldr
nmap :: forall fa fb a b. NestedFunctor fa fb a b => (a -> b) -> fa -> fb
on :: forall evt obj callback out proxy. On evt obj callback out => proxy evt -> obj -> callback -> out
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
modify :: forall t a. Newtype t a => (a -> a) -> t -> t
This combinator unwraps the newtype, applies a monomorphic function to the contained value and wraps the result back in the newtype
enumFromThenTo :: forall f a. Unfoldable f => Functor f => BoundedEnum a => a -> a -> a -> f a
Returns a sequence of elements from the first value, taking steps according to the difference between the first and second value, up to (but not exceeding) the third value.
enumFromThenTo 0 2 6 = [0, 2, 4, 6]
enumFromThenTo 0 3 5 = [0, 3]
Note that there is no BoundedEnum instance for integers, they're just
being used here for illustrative purposes to help clarify the behaviour.
The example shows Array return values, but the result can be any type
with an Unfoldable1 instance.
censor :: forall w m a. MonadWriter w m => (w -> w) -> m a -> m a
Modify the final accumulator value by applying a function.
local :: forall e w a. ComonadEnv e w => (e -> e) -> w a -> w a
local :: forall r m a. MonadReader r m => (r -> r) -> m a -> m a
peeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> a
Extract a value from a position which depends on the current position.
seeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> w a
Reposition the focus at the specified position, which depends on the current position.
flippedMap :: forall f a b. Functor f => f a -> (a -> b) -> f b
amodify :: forall m r s. MonadEffect m => Refer s r => (s -> s) -> r -> m s
transAnaT :: forall t f. Recursive t f => Corecursive t f => (t -> t) -> t -> t
transCataT :: forall t f. Recursive t f => Corecursive t f => (t -> t) -> t -> t
censorAccum :: forall acc html a. Accum acc html => (acc -> acc) -> html a -> html a
setCtx :: forall ctx html a. Ctx ctx html => (ctx -> ctx) -> html a -> html a
mapErr :: forall e m a. MonadError e m => (e -> e) -> m a -> m a
everywhere :: forall a. Data a => (forall b. Data b => b -> b) -> a -> a
Apply a transformation everywhere, bottom-up
everywhere' :: forall a. Data a => (forall b. Data b => b -> b) -> a -> a
Apply a transformation everywhere, top-down
gmapT :: forall a. Data a => (forall b. Data b => b -> b) -> a -> a
A generic transformation that maps over the immediate subterms
iterate :: forall a u. Unfoldable1 u => (a -> a) -> a -> u a
Create an infinite Unfoldable1 by repeated application of a function to a seed value.
Analogous to iterateN, but with no iteration limit.
This should only be used to produce either lazy types (like lazy Lists) or
types with truncating Unfoldable1 instances (like Maybe).
mkT :: forall a b. Typeable a => Typeable b => (b -> b) -> a -> a
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.
clamp :: forall a. Ord a => a -> a -> a -> a
Clamp a value between a minimum and a maximum. For example:
let f = clamp 0 10
f (-5) == 0
f 5 == 5
f 15 == 10
asks :: forall r m a. MonadAsk r m => (r -> a) -> m a
Projects a value from the global context in a MonadAsk.
gets :: forall s m a. MonadState s m => (s -> a) -> m a
Get a value which depends on the current state.
folding :: forall f x y z. Folding f x y z => f -> x -> y -> z
hfoldl :: forall f x a b. HFoldl f x a b => f -> x -> a -> b
hfoldlWithIndex :: forall f x a b. HFoldlWithIndex f x a b => f -> x -> a -> b
mappingWithIndex :: forall f i a b. MappingWithIndex f i a b => f -> i -> a -> b
resultingWithLength :: forall f n acc x. ResultingWithLength f n acc x => f -> n -> acc -> x
fmodify :: forall m r s. MonadEffect m => Refer s r => r -> (s -> s) -> m s
freads :: forall m r s a. MonadEffect m => Refer s r => r -> (s -> a) -> m a
mreads :: forall m s a. ReferM s m => (s -> a) -> m a
convertOptionsWithDefaults :: forall t defaults provided all. ConvertOptionsWithDefaults t defaults provided all => t -> defaults -> provided -> all
applyTo :: forall f this a b. f -> this -> a -> b
Apply a function to a this object with the given arguments
buildNode :: forall e f p v. ElementBuilder e f p v => e -> f p -> v -> v
_call :: forall b a. a -> (a -> b) -> b
bind :: forall a. Semigroup a => a -> (a -> a) -> a
clamp :: forall a. HasGreater a => HasLess a => a -> a -> a -> a
Clamps a value between some bounds. If the lower bound is greater than the upper bound, they will be swapped.
2 :clamp 3 5 -- 3
4 :clamp 3 5 -- 4
6 :clamp 3 5 -- 5
6 :clamp 5 3 -- 5
curryN :: forall args result curried. CurryN args result curried => (args -> result) -> curried
extract :: forall r x a. TypeEquals r x => r -> (x -> a) -> a
foldEnum :: forall a b. BoundedEnum a => Semigroup b => (a -> b) -> b
Map each element of a BoundedEnum into a semigroup,
and combine the results through refold1.
folding :: forall f x y z. Folding f x y z => f -> x -> y -> z
hfoldl :: forall f x a b. HFoldl f x a b => f -> x -> a -> b
hfoldlWithIndex :: forall f x a b. HFoldlWithIndex f x a b => f -> x -> a -> b
mappingWithIndex :: forall f i a b. MappingWithIndex f i a b => f -> i -> a -> b
new2 :: forall b a2 a1 o. o -> a1 -> a2 -> 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
tabulate :: forall f a b. Representable f a => (a -> b) -> f b
thrush :: forall b a. a -> (a -> b) -> b
T combinator - thrush
CI
Λ a b . a → (a → b) → b
λ x f . f x
fix :: forall l. Lazy l => (l -> l) -> l
fix defines a value as the fixed point of a function.
The Lazy instance allows us to generate the result lazily.
modify :: forall s m. MonadState s m => (s -> s) -> m s
Modify the state by applying a function to the current state. The returned value is the new state value.
mmodify :: forall m s. ReferM s m => (s -> s) -> m s
fix :: forall a. (a -> a) -> a
Fixed point Y combinator
Λ a . (a → a) → a
λ f . (λ x. f (x x)) (λ x . f (x x))
fix :: forall a. (a -> a) -> a
applyFirst :: forall a b f. Apply f => f a -> f b -> f a
Combine two effectful actions, keeping only the result of the first.
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.
alt :: forall f a. Alt f => f a -> f a -> f a
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.
sampleOnLeft_ :: forall event a b. IsEvent event => event a -> event b -> event b
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.
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
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
concat :: forall xs ys zs lproxy. Concat xs ys zs => lproxy xs -> lproxy ys -> lproxy zs
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
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.
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
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
convertOption :: forall field from to sproxy. ConvertOption field from to => sproxy field -> from -> to
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
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
flipScalarMul :: forall k f. VectorField f k => f k -> k -> f k
get :: forall v s r' r l g f. Cons s v r' r => RGet f g s l r => RowToList r l => g s -> f r -> v
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
match :: forall v r1 r0 l1 l0 g f. RMatch f g v l0 r0 l1 r1 => RowToList r0 l0 => RowToList r1 l1 => f r0 -> g r1 -> v
max1 :: forall f a. Ord1 f => f a -> f a -> f a
min1 :: forall f a. Ord1 f => f a -> f a -> f a
onIntegrityError :: forall m a. MonadError PGError m => m a -> m a -> m 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
alt :: forall f a. Alternative f => f a -> f a -> f a
dappend :: forall cnt a. Diff cnt => cnt a -> cnt a -> cnt a
fromFoldableL :: forall a c f. Foldable f => Consable c => c a -> f a -> c a
Conversion from Foldable to Consable using foldl.
fromFoldableL [] [1,2,3,4] == [4,3,2,1]
fromFoldableL [0] [1,2,3,4] == [4,3,2,1,0]
fromFoldableR :: forall a c f. Foldable f => Consable c => c a -> f a -> c a
Conversion from Foldable to Consable using foldr.
fromFoldableR [] [1,2,3,4] == [1,2,3,4]
fromFoldableR [5] [1,2,3,4] == [1,2,3,4,5]
functorDecorateFlipped :: forall b a f. Functor f => Decorate b a => f a -> b -> f b
index :: forall f a b. Representable f a => f b -> (a -> b)
interleave :: forall m a. MonadLogic m => m a -> m a -> m a
snoc :: forall f a. Container f => f a -> a -> f a
add :: forall a. Semiring a => a -> a -> a
append :: forall a. Semigroup a => a -> a -> a
conj :: forall a. HeytingAlgebra a => a -> a -> a
const :: forall a b. a -> b -> a
Returns its first argument and ignores its second.
const 1 "hello" = 1
It can also be thought of as creating a function that ignores its argument:
const 1 = \_ -> 1
disj :: forall a. HeytingAlgebra a => a -> a -> a
div :: forall a. EuclideanRing a => a -> a -> a
gcd :: forall a. Eq a => EuclideanRing a => a -> a -> a
The greatest common divisor of two values.
genericAdd :: forall a rep. Generic a rep => GenericSemiring rep => a -> a -> a
A Generic implementation of the add member from the Semiring type class.
genericAdd' :: forall a. GenericSemiring a => a -> a -> a
genericAppend :: forall a rep. Generic a rep => GenericSemigroup rep => a -> a -> a
A Generic implementation of the append member from the Semigroup type class.
genericAppend' :: forall a. GenericSemigroup a => a -> a -> a
genericConj :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> a
A Generic implementation of the conj member from the HeytingAlgebra type class.
genericConj' :: forall a. GenericHeytingAlgebra a => a -> a -> a
genericDisj :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> a
A Generic implementation of the disj member from the HeytingAlgebra type class.
genericDisj' :: forall a. GenericHeytingAlgebra a => a -> a -> a
genericImplies :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> a
A Generic implementation of the implies member from the HeytingAlgebra type class.
genericImplies' :: forall a. GenericHeytingAlgebra a => a -> a -> a
genericMul :: forall a rep. Generic a rep => GenericSemiring rep => a -> a -> a
A Generic implementation of the mul member from the Semiring type class.
genericMul' :: forall a. GenericSemiring a => a -> a -> a
genericSub :: forall a rep. Generic a rep => GenericRing rep => a -> a -> a
A Generic implementation of the sub member from the Ring type class.
genericSub' :: forall a. GenericRing a => a -> a -> a
implies :: forall a. HeytingAlgebra a => a -> a -> a
lcm :: forall a. Eq a => EuclideanRing a => a -> a -> a
The least common multiple of two values.
leftDiv :: forall a. DivisionRing a => a -> a -> a
Left division, defined as leftDiv a b = recip b * a. Left and right
division are distinct in this module because a DivisionRing is not
necessarily commutative.
If the type a is also a EuclideanRing, then this function is
equivalent to div from the EuclideanRing class. When working
abstractly, div should generally be preferred, unless you know that you
need your code to work with noncommutative rings.
max :: forall a. Ord a => a -> a -> a
Take the maximum of two values. If they are considered equal, the first argument is chosen.
min :: forall a. Ord a => a -> a -> a
Take the minimum of two values. If they are considered equal, the first argument is chosen.
mod :: forall a. EuclideanRing a => a -> a -> a
mul :: forall a. Semiring a => a -> a -> a
rightDiv :: forall a. DivisionRing a => a -> a -> a
Right division, defined as rightDiv a b = a * recip b. Left and right
division are distinct in this module because a DivisionRing is not
necessarily commutative.
If the type a is also a EuclideanRing, then this function is
equivalent to div from the EuclideanRing class. When working
abstractly, div should generally be preferred, unless you know that you
need your code to work with noncommutative rings.
sub :: forall a. Ring a => a -> a -> a
voidRight :: forall f a b. Functor f => a -> f b -> f a
Ignore the return value of a computation, using the specified return value instead.
duplicate :: forall a w. Extend w => w a -> w (w a)
Duplicate a comonadic context.
duplicate is dual to Control.Bind.join.
extract :: forall w a. Comonad w => w a -> a
and :: forall a f. Foldable f => HeytingAlgebra a => f a -> a
The conjunction of all the values in a data structure. When specialized
to Boolean, this function will test whether all of the values in a data
structure are true.
fold :: forall f m. Foldable f => Monoid m => f m -> m
Fold a data structure, accumulating values in some Monoid.
fold1 :: forall t m. Foldable1 t => Semigroup m => t m -> m
Fold a data structure, accumulating values in some Semigroup.
intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> m
Fold a data structure, accumulating values in some Monoid,
combining adjacent elements using the specified separator.
For example:
> intercalate ", " ["Lorem", "ipsum", "dolor"]
= "Lorem, ipsum, dolor"
> intercalate "*" ["a", "b", "c"]
= "a*b*c"
> intercalate [1] [[2, 3], [4, 5], [6, 7]]
= [2, 3, 1, 4, 5, 1, 6, 7]
intercalate :: forall f m. Foldable1 f => Semigroup m => m -> f m -> m
Fold a data structure using a Semigroup instance,
combining adjacent elements using the specified separator.
length :: forall a b f. Foldable f => Semiring b => f a -> b
Returns the size/length of a finite structure. Optimized for structures that are similar to cons-lists, because there is no general way to do better.
maximum :: forall f a. Ord a => Foldable1 f => f a -> a
minimum :: forall f a. Ord a => Foldable1 f => f a -> a
or :: forall a f. Foldable f => HeytingAlgebra a => f a -> a
The disjunction of all the values in a data structure. When specialized
to Boolean, this function will test whether any of the values in a data
structure is true.
product :: forall a f. Foldable f => Semiring a => f a -> a
Find the product of the numeric values in a data structure.
sum :: forall a f. Foldable f => Semiring a => f a -> a
Find the sum of the numeric values in a data structure.
surround :: forall f m. Foldable f => Semigroup m => m -> f m -> m
fold but with each element surrounded by some fixed value.
For example:
> surround "*" []
= "*"
> surround "*" ["1"]
= "*1*"
> surround "*" ["1", "2"]
= "*1*2*"
> surround "*" ["1", "2", "3"]
= "*1*2*3*"
forever :: forall m a b. MonadRec m => m a -> m b
forever runs an action indefinitely, using the MonadRec instance to
ensure constant stack usage.
For example:
main = forever $ trace "Hello, World!"
proof :: forall a b p. TypeEquals a b => p a -> p b
elements :: forall m f a. MonadGen m => Foldable1 f => f a -> m a
Creates a generator that outputs a value chosen from a selection with uniform probability.
unfoldable :: forall m f a. MonadRec m => MonadGen m => Unfoldable f => m a -> m (f a)
Creates a generator that produces unfoldable structures based on an existing generator for the elements.
The size of the unfoldable will be determined by the current size state
for the generator. To generate an unfoldable structure of a particular
size, use the resize function from the MonadGen class first.
enumFromTo :: forall a u. Enum a => Unfoldable1 u => a -> a -> u a
Returns a contiguous sequence of elements from the first value to the second value (inclusive).
enumFromTo 0 3 = [0, 1, 2, 3]
enumFromTo 'c' 'a' = ['c', 'b', 'a']
The example shows Array return values, but the result can be any type
with an Unfoldable1 instance.
coerce :: forall f a b. Contravariant f => Functor f => f a -> f b
ask :: forall e w a. ComonadAsk e w => w a -> e
peek :: forall s w a. ComonadStore s w => s -> w a -> a
pos :: forall s w a. ComonadStore s w => w a -> s
seek :: forall s a w. ComonadStore s w => s -> w a -> w a
Reposition the focus at the specified position.
track :: forall t w a. ComonadTraced t w => t -> w a -> a
inj :: forall f g a. Inject f g => f a -> g a
unwrapCofree :: forall f w a. ComonadCofree f w => w a -> f (w a)
sans :: forall m a b. At m a b => a -> m -> m
fork :: forall f m a. MonadFork f m => m a -> m (f a)
join :: forall f m a. MonadFork f m => f a -> m a
suspend :: forall f m a. MonadFork f m => m a -> m (f a)
uninterruptible :: forall e f m a. MonadBracket e f m => m a -> m a
hmap :: forall f a b. HMap f a b => f -> a -> b
hmapWithIndex :: forall f a b. HMapWithIndex f a b => f -> a -> b
mapping :: forall f a b. Mapping f a b => f -> a -> b
resulting :: forall f acc x. Resulting f acc x => f -> acc -> x
variadic :: forall f acc args. Variadic f acc args => f -> acc -> args
variadicWithIndex :: forall f acc args. VariadicWithIndex f acc args => f -> acc -> args
add :: forall x y z. Add x y z => x -> y -> z
and :: forall b1 b2 b3. And b1 b2 b3 => b1 -> b2 -> b3
div :: forall x y z. Div x y z => x -> y -> z
eq :: forall b1 b2 b3. Eq b1 b2 b3 => b1 -> b2 -> b3
gcd :: forall x y z. GCD x y z => x -> y -> z
imp :: forall b1 b2 b3. Imp b1 b2 b3 => b1 -> b2 -> b3
No further results.