Search results
toNumber :: Int -> Number
Converts an Int
value back into a Number
. Any Int
is a valid Number
so there is no loss of precision with this function.
toNumber :: Int -> Number
Converts an integer into a number.
toNumber 1 -- 1.0
fromInt :: forall a. IntLiftable a => Int -> a
timeStamp :: forall e. IsEvent e => e -> Number
The time in milliseconds between 01/01/1970 and when the event was dispatched.
diagonal :: forall s. ToSize Number s => s -> Number
Get the diagonal of a size
length :: forall p. ToPos Number p => p -> Number
Get the length of a position vector
timestamp :: forall e. IsEvent e => e -> Number
When the event was generated
fromInt :: forall a. Ring a => Int -> a
number :: forall a. ToNumber a => a -> Number
_angle :: forall g. IsGraphObject g => g -> Number
_autoScrollInterval :: forall d. IsDiagram d => d -> Number
_centerX :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_centerY :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_column :: forall g. IsGraphObject g => g -> Number
_columnCount :: forall p. IsPanel p => p -> Number
_columnSpan :: forall g. IsGraphObject g => g -> Number
_defaultRowSeparatorStrokeWidth :: forall p. IsPanel p => p -> Number
_defaultScale :: forall d. IsDiagram d => d -> Number
_edgesCount :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_focusX :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_focusY :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_fromEndSegmentLength :: forall g. IsGraphObject g => g -> Number
_fromMaxLinks :: forall g. IsGraphObject g => g -> Number
_fromShortLength :: forall g. IsGraphObject g => g -> Number
_graduatedMax :: forall p. IsPanel p => p -> Number
_graduatedMin :: forall p. IsPanel p => p -> Number
_graduatedRange :: forall p. IsPanel p => p -> Number
_graduatedTickUnit :: forall p. IsPanel p => p -> Number
_height :: forall g. IsGraphObject g => g -> Number
_height :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_initialScale :: forall d. IsDiagram d => d -> Number
_itemIndex :: forall p. IsPanel p => p -> Number
_layoutConditions :: forall p. IsPart p => p -> Number
_leftIndex :: forall p. IsPanel p => p -> Number
_level :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_maxScale :: forall d. IsDiagram d => d -> Number
_maxSelectionCount :: forall d. IsDiagram d => d -> Number
_minScale :: forall d. IsDiagram d => d -> Number
_opacity :: forall d. IsDiagram d => d -> Number
_opacity :: forall g. IsGraphObject g => g -> Number
_portGravity :: forall t. IsLinkingBaseTool t => t -> Number
_row :: forall g. IsGraphObject g => g -> Number
_rowCount :: forall p. IsPanel p => p -> Number
_rowSpan :: forall g. IsGraphObject g => g -> Number
_scale :: forall d. IsDiagram d => d -> Number
_scale :: forall g. IsGraphObject g => g -> Number
_scrollHorizontalLineChange :: forall d. IsDiagram d => d -> Number
_scrollVerticalLineChange :: forall d. IsDiagram d => d -> Number
_segmentFraction :: forall g. IsGraphObject g => g -> Number
_segmentIndex :: forall g. IsGraphObject g => g -> Number
_shadowBlur :: forall p. IsPart p => p -> Number
_toEndSegmentLength :: forall g. IsGraphObject g => g -> Number
_toMaxLinks :: forall g. IsGraphObject g => g -> Number
_topIndex :: forall p. IsPanel p => p -> Number
_toShortLengh :: forall g. IsGraphObject g => g -> Number
_width :: forall g. IsGraphObject g => g -> Number
_width :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_x :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
_y :: forall _l _n _e v. LayoutNetwork _l _n _e v => v -> Number
abs :: forall a. Based a => a -> Number
abs :: forall a. Based a => a -> Number
button :: forall a. IsMouse a => a -> Number
buttons :: forall a. IsMouse a => a -> Number
charCode :: forall a. IsKeyboard a => a -> Number
clientX :: forall a. IsMouse a => a -> Number
clientY :: forall a. IsMouse a => a -> Number
deltaMode :: forall a. IsWheel a => a -> Number
deltaX :: forall a. IsWheel a => a -> Number
deltaY :: forall a. IsWheel a => a -> Number
deltaZ :: forall a. IsWheel a => a -> Number
detail :: forall a. IsUi a => a -> Number
durationToNumber :: forall d. Duration d => d -> Number
elapsedTime :: forall a. IsAnimation a => a -> Number
height :: forall a. IsPointer a => a -> Number
heightSegments :: forall nt r. Newtype nt (Variant (heightSegments :: Int | r)) => Int -> nt
int :: forall t. Corecursive t (SqlF EJsonF) => Int -> t
keyCode :: forall a. IsKeyboard a => a -> Number
layerX :: forall a. IsMouse a => a -> Number
layerY :: forall a. IsMouse a => a -> Number
length :: forall a. Measurable a => a -> Number
length :: forall a. Metric a => a -> Number
length :: forall a. Measurable a => a -> Number
location :: forall a. IsKeyboard a => a -> Number
movementX :: forall a. IsMouse a => a -> Number
movementY :: forall a. IsMouse a => a -> Number
offsetX :: forall a. IsMouse a => a -> Number
offsetY :: forall a. IsMouse a => a -> Number
ord :: forall a. Based a => a -> Number
ord :: forall a. Based a => a -> Number
pageX :: forall a. IsMouse a => a -> Number
pageY :: forall a. IsMouse a => a -> Number
pointerId :: forall a. IsPointer a => a -> Number
pressure :: forall a. IsPointer a => a -> Number
screenX :: forall a. IsMouse a => a -> Number
screenY :: forall a. IsMouse a => a -> Number
tangentialPressure :: forall a. IsPointer a => a -> Number
tiltX :: forall a. IsPointer a => a -> Number
tiltY :: forall a. IsPointer a => a -> Number
timeStamp :: forall a. IsEvent a => a -> Number
toNumber :: forall a. IsNumber a => a -> Number
toNumber :: forall a. IsNumber a => a -> Number
twist :: forall a. IsPointer a => a -> Number
which :: forall a. IsKeyboard a => a -> Number
width :: forall a. IsPointer a => a -> Number
widthSegments :: forall nt r. Newtype nt (Variant (widthSegments :: Int | r)) => Int -> nt
x :: forall a. IsMouse a => a -> Number
y :: forall a. IsMouse a => a -> Number
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
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.
from :: forall a b. TypeEquals a b => b -> a
to :: forall a b. TypeEquals a b => a -> b
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
genFloat64 :: forall m. MonadGen m => m Number
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
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
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