Search results
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.
unsafePartialBecause :: forall a. String -> (Partial => a) -> a
deprecated: use unsafePartial
instead.
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.
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
.
pow :: forall a. Semiring a => a -> Int -> a
Integer power
runFn0 :: forall b a. String -> a -> b
unsafeGetField :: forall b a. String -> a -> b
effect0 :: forall b a. String -> a -> b
m :: forall bem. WithModifiers bem => String -> bem -> bem
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
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 b a. a -> b -> a
Returns its first argument and ignores its second.
const 1 "hello" = 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.
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
.
genericAdd :: forall rep a. 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 rep a. 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 rep a. 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 rep a. 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 rep a. 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 rep a. Generic a rep => GenericSemiring rep => a -> a -> a
A Generic
implementation of the mul
member from the Semiring
type class.