Search results
ensureDirExists :: String -> Aff Unit
loadContents :: String -> Aff Unit
Loads a .env
-compatible string into the environment. This is useful when
sourcing configuration from somewhere other than a local .env
file.
toastS :: String -> Aff Unit
Sends a toast with content being text.
write :: String -> Aff Unit
debug :: forall m. MonadEffect m => String -> m Unit
error :: forall m. MonadEffect m => String -> m Unit
group :: forall m. MonadEffect m => String -> m Unit
groupCollapsed :: forall m. MonadEffect m => String -> m Unit
info :: forall m. MonadEffect m => String -> m Unit
log :: forall m. MonadEffect m => String -> m Unit
time :: forall m. MonadEffect m => String -> m Unit
timeEnd :: forall m. MonadEffect m => String -> m Unit
timeLog :: forall m. MonadEffect m => String -> m Unit
warn :: forall m. MonadEffect m => String -> m Unit
fail :: forall m. MonadThrow Error m => String -> m Unit
tellLn :: forall m. MonadWriter String m => String -> m Unit
log :: forall a. MonadEffect a => String -> a Unit
quickCheck :: forall p. Testable p => p -> Aff Unit
Runs a Testable with a random seed and 100 inputs.
awaitFinished :: forall s a. Write s a => s -> Aff Unit
awaitReadableOrClosed :: forall s a. Read s a => s -> Aff Unit
awaitWritableOrClosed :: forall s a. Write s a => s -> Aff Unit
setFont :: forall m. MonadCanvasAction m => String -> m Unit
abort :: forall tx. IDBTransaction tx => tx -> Aff Unit
Aborts the transaction. All pending requests will fail with a "AbortError" DOMException and all changes made to the database will be reverted.
change :: forall m. Testable m => String -> m Unit
A convenience specialization of fireEvent
, simulating the change
event
with the given value.
find "input" >> change "some text"
clear :: forall store. IDBObjectStore store => store -> Aff Unit
Deletes all records in store.
clickOn :: forall m. Testable m => String -> m Unit
A convenience function, finding an element by CSS selector and simulating
the click
event on it.
clickOn "button.t--my-button"
close :: forall db. IDBDatabase db => db -> Aff Unit
Closes the connection once all running transactions have finished.
delay :: forall d. Duration d => d -> Aff Unit
delete :: forall ma. MonadAff ma => String -> ma Unit
Deletes the database called dbName
.
If the database does not exist this method will still succeed.
Documentation: dexie.org/docs/Dexie/Dexie.delete()
delete :: forall cursor. IDBCursor cursor => cursor -> Aff Unit
Delete the record pointed at by the cursor with a new value.
dive :: forall m. MonadState (List String) m => String -> m Unit
el_ :: forall m. MonadDomBuilder m => String -> m Unit
error :: forall eff m. MonadEff (console :: CONSOLE | eff) m => String -> m Unit
info :: forall eff m. MonadEff (console :: CONSOLE | eff) m => String -> m Unit
loadSimpleJsonFile :: forall a. ReadForeign a => String -> Aff a
log :: forall eff m. MonadEff (console :: CONSOLE | eff) m => String -> m Unit
log :: forall m. MonadIOSync m => String -> m Unit
logError :: forall m. MonadIOSync m => String -> m Unit
logInfo :: forall m. MonadIOSync m => String -> m Unit
logWarning :: forall m. MonadIOSync m => String -> m Unit
rawHtml :: forall m. MonadDomBuilder m => String -> m Unit
taddle :: forall m a. MonadTell (List (Tuple a String)) m => MonadState a m => String -> m Unit
text :: forall d. Syntax d => String -> d Unit
text
parses/prints a fixed text and consumes/produces a unit value.
text :: forall m. MonadDomBuilder m => String -> m Unit
usePushRoute :: forall m. Router m => String -> m Unit
Push a new Route to the browser history.
useReplaceRoute :: forall m. Router m => String -> m Unit
Replace the current Route in the browser history.
warn :: forall eff m. MonadEff (console :: CONSOLE | eff) m => String -> m Unit
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.
debugShow :: forall m a. MonadEffect m => Show a => a -> m Unit
errorShow :: forall m a. MonadEffect m => Show a => a -> m Unit
infoShow :: forall m a. MonadEffect m => Show a => a -> m Unit
logShow :: forall m a. MonadEffect m => Show a => a -> m Unit
warnShow :: forall m a. MonadEffect m => Show a => a -> m Unit
put :: forall m s. MonadState s m => s -> m Unit
Set the state.
tell :: forall w m. MonadTell w m => w -> m Unit
unsafeThrow :: forall a. String -> a
Defined as unsafeThrowException <<< error
.
discard :: forall a m. Monad m => a -> m Unit
Discards a value
impossible :: forall a. String -> a
traceM :: forall m a. DebugWarning => Monad m => a -> m Unit
Log any PureScript value to the console and return the unit value of the
Monad m
.
fromString :: forall s. IsString s => String -> s
url :: forall a. URL a => String -> a
fromString :: forall a. IsString a => String -> a
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
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)
stringValue :: forall a. Value a => String -> a
clearRect :: forall m r. MonadCanvasAction m => ToRegion Number r => r -> m Unit
Clear a rectangular area
fillRect :: forall m r. MonadCanvasAction m => ToRegion Number r => r -> m Unit
Fill a rectangular area
setFillStyle :: forall m r. MonadCanvasAction m => CanvasStyle r => r -> m Unit
setShadowColor :: forall m color. MonadCanvasAction m => CanvasColor color => color -> m Unit
setShadowOffset :: forall m p. MonadCanvasAction m => ToPos Number p => p -> m Unit
Set x and y shadow offset at the same time
setStrokeStyle :: forall m r. MonadCanvasAction m => CanvasStyle r => r -> m Unit
strokeRect :: forall m r. MonadCanvasAction m => ToRegion Number r => r -> m Unit
Stroke a rectangular area
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!
string :: forall t. Corecursive t EJsonF => String -> t
to1 :: forall f rep. Generic1 f rep => rep -> f Unit
act_ :: forall a m. Mother m => a -> m Unit
crash :: forall m a. Testable m => String -> m a
delay :: forall m d. MonadAff m => Duration d => d -> m Unit
emptyHandler :: forall m a. Applicative m => a -> m Unit
an empty event handler
errorShow :: forall eff m a. Show a => MonadEff (console :: CONSOLE | eff) m => a -> m Unit
exec_ :: forall m q. MonadSession m => AsQuery q => q -> m Unit
Executes a query and discards the result
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
ident :: forall f t. Corecursive t (SqlF f) => String -> t
infoShow :: forall eff m a. Show a => MonadEff (console :: CONSOLE | eff) m => a -> m Unit
logDebug :: forall m a. MonadLog m => Loggable a => a -> m Unit
logError :: forall m a. MonadLog m => Loggable a => a -> m Unit
logInfo :: forall m a. MonadLog m => Loggable a => a -> m Unit
logShow :: forall eff m a. Show a => MonadEff (console :: CONSOLE | eff) m => a -> m Unit
logWarning :: forall m a. MonadLog m => Loggable a => a -> m Unit
onElement :: forall e m. Feed e m => e -> m Unit
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
property' :: forall a. String -> a
read :: forall a. Read a => Partial => String -> a
require :: forall a. String -> a
string :: forall t. Corecursive t (SqlF EJsonF) => String -> t
unexpected :: forall m a. Parsing m => String -> m a
unsafeUnserialize :: forall m. UnserializeState m => String -> m
updateStore :: forall a s m. MonadStore a s m => a -> m Unit
warnShow :: forall eff m a. Show a => MonadEff (console :: CONSOLE | eff) m => a -> m Unit
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.
downFromIncluding :: forall a u. Enum a => Unfoldable1 u => a -> u a
Produces all predecessors of an Enum
value, including the start value.
downFromIncluding top
will return all values in an Enum
, in reverse
order.
upFrom :: forall a u. Enum a => Unfoldable u => a -> u a
Produces all successors of an Enum
value, excluding the start value.
upFromIncluding :: forall a u. Enum a => Unfoldable1 u => a -> u a
Produces all successors of an Enum
value, including the start value.
upFromIncluding bottom
will return all values in an Enum
.
throwError :: forall e m a. MonadThrow e m => e -> m a
convertDuration :: forall a b. Duration a => Duration b => a -> b
Converts directly between durations of differing types.
negateDuration :: forall a. Duration a => a -> a
Negates a duration, turning a positive duration negative or a negative duration positive.
coerce :: forall a b. Coercible a b => a -> b
Coerce a value of one type to a value of some other type, without changing
its runtime representation. This function behaves identically to
unsafeCoerce
at runtime. Unlike unsafeCoerce
, it is safe, because the
Coercible
constraint prevents any use of this function from compiling
unless the compiler can prove that the two types have the same runtime
representation.
One application for this function is to avoid doing work that you know is a
no-op because of newtypes. For example, if you have an Array (Conj a)
and you
want an Array (Disj a)
, you could do Data.Array.map (un Conj >>> Disj)
, but
this performs an unnecessary traversal of the array, with O(n) cost.
coerce
accomplishes the same with only O(1) cost:
mapConjToDisj :: forall a. Array (Conj a) -> Array (Disj a)
mapConjToDisj = coerce
div10 :: forall x q. Div10 x q => x -> q
isDivBy :: forall d x. IsDivBy d x => d -> x
mul10 :: forall x q. Mul10 x q => x -> q
not :: forall b1 b2. Not b1 b2 => b1 -> b2
pred :: forall x y. Pred x y => x -> y
succ :: forall x y. Succ x y => x -> y
cast :: forall a b. Castable a b => a -> b
coerce :: forall expected given. Coerce given expected => given -> expected
coerce :: forall expected given. Coerce given expected => given -> expected
ginverse :: forall g. Group g => g -> g
convertTo :: forall t f r. Recursive t f => Corecursive r f => t -> r
fill :: forall partial complete. Fillable partial complete => partial -> complete
justify :: forall unjust just. Justifiable unjust just => unjust -> just
lambek :: forall t f. Recursive t f => Corecursive t f => t -> f t
mnegateL :: forall r x. LeftModule x r => x -> x
mnegateR :: forall r x. RightModule x r => x -> x
nextPrime :: forall a. Ord a => Semiring a => EuclideanRing a => a -> a
Ad infinitum
pad :: forall @n a b. Pad n a b => a -> b
project :: forall t f. Recursive t f => t -> f t
unpad :: forall @n a b. Unpad n a b => b -> a
area :: forall s n. ToSize n s => Semiring n => s -> n
Get the area of a size
convertPos :: forall p1 p2 n. ToPos n p1 => FromPos n p2 => p1 -> p2
convertRegion :: forall p1 p2 n. ToRegion n p1 => FromRegion n p2 => p1 -> p2
convertSize :: forall p1 p2 n. ToSize n p1 => FromSize n p2 => p1 -> p2
init :: forall fn a. Init fn a => fn -> a
initProduct :: forall f a. InitProduct f a => f -> a
measure :: forall a v. Measured a v => a -> v
midPos :: forall s p n. ToRegion n s => FromPos n p => EuclideanRing n => s -> p
Get the center position of a region
perimeter :: forall s n. ToSize n s => Semiring n => s -> n
Get the perimeter of a size
ratio :: forall s n. ToSize n s => EuclideanRing n => s -> n
Get the ratio of a size by dividing the width by the height
sequenceProduct :: forall specI specO f. SequenceProduct specI specO f => specI -> f specO
undefer :: forall a. (Deferred => a) -> a
Note: use of this function may result in arbitrary side effects.
always :: forall a b. Always a b => a -> b
at :: forall m. XPathLike m => m -> m
Prepend an '@'
complement :: forall p. Bounded p => Ring p => p -> p
convert :: forall b a. TokenUnit a => TokenUnit b => a -> b
Convert between two denominations
debugger :: forall a. a -> a
Inserts a JavaScript debugger
statement, then returns its argument.
dir :: forall a. a -> a
Calls console.dir
with its argument, then returns it.
inj :: forall l a. Includes l a => a -> l
Inject a value into an otherwise empty heterogeneous list.
log :: forall a. a -> a
Calls console.log
with its argument, then returns it.
-- log a value as it's used
func a = todo $ log a
-- explicitly log an argument because it may not be used
func a =
let
_ = log a
in
todo
-- log the value inside a functor
func ma = do
a <- log <$> pure ma
todo
logShow :: forall a. Show a => a -> a
For an argument a
, calls console.log
on show a
, then returns a
.
nextSibling :: forall n m. IsNode n => IsNode m => n -> m
Gets the next sibling
parentNode :: forall n m. IsNode n => IsNode m => n -> m
prevSibling :: forall n m. IsNode n => IsNode m => n -> m
Gets the previous sibling
pure :: forall v f c. HasPure c f => ObjectOf c v => v -> f v
tUnit :: forall u1 u0 bf c. HasTUnit c bf u0 u1 => HasUnit c u1 => u0 -> u1
unsafeDir :: forall a b. a -> b
Like dir
except it coerces the input to any type.
unsafeLog :: forall a b. a -> b
Like log
except it coerces the input to any type.
xx :: forall m. XPathLike m => m -> m
Prepend a dummy namespace
abs :: forall a. Num a => a -> a
asTS :: forall b a. IsTSEq a b => a -> b
bottom1_ :: forall f a. Bottom1_ f => a -> f a
bottom2 :: forall f a b. Bottom2 f a => a -> f b
coerce :: forall a b. Coercible a b => a -> b
convertImpl :: forall input output. ToInternalConverter input output => input -> output
dbgs :: forall s. Show s => s -> s
embed :: forall a r. Algebra a r => r -> a
foldLineNames :: forall i o. FoldLineNames i o => i -> o
foldOf :: forall s t a b @sym lenses. IsSymbol sym => ParseSymbol sym lenses => ConstructBarlow lenses (Forget a) s t a b => s -> a
fromFractional :: forall b a. Fractional a => Fractional b => a -> b
A helper function for general conversion between Fractional
values.
fromIntegral :: forall b a. Integral a => Integral b => a -> b
A helper function for general conversion between Integral
values.
hasJSRep :: forall a. HasJSRep a => a -> a
magicProps :: forall props. props -> props
mkPrim :: forall a b. Primitive a b => a -> b
mnegateL :: forall r x. LeftModule x r => x -> x
mnegateR :: forall r x. RightModule x r => x -> x
negate :: forall a. Num a => a -> a
not :: forall a. Binary a => a -> a
px :: forall next res. PursxStringAnonymous ((Proxy "a") /\ (Proxy "") /\ (Record ())) next res => next -> res