Search results

length :: String -> Int

Returns the number of code points in the string. Operates in constant space and in time linear to the length of the string.

>>> length "b 𝐀𝐀 c 𝐀"
8
-- compare to Data.String:
>>> length "b 𝐀𝐀 c 𝐀"
11
P purescript-strings M Data.String.CodePoints
length :: String -> Int

Returns the number of characters the string is composed of.

length "Hello World" == 11
P purescript-strings M Data.String.CodeUnits
isIP' :: String -> Int

Returns 4 if the String is a valid IPv4 address, 6 if the String is a valid IPv6 address, and 0 otherwise.

P purescript-node-net M Node.Net
length :: Warn (Text "DEPRECATED: `Data.String.Utils.length`") => String -> Int

DEPRECATED: This function is now available in purescript-strings.

Return the number of Unicode code points in a string. Note that this function correctly accounts for Unicode symbols that are made up of surrogate pairs. If you want a simple wrapper around JavaScript's string.length property, you should use the Data.String.CodeUnits.length function from purescript-strings.

length "PureScript" == 10
length "ℙ∪𝕣ⅇႽ𝚌𝕣ⅈ𝚙†" == 10    -- 14 with `Data.String.length`
P purescript-stringutils M Data.String.Utils
toCodePoint :: String -> Int

Return the Unicode code point of a character. This function uses String instead of Char because PureScript Chars must be UTF-16 code units and hence cannot represent all Unicode code points.

Example:

toCodePoint '∀' == 8704
P purescript-stringutils M Data.Char.Utils
binParseInt :: String -> Int
P purescript-teller M Data.Teller.HeartbeatGen
cyrb53 :: String -> Int
P purescript-graphqlclient M GraphQLClient.Cyrb53
fromRoman :: String -> Int
P purescript-roman M Data.Roman.Convert
midiPitch :: String -> Int
P purescript-soundfonts M Audio.SoundFont.Gleitz
degree :: forall a. EuclideanRing a => a -> Int
P purescript-prelude M Data.EuclideanRing
crashWith :: forall a. Partial => String -> a

A partial function which crashes on any input with the specified message.

P purescript-partial M Partial
unsafeCrashWith :: forall a. String -> a

A function which crashes with the specified error message.

P purescript-partial M Partial.Unsafe
defaultFromEnum :: forall a. Enum a => a -> Int

Provides a default implementation for fromEnum.

  • Assumes toEnum 0 = Just bottom.
  • Cannot be used in conjuction with defaultPred.

Runs in O(n) where n is fromEnum a.

P purescript-enums M Data.Enum
fromEnum :: forall a. BoundedEnum a => a -> Int
P purescript-enums M Data.Enum
genericFromEnum :: forall a rep. Generic a rep => GenericBoundedEnum rep => a -> Int

A Generic implementation of the fromEnum member from the BoundedEnum type class.

P purescript-enums M Data.Enum.Generic
genericFromEnum' :: forall a. GenericBoundedEnum a => a -> Int
P purescript-enums M Data.Enum.Generic
unsafeThrow :: forall a. String -> a

Defined as unsafeThrowException <<< error.

P purescript-exceptions M Effect.Exception.Unsafe
impossible :: forall a. String -> a
P purescript-variant M Data.Variant.Internal
toInt :: forall n. Nat n => n -> Int
P purescript-typelevel M Data.Typelevel.Num.Sets
fromString :: forall s. IsString s => String -> s
P purescript-css M CSS.String
url :: forall a. URL a => String -> a
P purescript-css M CSS.Common
hash :: forall a. Hashable a => a -> Int
P purescript-unordered-collections M Data.Hashable
fromString :: forall a. IsString a => String -> a
P purescript-yarn M Data.String.Yarn
readDefault :: forall a. Read a => Zero a => String -> a

Read a value a from a String but fallback on Zero a on failure

P purescript-read M Data.String.Read
arity :: forall a. Display a => a -> Int
P purescript-sparse-polynomials M Data.Sparse.Polynomial
eventPhaseIndex :: forall e. IsEvent e => e -> Int

The integer value for the current event phase.

P purescript-dom-classy M DOM.Classy.Event
length :: forall a. a -> Int

Gets the length of a pseudoarray

P purescript-ffi-simple M FFI.Simple.PseudoArray
nodeTypeIndex :: forall n. IsNode n => n -> Int

The numeric value for the type of a node.

P purescript-dom-classy M DOM.Classy.Node
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)

P purescript-ffi-simple M FFI.Simple.Globals
stringValue :: forall a. Value a => String -> a
P purescript-markdown M Text.Markdown.SlamDown.Syntax.Value
childCount :: forall n. IsParent n => n -> Int

Returns the number of child Elements

P purescript-dom-simple M DOM.Simple.Parent
string :: forall t. Corecursive t EJsonF => String -> t
P purescript-ejson M Data.Json.Extended
_zOrder :: forall p. IsPart p => p -> Int
P purescript-gojs M GoJS.GraphObject.Panel.Part.Properties
cooldown :: forall a. Coolsdown a => a -> Int
P purescript-screeps-classy M Screeps.Coolsdown
depositLeft :: forall a. Deposit a => a -> Int
P purescript-screeps-classy M Screeps.Deposit
energy :: forall a. Refillable a => a -> Int
P purescript-screeps-classy M Screeps.Refillable
energyCapacity :: forall a. Refillable a => a -> Int
P purescript-screeps-classy M Screeps.Refillable
fromString :: forall a. Utf8Encodable a => String -> a
P purescript-crypt-nacl M Crypt.NaCl.Class
fromString :: forall a. Utf8Encodable a => String -> a
P purescript-tweetnacl M Crypt.NaCl.Class
getUuid :: forall m. HasUuid m => m -> Int
P purescript-liminal M Classes.HasUuid
hits :: forall d. Destructible d => d -> Int
P purescript-screeps-classy M Screeps.Destructible
hitsMax :: forall d. Destructible d => d -> Int
P purescript-screeps-classy M Screeps.Destructible
ident :: forall f t. Corecursive t (SqlF f) => String -> t
P purescript-sql-squared M SqlSquared.Constructors
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!
P purescript-interpolate M Data.Interpolate
length :: forall r. Fold LenS r (Int -> Int) => r -> Int
P purescript-record-fold M Data.Record.Fold
parse :: forall a. Router a => String -> a
P purescript-grain-router M Grain.Router
parseError :: forall e. OwoifyError e => String -> e

Representing general parser error. Currently not used.

P purescript-owoify M Data.Owoify.Internal.Parser.OwoifyParser
parseSlot' :: forall a. EmptyableSlot a => String -> a
P purescript-easy-alexa M EasyAlexa
progress :: forall a. Progress a => a -> Int
P purescript-screeps-classy M Screeps.Progress
progressTotal :: forall a. Progress a => a -> Int
P purescript-screeps-classy M Screeps.Progress
property' :: forall a. String -> a
P purescript-ffi-utils M FFI.Util
read :: forall a. Read a => Partial => String -> a
P purescript-read-generic M Data.Parse
require :: forall a. String -> a
P purescript-ffi-utils M FFI.Util
size :: forall a. FFTArray a => a -> Int
P purescript-fft-js M FFT
storeCapacity :: forall a. Stores a => a -> Int
P purescript-screeps-classy M Screeps.Stores
string :: forall t. Corecursive t (SqlF EJsonF) => String -> t
P purescript-sql-squared M SqlSquared.Constructors
ticksToDecay :: forall a. Decays a => a -> Int
P purescript-screeps-classy M Screeps.Decays
ticksToRegeneration :: forall s. Regenerates s => s -> Int
P purescript-screeps-classy M Screeps.Regenerates
toInt :: forall a. HasToInt a => a -> Int
P purescript-neon M Neon.Class.HasToInt
unsafeUnserialize :: forall m. UnserializeState m => String -> m
P purescript-flame M Flame.Serialization
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.

P purescript-prelude M Data.Ord
from :: forall a rep. Generic a rep => a -> rep
P purescript-prelude M Data.Generic.Rep
genericNot :: forall a rep. Generic a rep => GenericHeytingAlgebra rep => a -> a

A Generic implementation of the not member from the HeytingAlgebra type class.

P purescript-prelude M Data.HeytingAlgebra.Generic
genericNot' :: forall a. GenericHeytingAlgebra a => a -> a
P purescript-prelude M Data.HeytingAlgebra.Generic
negate :: forall a. Ring a => a -> a

negate x can be used as a shorthand for zero - x.

P purescript-prelude M Data.Ring
not :: forall a. HeytingAlgebra a => a -> a
P purescript-prelude M Data.HeytingAlgebra
recip :: forall a. DivisionRing a => a -> a
P purescript-prelude M Data.DivisionRing
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.

P purescript-prelude M Data.Ord
to :: forall a rep. Generic a rep => rep -> a
P purescript-prelude M Data.Generic.Rep
unwrap :: forall t a. Newtype t a => t -> a
P purescript-newtype M Data.Newtype
wrap :: forall t a. Newtype t a => a -> t
P purescript-newtype M Data.Newtype
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.

P purescript-unsafe-coerce M Unsafe.Coerce
inj :: forall a b. Inject a b => a -> b
P purescript-either M Data.Either.Inject
unsafePartial :: forall a. (Partial => a) -> a

Discharge a partiality constraint, unsafely.

P purescript-partial M Partial.Unsafe
from :: forall a b. TypeEquals a b => b -> a
P purescript-type-equality M Type.Equality
to :: forall a b. TypeEquals a b => a -> b
P purescript-type-equality M Type.Equality
convertDuration :: forall a b. Duration a => Duration b => a -> b

Converts directly between durations of differing types.

P purescript-datetime M Data.Time.Duration
negateDuration :: forall a. Duration a => a -> a

Negates a duration, turning a positive duration negative or a negative duration positive.

P purescript-datetime M Data.Time.Duration
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
P purescript-safe-coerce M Safe.Coerce
div10 :: forall x q. Div10 x q => x -> q
P purescript-typelevel M Data.Typelevel.Num.Ops
isDivBy :: forall d x. IsDivBy d x => d -> x
P purescript-typelevel M Data.Typelevel.Num.Ops
mul10 :: forall x q. Mul10 x q => x -> q
P purescript-typelevel M Data.Typelevel.Num.Ops
not :: forall b1 b2. Not b1 b2 => b1 -> b2
P purescript-typelevel M Data.Typelevel.Bool
pred :: forall x y. Pred x y => x -> y
P purescript-typelevel M Data.Typelevel.Num.Ops
succ :: forall x y. Succ x y => x -> y
P purescript-typelevel M Data.Typelevel.Num.Ops
genInt16 :: forall m. MonadGen m => m Int
P purescript-arraybuffer M Data.ArrayBuffer.Typed.Gen
genInt32 :: forall m. MonadGen m => m Int
P purescript-arraybuffer M Data.ArrayBuffer.Typed.Gen
genInt8 :: forall m. MonadGen m => m Int
P purescript-arraybuffer M Data.ArrayBuffer.Typed.Gen
cast :: forall a b. Castable a b => a -> b
P purescript-untagged-union M Untagged.Castable
coerce :: forall expected given. Coerce given expected => given -> expected
P purescript-undefined-is-not-a-problem M Data.Undefined.NoProblem.Closed
coerce :: forall expected given. Coerce given expected => given -> expected
P purescript-undefined-is-not-a-problem M Data.Undefined.NoProblem.Open
convertTo :: forall t f r. Recursive t f => Corecursive r f => t -> r
P purescript-matryoshka M Matryoshka.Refold
fill :: forall partial complete. Fillable partial complete => partial -> complete
P purescript-justifill M Justifill.Fillable
ginverse :: forall g. Group g => g -> g
P purescript-group M Data.Group
justify :: forall unjust just. Justifiable unjust just => unjust -> just
P purescript-justifill M Justifill.Justifiable
mnegateL :: forall r x. LeftModule x r => x -> x
P purescript-modules M Data.Ring.Module
mnegateR :: forall r x. RightModule x r => x -> x
P purescript-modules M Data.Ring.Module
nextPrime :: forall a. Ord a => Semiring a => EuclideanRing a => a -> a

Ad infinitum

P purescript-sparse-polynomials M Data.Sparse.Polynomial
area :: forall s n. ToSize n s => Semiring n => s -> n

Get the area of a size

P purescript-polymorphic-vectors M Data.Vector.Polymorphic
convertPos :: forall p1 p2 n. ToPos n p1 => FromPos n p2 => p1 -> p2
P purescript-polymorphic-vectors M Data.Vector.Polymorphic