Search results
fromMaybe :: forall a. a -> Maybe a -> aTakes a default value, and a Maybe value. If the Maybe value is
Nothing the default value is returned, otherwise the value inside the
Just is returned.
fromMaybe x Nothing == x
fromMaybe x (Just y) == y
withDefault :: forall a. a -> Maybe a -> aIf the given value is Nothing, return the default. Otherwise return the
value.
withDefault 2 Nothing -- 2
withDefault 2 (Just 1) -- 1
intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> mFold 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 -> mFold a data structure using a Semigroup instance,
combining adjacent elements using the specified separator.
surround :: forall f m. Foldable f => Semigroup m => m -> f m -> mfold 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*"
consMax :: forall a f. Foldable f => Ord a => a -> f a -> aconsMin :: forall a f. Foldable f => Ord a => a -> f a -> apeek :: forall s w a. ComonadStore s w => s -> w a -> atrack :: forall t w a. ComonadTraced t w => t -> w a -> abuildLeaf :: forall e f p v. ElementBuilder e f p v => e -> f p -> vadd :: forall a. Semiring a => a -> a -> aappend :: forall a. Semigroup a => a -> a -> aconj :: forall a. HeytingAlgebra a => a -> a -> aconst :: forall a b. a -> b -> aReturns 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 -> adiv :: forall a. EuclideanRing a => a -> a -> agcd :: forall a. Eq a => EuclideanRing a => a -> a -> aThe greatest common divisor of two values.
genericAdd :: forall a rep. Generic a rep => GenericSemiring rep => a -> a -> aA Generic implementation of the add member from the Semiring type class.
genericAdd' :: forall a. GenericSemiring a => a -> a -> agenericAppend :: forall a rep. Generic a rep => GenericSemigroup rep => a -> a -> aA Generic implementation of the append member from the Semigroup type class.
genericAppend' :: forall a. GenericSemigroup a => a -> a -> agenericConj :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> aA Generic implementation of the conj member from the HeytingAlgebra type class.
genericConj' :: forall a. GenericHeytingAlgebra a => a -> a -> agenericDisj :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> aA Generic implementation of the disj member from the HeytingAlgebra type class.
genericDisj' :: forall a. GenericHeytingAlgebra a => a -> a -> agenericImplies :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a -> aA Generic implementation of the implies member from the HeytingAlgebra type class.
genericImplies' :: forall a. GenericHeytingAlgebra a => a -> a -> agenericMul :: forall a rep. Generic a rep => GenericSemiring rep => a -> a -> aA Generic implementation of the mul member from the Semiring type class.
genericMul' :: forall a. GenericSemiring a => a -> a -> agenericSub :: forall a rep. Generic a rep => GenericRing rep => a -> a -> aA Generic implementation of the sub member from the Ring type class.
genericSub' :: forall a. GenericRing a => a -> a -> aimplies :: forall a. HeytingAlgebra a => a -> a -> alcm :: forall a. Eq a => EuclideanRing a => a -> a -> aThe least common multiple of two values.
leftDiv :: forall a. DivisionRing a => a -> a -> aLeft 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 -> aTake the maximum of two values. If they are considered equal, the first argument is chosen.
min :: forall a. Ord a => a -> a -> aTake the minimum of two values. If they are considered equal, the first argument is chosen.
mod :: forall a. EuclideanRing a => a -> a -> amul :: forall a. Semiring a => a -> a -> arightDiv :: forall a. DivisionRing a => a -> a -> aRight 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 -> acall :: forall s. IsString s => Monoid s => s -> s -> sSyntax for CSS function call.
ract :: forall g s. RightAction g s => s -> g -> smaddL :: forall x r. LeftModule x r => x -> x -> xmaddR :: forall x r. RightModule x r => x -> x -> xmmulR :: forall x r. RightModule x r => x -> r -> xmsubL :: forall x r. LeftModule x r => x -> x -> xmsubR :: forall x r. RightModule x r => x -> x -> xbindTo :: forall f o. f -> o -> fdefaultUndef :: forall a. a -> a -> ajoin :: forall a. JoinSemilattice a => a -> a -> ameet :: forall a. MeetSemilattice a => a -> a -> apathAppend :: forall m. XPathLike m => m -> m -> mPut a path seperator between two XPaths and return the resulting XPath.
pathAppendNSx :: forall m. XPathLike m => m -> m -> mUseful variant of pathAppend needed for some XPath implementations;
insert a separator with a dummy namespace ("x") for the second XPath
fragment. For example:
root /? "record" /? "identifier"  == "/x:record/x:identifier".
and :: forall a. Binary a => a -> a -> ajoin :: forall a. JoinSemilattice a => a -> a -> amaddL :: forall x r. LeftModule x r => x -> x -> xmaddR :: forall x r. RightModule x r => x -> x -> xmeet :: forall a. MeetSemilattice a => a -> a -> ammulR :: forall x r. RightModule x r => x -> r -> xmsubL :: forall x r. LeftModule x r => x -> x -> xmsubR :: forall x r. RightModule x r => x -> x -> xnand :: forall α. HeytingAlgebra α => α -> α -> αnor :: forall α. HeytingAlgebra α => α -> α -> αor :: forall a. Binary a => a -> a -> apatch :: forall a d. Patch a d => a -> d -> areciprocal :: forall n n1 n2 a r. Add n2 1 n1 => Add n1 1 n => Arity a n => Divisible r => Eq r => EuclideanRing r => Leadable r => Ord r => Pad n2 (Polynomial r) a => Peel r r => Unpad n2 (Polynomial r) a => a -> a -> aComputes the reciprocal of the first polynomial in the extension whose minimal polynomial is provided by the second polynomial
xor :: forall a. Binary a => a -> a -> axor :: forall a. HeytingAlgebra a => a -> a -> axor :: forall α. HeytingAlgebra α => α -> α -> α_add :: forall a. HasAdd a => a -> a -> a_and :: forall a. HasAnd a => a -> a -> a_divide :: forall a. HasDivide a => a -> a -> a_multiply :: forall a. HasMultiply a => a -> a -> a_or :: forall a. HasOr a => a -> a -> a_power :: forall a. HasPower a => a -> a -> a_remainder :: forall a. HasRemainder a => a -> a -> a_subtract :: forall a. HasSubtract a => a -> a -> aadd :: forall a. HasAdd a => a -> a -> aalways :: forall b a. a -> b -> aAlways returns the first argument.
"anything" :always 1 -- 1
This is the constant function.
and :: forall a. HasAnd a => a -> a -> aasTypeOf :: forall a. a -> a -> aA type-restricted version of always.
[] :asTypeOf [1] -- [] :: Array Int
decorate :: forall a b. Decorate a b => a -> b -> adivide :: forall a. HasDivide a => a -> a -> agetAllArgs :: forall all given. OptArgs all given => all -> given -> allkestrel :: forall b a. a -> b -> aK combinator - kestrel
K
Λ a b . a → b → a
λ x y . x
max :: forall a. HasGreater a => a -> a -> aReturns the greater value.
max 1 2 -- 2
max 2 1 -- 2
maxByOrder :: forall a. Ord a => a -> a -> amin :: forall a. HasLess a => a -> a -> aReturns the lesser value.
min 1 2 -- 1
min 2 1 -- 1
minByOrder :: forall a. Ord a => a -> a -> amultiply :: forall a. HasMultiply a => a -> a -> aor :: forall a. HasOr a => a -> a -> aor :: forall a. Bitwise a => a -> a -> aplus :: forall a b. Summable a b => a -> b -> aplus :: forall a b. Summable a b => a -> b -> apower :: forall a. HasPower a => a -> a -> aremainder :: forall a. HasRemainder a => a -> a -> ascale :: forall a. Space a => a -> (a -> a)subtract :: forall a. HasSubtract a => a -> a -> awithAttribute :: forall a b. HasAttribute a b => a -> b -> aAdd an attribute to element node
sans :: forall m a b. At m a b => a -> m -> madd :: forall x y z. Add x y z => x -> y -> zand :: forall b1 b2 b3. And b1 b2 b3 => b1 -> b2 -> b3div :: forall x y z. Div x y z => x -> y -> zeq :: forall b1 b2 b3. Eq b1 b2 b3 => b1 -> b2 -> b3gcd :: forall x y z. GCD x y z => x -> y -> zimp :: forall b1 b2 b3. Imp b1 b2 b3 => b1 -> b2 -> b3max :: forall x y z. Max x y z => x -> y -> zmin :: forall x y z. Min x y z => x -> y -> zmod :: forall x y r. Mod x y r => x -> y -> rmul :: forall x y z. Mul x y z => x -> y -> zor :: forall b1 b2 b3. Or b1 b2 b3 => b1 -> b2 -> b3sub :: forall x y z. Sub x y z => x -> y -> ztrich :: forall x y r. Trich x y r => x -> y -> rxor :: forall b1 b2 b3. Xor b1 b2 b3 => b1 -> b2 -> b3hmap :: forall f a b. HMap f a b => f -> a -> bhmapWithIndex :: forall f a b. HMapWithIndex f a b => f -> a -> bmapping :: forall f a b. Mapping f a b => f -> a -> bresulting :: forall f acc x. Resulting f acc x => f -> acc -> xvariadic :: forall f acc args. Variadic f acc args => f -> acc -> argsvariadicWithIndex :: forall f acc args. VariadicWithIndex f acc args => f -> acc -> argsreduce :: forall f i o. Reducible f i o => f -> i -> olact :: forall g s. LeftAction g s => g -> s -> sconvertOptions :: forall t i o. ConvertOptions t i o => t -> i -> odefaults :: forall defaults provided all. Defaults defaults provided all => defaults -> provided -> allmmulL :: forall x r. LeftModule x r => r -> x -> xnew :: forall f a o. f -> a -> oCall new on the function with an array or pseudoarray of arguments
dot :: forall p n. ToPos n p => Semiring n => p -> p -> nGet the dot product of two vectors
mapProduct :: forall mp a b. MapProduct mp a b => mp -> a -> bputInsideMod :: forall r p n. ToRegion n r => AsPosEndo n p => EuclideanRing n => r -> p -> pPut a position inside a region by using the modulus operator
act :: forall m s. Action m s => m -> s -> sConvert a value of type @m@ to an action on @s@ values.
at :: forall c k r. Monoid r => Lookup c k r => c -> k -> rThis simple helper works on any Lookup instance where the return type is
a Monoid, and is the same as lookup except that it returns a t
instead of a Maybe t. If lookup would return Nothing, then at
returns mempty.
at :: forall c k r. Monoid r => Lookup c k r => c -> k -> rThis simple helper works on any Lookup instance where the return type is
a Monoid, and is the same as lookup except that it returns a t
instead of a Maybe t. If lookup would return Nothing, then at
returns mempty.
setCtx :: forall props' props ctx. WithContextProps props' props ctx => ctx -> props' -> propsadjacentSibling :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> cchild :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> cdbg :: forall s a. Show s => s -> a -> adescendant :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> cdiff :: forall a d. Diff a d => a -> a -> dgeneralSibling :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> cmmulL :: forall x r. LeftModule x r => r -> x -> xpursxStringAnonymous :: forall accumulator next res. PursxStringAnonymous accumulator next res => accumulator -> next -> respursxValAnonymous :: forall accumulator next res. PursxValAnonymous accumulator next res => accumulator -> next -> resset :: forall s t a b @sym lenses. IsSymbol sym => ParseSymbol sym lenses => ConstructBarlow lenses Function s t a b => b -> s -> tadd :: forall a b c r. Arith a b c r => a -> b -> cand :: forall a b r. LogicalMatcher a b r => a -> b -> rbind :: forall a g f. f -> a -> gcons :: forall a b r. ConsGen a b r => a -> b -> rdecorateFlipped :: forall b a. Decorate b a => a -> b -> bdiv :: forall a b c r. Arith a b c r => a -> b -> cdot :: forall p g f. Dottable p g f => p -> g -> f