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.CodeUnits:
>>> length "b 𝐀𝐀 c 𝐀"
11
length :: String -> Int

Returns the number of characters the string is composed of.

length "Hello World" == 11

length "𝐀A" == 3
-- compare to Data.String.CodePoints:
length "𝐀A" == 2
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.

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`
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
binParseInt :: String -> Int
byteLength :: String -> Int
byteLength :: String -> Int

The UTF-8 byte length. On wasm: the StrLen intrinsic (array.len on the $Bytes).

cyrb53 :: String -> Int
fromRoman :: String -> Int
midiPitch :: String -> Int
simpleHash :: String -> Int

Simple hash function (for demonstration - not cryptographically secure!)

degree :: forall a. EuclideanRing a => a -> Int
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.

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.

fromEnum :: forall a. BoundedEnum a => a -> Int
genericFromEnum :: forall a rep. Generic a rep => GenericBoundedEnum rep => a -> Int

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

genericFromEnum' :: forall a. GenericBoundedEnum a => a -> Int
unsafeThrow :: forall a. String -> a

Defined as unsafeThrowException <<< error.

impossible :: forall a. String -> a
toInt :: forall n. Nat n => n -> Int
hash :: forall a. Hashable a => a -> Int
fromString :: forall s. IsString s => String -> s
url :: forall a. URL 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

fromString :: forall a. IsString a => String -> a
arity :: forall a. Display a => a -> Int
eventPhaseIndex :: forall e. IsEvent e => e -> Int

The integer value for the current event phase.

length :: forall a. a -> Int

Gets the length of a pseudoarray

nodeTypeIndex :: forall n. IsNode n => n -> Int

The numeric value for the type of a 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)

stringValue :: forall a. Value a => String -> a
childCount :: forall n. IsParent n => n -> Int

Returns the number of child Elements

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
_zOrder :: forall p. IsPart p => p -> Int
cooldown :: forall a. Coolsdown a => a -> Int
dayIndex :: forall a. Temporal a => a -> Int
dayOfWeek :: forall a. Temporal a => a -> Int
depositLeft :: forall a. Deposit a => a -> Int
energy :: forall a. Refillable a => a -> Int
energyCapacity :: forall a. Refillable a => a -> Int
fromString :: forall a. Utf8Encodable a => String -> a
fromString :: forall a. Utf8Encodable a => String -> a
getUuid :: forall m. HasUuid m => m -> Int
hits :: forall d. Destructible d => d -> Int
hitsMax :: forall d. Destructible d => d -> Int
ident :: forall f t. Corecursive t (SqlF f) => String -> t
internalError :: forall a. String -> a

Something the generator promised would not happen.

Reserved for broken tables. Nothing a grammar or an input can do should reach one of these; a parse error is an Either, not a crash.