Header menu logo issie

Helpers Module

Nested modules

Modules Description

JsonHelpers

PrintSimple

Functions to print human-readable version of CanvasState

ReduceKeys

Take a project and compress all of the IDs.

Functions and values

Function or value Description

assertThat cond msg

Full Usage: assertThat cond msg

Parameters:
    cond : bool
    msg : string

cond : bool
msg : string

cropToLength len fromStart str

Full Usage: cropToLength len fromStart str

Parameters:
    len : int
    fromStart : bool
    str : string

Returns: string

Crop a string to the specified length. fromStart indicates whether you want the first characters or the last characters.

len : int
fromStart : bool
str : string
Returns: string

getCustomComponentType _arg1

Full Usage: getCustomComponentType _arg1

Parameters:
Returns: CustomComponentType
_arg1 : ComponentType
Returns: CustomComponentType

getCustomName _arg1

Full Usage: getCustomName _arg1

Parameters:
Returns: string
_arg1 : ComponentType
Returns: string

getMemData address memData

Full Usage: getMemData address memData

Parameters:
    address : bigint
    memData : Memory1

Returns: bigint
address : bigint
memData : Memory1
Returns: bigint

isCustom _arg1

Full Usage: isCustom _arg1

Parameters:
Returns: bool
_arg1 : ComponentType
Returns: bool

isIOLabel _arg1

Full Usage: isIOLabel _arg1

Parameters:
Returns: bool
_arg1 : ComponentType
Returns: bool

isInput _arg1

Full Usage: isInput _arg1

Parameters:
Returns: bool
_arg1 : ComponentType
Returns: bool

isOutput _arg1

Full Usage: isOutput _arg1

Parameters:
Returns: bool
_arg1 : ComponentType
Returns: bool

isViewer _arg1

Full Usage: isViewer _arg1

Parameters:
Returns: bool
_arg1 : ComponentType
Returns: bool

listSet lst item idx

Full Usage: listSet lst item idx

Parameters:
    lst : 'a list
    item : 'a
    idx : int

Returns: 'a list

Set an element of the list at the specified position. This function is slow: O(n). Do not use unless necessary.

lst : 'a list
item : 'a
idx : int
Returns: 'a list

mapFindWithDef defVal key map

Full Usage: mapFindWithDef defVal key map

Parameters:
    defVal : 'b
    key : 'a
    map : Map<'a, 'b>

Returns: 'b
Modifiers: inline
Type parameters: 'b, 'a

Look up key in map, return defVal if key is not found

defVal : 'b
key : 'a
map : Map<'a, 'b>
Returns: 'b

mapInverse m

Full Usage: mapInverse m

Parameters:
    m : Map<'A, 'B>

Returns: Map<'B, 'A>
Modifiers: inline
Type parameters: 'A, 'B

create inverse map

m : Map<'A, 'B>
Returns: Map<'B, 'A>

mapKeys map

Full Usage: mapKeys map

Parameters:
    map : Map<'a, 'b>

Returns: 'a[]
Modifiers: inline
Type parameters: 'a, 'b

Array of map keys

map : Map<'a, 'b>
Returns: 'a[]

mapPair f (arg2, arg3)

Full Usage: mapPair f (arg2, arg3)

Parameters:
    f : 'S -> 'T
    arg1 : 'S
    arg2 : 'S

Returns: 'T * 'T
Modifiers: inline
Type parameters: 'S, 'T

Map a function over a pair of elements. mapPair f (x,y) = f x, f y.

f : 'S -> 'T
arg1 : 'S
arg2 : 'S
Returns: 'T * 'T

mapUnion m1 m2

Full Usage: mapUnion m1 m2

Parameters:
    m1 : Map<'a, 'b>
    m2 : Map<'a, 'b>

Returns: Map<'a, 'b>
Modifiers: inline
Type parameters: 'a, 'b

Union of maps, common keys take m1 value

m1 : Map<'a, 'b>
m2 : Map<'a, 'b>
Returns: Map<'a, 'b>

mapUpdateWithDef defVal update key map

Full Usage: mapUpdateWithDef defVal update key map

Parameters:
    defVal : 'b
    update : 'b -> 'b
    key : 'a
    map : Map<'a, 'b>

Returns: Map<'a, 'b>
Modifiers: inline
Type parameters: 'b, 'a

If key exists in map: (key:v) -> (key:update v), otherwise create new item (key : update v)

defVal : 'b
update : 'b -> 'b
key : 'a
map : Map<'a, 'b>
Returns: Map<'a, 'b>

mapValues map

Full Usage: mapValues map

Parameters:
    map : Map<'a, 'b>

Returns: 'b[]
Modifiers: inline
Type parameters: 'a, 'b

Array of map values

map : Map<'a, 'b>
Returns: 'b[]

memoizeBy keyFunc funcToMemoize

Full Usage: memoizeBy keyFunc funcToMemoize

Parameters:
    keyFunc : 'a -> 'k
    funcToMemoize : 'a -> 'c

Returns: 'a -> 'c

Return a memoized version of funcToMemoize where. Repeated calls with equivalent inputs return a stored result. Inputs a, a' are deemed equivalent if keyFunc a = keyFunc a'. Use this as well as LazyView etc, it has a different usage since it need not have React output and comparison is via a key function.

keyFunc : 'a -> 'k
funcToMemoize : 'a -> 'c
Returns: 'a -> 'c

nocr s

Full Usage: nocr s

Parameters:
    s : string

Returns: string

replace new lines in a string by ';' for easier debug printing of records using %A

s : string
Returns: string

pow2 exponent

Full Usage: pow2 exponent

Parameters:
    exponent : int

Returns: int

Return 2^exponent.

exponent : int
Returns: int

shortPComp comp

Full Usage: shortPComp comp

Parameters:
Returns: string
comp : Component
Returns: string

sprintInitial n s

Full Usage: sprintInitial n s

Parameters:
    n : int
    s : string

Returns: string

return initial n characters of a string

n : int
s : string
Returns: string

swapArrayEls i1 i2 arr

Full Usage: swapArrayEls i1 i2 arr

Parameters:
    i1 : int
    i2 : int
    arr : 'a[]

Returns: 'a[]

Returns a new array with the elements at index i1 and index i2 swapped

i1 : int
i2 : int
arr : 'a[]
Returns: 'a[]

testMatch diffX diffY normRot

Full Usage: testMatch diffX diffY normRot

Parameters:
    diffX : float
    diffY : float
    normRot : int

Returns: float list
diffX : float
diffY : float
normRot : int
Returns: float list

tryFindError lst

Full Usage: tryFindError lst

Parameters:
Returns: Result<'a list, 'b>

Return the first error found in a list of results, or the list of Oks if there are none.

lst : Result<'a, 'b> list
Returns: Result<'a list, 'b>

Type something to start searching.