Search results
formatInt :: String -> Int -> String
compile :: forall a. String -> a -> String
Compile a string into a template which can be applied to a context.
This function should be partially applyied, resulting in a compiled function which can be reused, instead of compiling the template on each application.
Note: This function performs no verification on the template string, so it is recommended that an appropriate type signature be given to the resulting function. For example:
hello :: { name :: String } -> String
hello = compile "Hello, {{name}}!"
declareFlowType' :: forall a. HasFlowRep a => String -> a -> String
A convenience function for declaring types taking a concrete value over a proxy.
generateFlowType' :: forall a. HasFlowRep a => String -> a -> String
A convenience function for generating types taking a concrete value over a proxy.
s :: forall a. String -> a -> String
Separator
power :: forall m. Monoid m => m -> Int -> m
Append a value to itself a certain number of times. For the
Multiplicative
type, and for a non-negative power, this is the same as
normal number exponentiation.
If the second argument is negative this function will return mempty
(unlike normal number exponentiation). The Monoid
constraint alone
is not enough to write a power
function with the property that power x
n
cancels with power x (-n)
, i.e. power x n <> power x (-n) = mempty
.
For that, we would additionally need the ability to invert elements, i.e.
a Group.
power [1,2] 3 == [1,2,1,2,1,2]
power [1,2] 1 == [1,2]
power [1,2] 0 == []
power [1,2] (-3) == []
spy :: forall a. DebugWarning => String -> a -> a
Logs any value and returns it, using a "tag" or key value to annotate the traced value. Useful when debugging something in the middle of a expression, as you can insert this into the expression without having to break it up.
repeat :: forall a. Monoid a => a -> Int -> a
power :: forall g. Group g => g -> Int -> g
Append a value (or its inverse) to itself a certain number of times.
For the Additive Int
type, this is the same as multiplication.
pow :: forall a. Semiring a => a -> Int -> a
Integer power
getProperty :: forall o v. String -> o -> v
Get the property with the given name form the given object
If property does not exist, will be undefined (see F.S.Undef
)
named :: forall o. String -> o -> o
Return the object with a custom name Notes:
name
is a readonly property, so we define over it- quietly mutates the input - use immediately after creation
removeProperty :: forall o. String -> o -> o
runFn0 :: forall b a. String -> a -> b
taggedLog :: forall a. String -> a -> a
For a string t
and value a
, calls console.log(t, a)
, then returns a
.
taggedLogShow :: forall a. Show a => String -> a -> a
For a string t
and value a
, calls console.log(t, (show a))
, then returns a
.
unsafeGetField :: forall b a. String -> a -> b
attr :: forall m. Testable m => String -> m String
Returns the given attribute of the current-context element.
destroyUnit :: forall audio engine. AudioInterpret audio engine => String -> audio -> engine
Destroy pointer x. For example, drop a sine wave oscillator from an audio graph. Note that this does not invoke garbage collection - it just removes the reference to the node, allowing it to be garbage collected.
effect0 :: forall b a. String -> a -> b
m :: forall bem. WithModifiers bem => String -> bem -> bem
makeLoopBufWithDeferredBuffer :: forall audio engine. AudioInterpret audio engine => String -> audio -> engine
Make a looping audio buffer node with a deferred buffer.
makePeriodicOscWithDeferredOsc :: forall audio engine. AudioInterpret audio engine => String -> audio -> engine
Make a periodic oscillator.
makePlayBufWithDeferredBuffer :: forall audio engine. AudioInterpret audio engine => String -> audio -> engine
Make an audio buffer node with a deferred buffer.
question :: forall m e. MonadAff (console :: CONSOLE, readline :: READLINE | e) m => MonadAsk Interface m => String -> m String
Prompt for input, then read a line
runThisFn0 :: forall a this. String -> this -> a
translate :: forall x y. IsLength x => IsLength y => x -> y -> String
translate (px 40.0) (px 30.0) → "translate(40px,30px)"
unsafeField :: forall val obj. String -> obj -> val
unsafeLog :: forall a. String -> a -> a
Unsafely write a string to the console.
unsafeLog "unsafe!" unit -- unit (logs "unsafe!")
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
crashWith :: forall a. Partial => String -> a
A partial function which crashes on any input with the specified message.
unsafeCrashWith :: forall a. String -> a
A function which crashes with the specified error message.
unsafeThrow :: forall a. String -> a
Defined as unsafeThrowException <<< error
.
impossible :: forall a. String -> a
sans :: forall m a b. At m a b => a -> m -> m
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
max :: forall x y z. Max x y z => x -> y -> z
min :: forall x y z. Min x y z => x -> y -> z
mod :: forall x y r. Mod x y r => x -> y -> r
mul :: forall x y z. Mul x y z => x -> y -> z
or :: forall b1 b2 b3. Or b1 b2 b3 => b1 -> b2 -> b3
sub :: forall x y z. Sub x y z => x -> y -> z
trich :: forall x y r. Trich x y r => x -> y -> r
xor :: forall b1 b2 b3. Xor b1 b2 b3 => b1 -> b2 -> b3
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
call :: forall s. IsString s => Monoid s => s -> s -> s
Syntax for CSS function call.
fromString :: forall s. IsString s => String -> s
url :: forall a. URL a => String -> a
reduce :: forall f i o. Reducible f i o => f -> i -> o
lact :: forall g s. LeftAction g s => g -> s -> s
ract :: forall g s. RightAction g s => s -> g -> s
convertOptions :: forall t i o. ConvertOptions t i o => t -> i -> o
defaults :: forall defaults provided all. Defaults defaults provided all => defaults -> provided -> all
fromString :: forall a. IsString a => String -> a
maddL :: forall x r. LeftModule x r => x -> x -> x
maddR :: forall x r. RightModule x r => x -> x -> x
mmulL :: forall x r. LeftModule x r => r -> x -> x
mmulR :: forall x r. RightModule x r => x -> r -> x
msubL :: forall x r. LeftModule x r => x -> x -> x
msubR :: forall x r. RightModule x r => x -> x -> x
readDefault :: forall a. Read a => Zero a => String -> a
Read a value a
from a String
but fallback on Zero a
on failure
text :: forall html a. Html html => String -> html a
bindTo :: forall f o. f -> o -> f
defaultUndef :: forall a. a -> a -> a
new :: forall f a o. f -> a -> o
Call new on the function with an array or pseudoarray of arguments
unsafeGlobal :: forall t. String -> t
Like global, but for when you're really sure it exists and are
willing to tolerate it being quietly undefined (or plan to use
the Undef
module functions)
dot :: forall p n. ToPos n p => Semiring n => p -> p -> n
Get the dot product of two vectors
mapProduct :: forall mp a b. MapProduct mp a b => mp -> a -> b
putInsideMod :: forall r p n. ToRegion n r => AsPosEndo n p => EuclideanRing n => r -> p -> p
Put a position inside a region by using the modulus operator
stringValue :: forall a. Value a => String -> a
act :: forall m s. Action m s => m -> s -> s
Convert a value of type @m@ to an action on @s@ values.
at :: forall c k r. Monoid r => Lookup c k r => c -> k -> r
This 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 -> r
This 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
.
join :: forall a. JoinSemilattice a => a -> a -> a
meet :: forall a. MeetSemilattice a => a -> a -> a
pathAppend :: forall m. XPathLike m => m -> m -> m
Put a path seperator between two XPaths and return the resulting XPath.
pathAppendNSx :: forall m. XPathLike m => m -> m -> m
Useful 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"
.
setCtx :: forall props' props ctx. WithContextProps props' props ctx => ctx -> props' -> props
adjacentSibling :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> c
and :: forall a. Binary a => a -> a -> a
child :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> c
dbg :: forall s a. Show s => s -> a -> a
descendant :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> c
diff :: forall a d. Diff a d => a -> a -> d
generalSibling :: forall a b c. IsExtensibleSelector a => ToVal a => Combine b c => a -> b -> c
join :: forall a. JoinSemilattice a => a -> a -> a
maddL :: forall x r. LeftModule x r => x -> x -> x
maddR :: forall x r. RightModule x r => x -> x -> x
meet :: forall a. MeetSemilattice a => a -> a -> a
mmulL :: forall x r. LeftModule x r => r -> x -> x
mmulR :: forall x r. RightModule x r => x -> r -> x
msubL :: forall x r. LeftModule x r => x -> x -> x
msubR :: forall x r. RightModule x r => x -> x -> x
nand :: forall α. HeytingAlgebra α => α -> α -> α
nor :: forall α. HeytingAlgebra α => α -> α -> α
or :: forall a. Binary a => a -> a -> a
patch :: forall a d. Patch a d => a -> d -> a
pursxStringAnonymous :: forall accumulator next res. PursxStringAnonymous accumulator next res => accumulator -> next -> res
pursxValAnonymous :: forall accumulator next res. PursxValAnonymous accumulator next res => accumulator -> next -> res
reciprocal :: 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 -> a
Computes the reciprocal of the first polynomial in the extension whose minimal polynomial is provided by the second polynomial
set :: forall s t a b @sym lenses. IsSymbol sym => ParseSymbol sym lenses => ConstructBarlow lenses Function s t a b => b -> s -> t
string :: forall t. Corecursive t EJsonF => String -> t
xor :: forall a. Binary a => a -> a -> a
xor :: forall a. HeytingAlgebra a => a -> a -> a
xor :: 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 -> a
add :: forall a. HasAdd a => a -> a -> a
add :: forall a b c r. Arith a b c r => a -> b -> c
always :: forall b a. a -> b -> a
Always returns the first argument.
"anything" :always 1 -- 1
This is the constant function.
and :: forall a. HasAnd a => a -> a -> a
and :: forall a b r. LogicalMatcher a b r => a -> b -> r
asTypeOf :: forall a. a -> a -> a
A type-restricted version of always
.
[] :asTypeOf [1] -- [] :: Array Int
bind :: forall a g f. f -> a -> g
cons :: forall a b r. ConsGen a b r => a -> b -> r
crash :: forall m a. Testable m => String -> m a
decorate :: forall a b. Decorate a b => a -> b -> a
decorateFlipped :: forall b a. Decorate b a => a -> b -> b
diff' :: forall changed model. Diff changed model => changed -> (model -> model)
div :: forall a b c r. Arith a b c r => a -> b -> c
divide :: forall a. HasDivide a => a -> a -> a
dot :: forall p g f. Dottable p g f => p -> g -> f
fold :: forall stepper a fold. Fold stepper a fold => stepper -> a -> fold
from :: forall f q fields sql. ToFrom f q fields => Resume q (From f fields E) sql => f -> q -> sql
FROM accepts the following sources
- Tables
- Inner and outer joins
- Aliased tables
- Aliased SELECT statements
Due to how SQL binding works, joins and subqueries require brackets to be parsed correctly. For example:
SELECT column FROM (SELECT column FROM table) AS alias
should beselect column # from (select column # from table # as alias)
)SELECT column FROM table alias JOIN other_table other_alias
should beselect column # from ((table # as alias)
join(other_table # as other_alias))
)
To aid composition, SELECT projections are only validated on FROM
fromDefault :: forall mod m. MonadAff m => String -> m mod
Import a module with a default
export
fromString :: forall a. Utf8Encodable a => String -> a
fromString :: forall a. Utf8Encodable a => String -> a
getAllArgs :: forall all given. OptArgs all given => all -> given -> all
groupBy :: forall f s q sql grouped columns. ToGroupBy q s columns => GroupedColumns f columns grouped => ValidGroupByProjection s grouped => Resume q (GroupBy f E) sql => f -> q -> sql
GROUP BY statement
hmap :: forall f a b. HMap f a b => f -> a -> b
hmapWithIndex :: forall f a b. HMapWithIndex f a b => f -> a -> b
ident :: forall f t. Corecursive t (SqlF f) => String -> t
interp :: forall a. Interp a => String -> a
Use the derived function, i
, instead of this function to do
string interpolation. Otherwise, you will get a compiler error
if the first value is not a String
:
interp "a" 42 true == "a42true"
i "a" 42 true == "a42true"
interp 42 "a" -- does not compile!
i 42 "a" -- compiles!
investigate :: forall b a. Warn "Debug.Trace usage" => Show a => a -> b -> b
Once in a while, we all need to debug. A lot of programmers from imperative
languages find real trouble with debugging, as they can't just bung in a
console.log
to see values. Well, what if I told you... you can! So,
we can cheat a little bit, and use some escape hatches in the Debug
package, including traceShow
, which will log anything Show
able. With
this function, we can show a value at any point, and return anything!
kestrel :: forall b a. a -> b -> a
K combinator - kestrel
K
Λ a b . a → b → a
λ x y . x
mapping :: forall f a b. Mapping f a b => f -> a -> b
max :: forall a. HasGreater a => a -> a -> a
Returns the greater value.
max 1 2 -- 2
max 2 1 -- 2
maxByOrder :: forall a. Ord a => a -> a -> a
min :: forall a. HasLess a => a -> a -> a
Returns the lesser value.
min 1 2 -- 1
min 2 1 -- 1
minByOrder :: forall a. Ord a => a -> a -> a
mod_ :: forall a b c r. Arith a b c r => a -> b -> c
mul :: forall a b c r. Arith a b c r => a -> b -> c
multiply :: forall a. HasMultiply a => a -> a -> a
new1 :: forall b a1 o. o -> a1 -> b
oneShotChange :: forall tau p au. OneShotChange tau p au => tau -> p -> au
or :: forall a. HasOr a => a -> a -> a
or :: forall a b r. LogicalMatcher a b r => a -> b -> r
or :: forall a. Bitwise a => a -> a -> a
orderBy :: forall f q sql. ToOrderBy f q => Resume q (OrderBy f E) sql => f -> q -> sql
ORDER BY statement
parse :: forall a. Router a => String -> a
parseError :: forall e. OwoifyError e => String -> e
Representing general parser error. Currently not used.
parseSlot' :: forall a. EmptyableSlot a => String -> a
perform :: forall a o op. SymbioteOperation a o op => op -> a -> o
plus :: forall a b. Summable a b => a -> b -> a
plus :: forall a b. Summable a b => a -> b -> a
pow :: forall a b c r. Arith a b c r => a -> b -> c
power :: forall a. HasPower a => a -> a -> a
property :: forall c b a. a -> b -> c
property' :: forall a. String -> a
provide :: forall result a. a -> (Ask a => result) -> result
Provide an implicit parameter to a computation which requires it
queryReturnsImpl :: forall schema query returns. QueryReturns schema query returns => schema -> query -> returns
Do not use this. Use queryReturns
instead. Only exported due to compiler restrictions
read :: forall a. Read a => Partial => String -> a
remainder :: forall a. HasRemainder a => a -> a -> a
require :: forall a. String -> a
resume :: forall a b c. Resume a b c => a -> b -> c
returning :: forall f q sql. ToReturning f q => Resume q (Returning f) sql => f -> q -> sql
rotate :: forall input tail output. ArgsRotater input tail output => input -> tail -> output
scale :: forall a. Space a => a -> (a -> a)
scoped :: forall f output mod. Scoped f output => mod -> f -> output
string :: forall t. Corecursive t (SqlF EJsonF) => String -> t
sub :: forall a b c r. Arith a b c r => a -> b -> c
subtract :: forall a. HasSubtract a => a -> a -> a
transform :: forall function return constructor. EtaConversionTransformer function return constructor => constructor -> function -> return
transformFlipped :: forall function return constructor. EtaConversionTransformer function return constructor => function -> constructor -> return
transformWith :: forall function return constructor. WithInputEtaConversionTransformer function return constructor => constructor -> function -> return
transformWithFlipped :: forall function return constructor. WithInputEtaConversionTransformer function return constructor => function -> constructor -> return
tupleRev :: forall t1 acc t2. TupleRev t1 acc t2 => t1 -> acc -> t2
unexpected :: forall m a. Parsing m => String -> m a
unionObject :: forall from to. ObjectUnion from to => from -> to -> to
unsafeAdd :: forall a b c. a -> b -> c
unsafeDiv :: forall a b c. a -> b -> c
unsafeMod :: forall a b c. a -> b -> c
unsafeMul :: forall a b c. a -> b -> c
unsafePow :: forall a b c. a -> b -> c
unsafeSub :: forall a b c. a -> b -> c
unsafeUnserialize :: forall m. UnserializeState m => String -> m
unsafeWithChildren :: forall c p. c -> p -> p
wher :: forall c q sql. ToWhere c q => Resume q (Where c E) sql => c -> q -> sql
WHERE statement
withAttribute :: forall a b. HasAttribute a b => a -> b -> a
Add an attribute to element node
abs :: forall a. Ord a => Ring a => a -> a
The absolute value function. abs x
is defined as if x >= zero then x
else negate x
.
from :: forall a rep. Generic a rep => a -> rep
genericNot :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a
A Generic
implementation of the not
member from the HeytingAlgebra
type class.
genericNot' :: forall a. GenericHeytingAlgebra a => a -> a
negate :: forall a. Ring a => a -> a
negate x
can be used as a shorthand for zero - x
.
not :: forall a. HeytingAlgebra a => a -> a
pure :: forall f a. Applicative f => a -> f a
recip :: forall a. DivisionRing a => a -> a
signum :: forall a. Ord a => Ring a => a -> a
The sign function; returns one
if the argument is positive,
negate one
if the argument is negative, or zero
if the argument is zero
.
For floating point numbers with signed zeroes, when called with a zero,
this function returns the argument in order to preserve the sign.
For any x
, we should have signum x * abs x == x
.
to :: forall a rep. Generic a rep => rep -> a
unwrap :: forall t a. Newtype t a => t -> a
wrap :: forall t a. Newtype t a => a -> t
unsafeCoerce :: forall a b. a -> b
A highly unsafe function, which can be used to persuade the type system that any type is the same as any other type. When using this function, it is your (that is, the caller's) responsibility to ensure that the underlying representation for both types is the same.
Because this function is extraordinarily flexible, type inference can greatly suffer. It is highly recommended to define specializations of this function rather than using it as-is. For example:
fromBoolean :: Boolean -> Json
fromBoolean = unsafeCoerce
This way, you won't have any nasty surprises due to the inferred type being different to what you expected.
After the v0.14.0 PureScript release, some of what was accomplished via
unsafeCoerce
can now be accomplished via coerce
from
purescript-safe-coerce
. See that library's documentation for more
context.
inj :: forall a b. Inject a b => a -> b
unsafePartial :: forall a. (Partial => a) -> a
Discharge a partiality constraint, unsafely.
singleton :: forall f a. Unfoldable1 f => a -> f a
Contain a single value. For example:
singleton "foo" == (NEL.singleton "foo" :: NEL.NonEmptyList String)
from :: forall a b. TypeEquals a b => b -> a
to :: forall a b. TypeEquals a b => a -> b
downFrom :: forall a u. Enum a => Unfoldable u => a -> u a
Produces all predecessors of an Enum
value, excluding the start value.
No further results.