rosetta/internal/erl/erts/r_erlang

This Gleam module aims to represent everything that there is in erts/erlang module It is not recommended to rely on any of these types here Functions prepended with r_ are their erlang counterparts, translated here for brevity

Types

It represents the Erlang any/0 Type

pub type Any
pub type AnyList

Represents arity/0

pub type Arity

Represents binary/0. Binary (binary/0) is a BitString of size divisible by 8.

pub type Binary

Represents bitstring/0. BitString in Erlang is equivalent to what we have in Gleam in BitArray.

pub type BitString =
  BitArray

This will require glueing code According to documentation it may have nested lists (worst case scenario - bitstring_list in bitstring_list…)

pub type BitstringList =
  MaybeImproperList

Boolean is an equivalent of Bool in Gleam, so it’s an alias. It is left here for consistency reasons with the Erlang documentation.

pub type Boolean =
  Bool

-type byte() :: 0..255. Byte of data, represented by integer.

pub type Byte

Likely cannot be implemented in Gleam

pub type CPUTopology =
  ROSETTABROKEN

An ASCII/Unicode character.

pub type Char
pub type ConversionError {
  NegativeIntegerError
}

Constructors

  • NegativeIntegerError
pub type DeprecatedTimeUnit {
  Seconds
  MilliSeconds
  MicroSeconds
  NanoSeconds
}

Constructors

  • Seconds
  • MilliSeconds
  • MicroSeconds
  • NanoSeconds
pub type DistHandle =
  ROSETTABROKEN
pub type ExtBinary =
  Binary
pub type ExtIovec =
  Iovec

fun_info_item

pub type FunInfoItem {
  Arity
  Env
  Index
  Name
  Module
  NewIndex
  NewUniq
  Pid
  Type
  Uniq
}

Constructors

  • Arity
  • Env
  • Index
  • Name
  • Module
  • NewIndex
  • NewUniq
  • Pid
  • Type
  • Uniq

NOT TESTED! <- Not available in stdlibrary, glueing code

pub type GarbageCollectionDefaultOption {
  MaxHeapSize(NonNegInteger)
  MinBinHeapSize(NonNegInteger)
  MinHeapSize(NonNegInteger)
  FullsweepAfter(NonNegInteger)
}

Constructors

  • MaxHeapSize(NonNegInteger)
  • MinBinHeapSize(NonNegInteger)
  • MinHeapSize(NonNegInteger)
  • FullsweepAfter(NonNegInteger)
pub type GarbageCollectionDefaults =
  List(GarbageCollectionDefaultOption)

Glueing code for HaltOptions

pub type HaltOption {
  Flush(Bool)
  FlushTimeout(Int)
  Infinity
}

Constructors

  • Flush(Bool)
  • FlushTimeout(Int)
  • Infinity

List(HaltOption) (how to implement this?)

pub type HaltOptions =
  List(HaltOption)

Our crazy internal type, to sign that something is not yet ready.

pub type HelpMeNotTyped

Any of: Pid, Port or Reference These types are defined in gleam_stdlib and gleam_erlang so are omitted in this file.

pub type Identifier

No documentation. Likely a leftover

pub type InfoList =
  RNil

integer/0, equivalent of Int in Gleam. The “integer” type in Erlang has two subvariants: non_neg_integer and neg_integer. Those are defined separately.

pub type Integer =
  Int

A binary or list containing bytes and/or iodata. This datatype is used to represent data that is meant to be output using any I/O module. For example: file:write/2 or gen_tcp:send/2. To convert an iodata/0 term to binary/0 you can use iolist_to_binary/2. To transcode a string/0 or unicode:chardata/0 to iodata/0 you can use unicode:characters_to_binary/1.

pub type IoData

-type iolist() :: maybe_improper_list(byte() | binary() | iolist(), binary() | []). A list containing bytes and/or iodata.

This datatype is used to represent data that is meant to be output using any I/O module. For example: file:write/2 or gen_tcp:send/2.

In most use cases you want to use iodata/0 instead of this type.

pub type IoList
pub type Iovec =
  List(Binary)

This has incompatible implementation This will require glueing code

pub type LevelEntry =
  ROSETTABROKEN

level_tag

pub type LevelTag {
  Core
  Node
  Processor
  Thread
}

Constructors

  • Core
  • Node
  • Processor
  • Thread
pub type MatchVariable =
  Atom
pub type MaxHeapSize =
  ROSETTABROKEN

An Erlang list that is not guaranteed to end with a [], and where the list elements can be of any type.

pub type MaybeImproperList
pub type MaybeImproperList2
pub type MemoryType {
  Total
  Processes
  ProcessesUsed
  System
  Atom
  AtomUsed
  Binary
  Code
  Ets
}

Constructors

  • Total
  • Processes
  • ProcessesUsed
  • System
  • Atom
  • AtomUsed
  • Binary
  • Code
  • Ets

message_queue_data

pub type MessageQueueData {
  OffHeap
  OnHeap
}

Constructors

  • OffHeap
  • OnHeap

A three-tuple representing a Module:Function/Arity function signature.

pub type Mfa

An Erlang module represented by an atom.

pub type Module

monitor_option (partially broken implementation)

pub type MonitorOption {
  Alias(Atom)
  Tag(Term)
}

Constructors

  • Alias(Atom)
  • Tag(Term)
pub type MonitorPortIdentifier =
  ROSETTABROKEN

monitor_proces_identifier

pub type MonitorProcessIdentifier =
  ROSETTABROKEN

A negative integer. Negative integers can be read by Gleam’s Int type. That is provided here for compatibility and portability reasons. If we know that a certain value is negative, we should be using that. FIXME: Lacking implementation of conversion functions.

pub type NegInteger

nif_resource / 0 - opaque typ

pub type NifResource =
  ROSETTABROKEN

The type used to show that a function will never return a value, that is it will always throw an exception.

pub type NoReturn

binary/0 (Binary) that contains some data.

pub type NonEmptyBinary

Non-empty bitstring/0 (BitArray in Gleam)

pub type NonEmptyBitString
pub type NonEmptyImproperList
pub type NonEmptyList
pub type NonEmptyList1
pub type NonEmptyMaybeImproperList
pub type NonEmptyMaybeImproperList2
pub type NonEmptyString

A non-negative integer, that is any positive integer or 0. FIXME: add conversions

pub type NonNegInteger

Erlang’s Number Type Gleam’s Int or Float

pub type Number

Integer greater than 0. FIXME: Add Conversions

pub type PosInteger

prepared_code/0

pub type PreparedCode =
  ROSETTABROKEN

priority_level/0

pub type PriorityLevel {
  Low
  Normal
  High
  Max
}

Constructors

  • Low
  • Normal
  • High
  • Max

OMITED FOR SANITY

pub type ProcessInfoItem =
  ROSETTABROKEN

OMITED FOR SANITY

pub type ProcessInfoResultItem =
  ROSETTABROKEN

Represents bitstring/0

pub type RBitString

dynamic/0

pub type RDynamic

Alias for Float.

pub type RFloat =
  Float

function/0

pub type RFunction

Alias for Identifier

pub type RIdentifier =
  Identifier

list/0. Doesn’t have counterpart in Gleam. This may be a list of different terms.

pub type RList0

list/1. Equivalent to List in Gleam. Lists in Gleam require static typing.

pub type RList1(t) =
  List(t)

-type map() :: #{any() => any()}. An Erlang map containing any number of key and value associations. The Gleam Dict type conforms partially. Gleam’s dict requires all values to be of the same type. And we cannot assure that all the items will be of this type.

pub type RMap

This type is here because it may be useful when porting Erlang code The empty AnyList. (list/0 in Erlang)

pub type RNil

Erlang Node represented by an atom. Gleam/OTP and Gleam/Erlang have few functions handling that. This type is left here for the compatibility reasons.

pub type RNode =
  Node

none/0

pub type RNone

Represents a type that has no implementation yet or has known compatibility issues.

pub type ROSETTABROKEN
pub type RPid =
  process.Pid

timeout/0

pub type RTimeout

In order not to clash with Gleam’s tuple, it’s an Erlang Tuple

pub type RTuple

rasie_stacktrace/0

pub type RaiseStacktrace =
  ROSETTABROKEN

registered_name/0

pub type RegisteredName =
  Atom

registered_process_identifier/0

pub type RegisteredProcesIdentifier =
  ROSETTABROKEN
pub type SchedulerBindType {
  NoNodeProcessorSpread
  NoNodeThreadSpread
  NoSpread
  ProcessorSpread
  Spread
  ThreadSpread
  ThreadNoNodeProcessorSpread
  Unbound
}

Constructors

  • NoNodeProcessorSpread
  • NoNodeThreadSpread
  • NoSpread
  • ProcessorSpread
  • Spread
  • ThreadSpread
  • ThreadNoNodeProcessorSpread
  • Unbound

send_destination()

pub type SendDestination =
  ROSETTABROKEN

spawn_opt_option/0

pub type SpawnOptOption =
  ROSETTABROKEN

stack_item/0

pub type StackItem =
  ROSETTABROKEN

stacktrace/0

pub type Stacktrace =
  ROSETTABROKEN

stacktrace_extrainfo/0

pub type StacktraceExtrainfo =
  ROSETTABROKEN

sub_level/0

pub type SubLevel =
  ROSETTABROKEN

system_monitor_option/0

pub type SystemMonitorOption =
  ROSETTABROKEN

system_profile_option/0

pub type SystemProfileOption {
  Exclusive
  RunnablePorts
  RunnableProcs
  Scheduler
  Timestamp
  MontonicTimestamp
  StrictMonotonicTimestamp
}

Constructors

  • Exclusive
  • RunnablePorts
  • RunnableProcs
  • Scheduler
  • Timestamp
  • MontonicTimestamp
  • StrictMonotonicTimestamp

In Erlang

pub type Term =
  Any

Has implementation nonsuitable to Gleam

pub type TimeUnit =
  ROSETTABROKEN
pub type Timestamp =
  #(Int, Int, Int)

Needs glueing code

pub type TraceFlag =
  ROSETTABROKEN
pub type TraceInfoFlag =
  ROSETTABROKEN
pub type TraceInfoItemResult =
  ROSETTABROKEN
pub type TraceInfoReturn =
  ROSETTABROKEN
pub type TraceMatchSpec =
  ROSETTABROKEN
pub type TracePatternFlag =
  ROSETTABROKEN
pub type TracePatternMfa =
  ROSETTABROKEN

Functions

pub fn int_to_nonnegative_int(
  value: Int,
) -> Result(NonNegInteger, ConversionError)
pub fn r_abs_1(value: Number) -> Number

Deprecated: This function is lacking tests

erlang:abs/1 Returns a Number - absolute arithmetical value of float or int

pub fn r_append_element_2(tuple: RTuple, term: Any) -> RTuple

Deprecated: This has no tests

append_element/2

pub fn r_atom_to_binary_1(value: Atom) -> Binary

atom_to_binary/1

pub fn r_atom_to_binary_2(value: Atom, encoding: Atom) -> Binary
pub fn r_atom_to_list(value: Atom) -> String
pub fn r_binary_part_1() -> Nil

Deprecated: NOT IMPLEMENTED

binary_part/2

pub fn r_binary_part_3() -> Nil

Deprecated: NOT IMPLEMENTED

binary_part/3

pub fn r_binary_to_atom() -> Nil

Deprecated: NOT IMPLEMENTED

pub fn r_binary_to_atom_2() -> Nil

Deprecated: NOT IMPLEMENTED

binary_to_atom/2

pub fn r_binary_to_existing_atom_1() -> Nil

Deprecated: NOT IMPLEMENTED

binary_to_existing_atom/1

pub fn r_binary_to_existing_atom_2() -> Nil

Deprecated: NOT IMPLEMENTED

binary_to_existing_atom/2

pub fn r_binary_to_float_1() -> Float

Deprecated: NOT IMPLEMENTED

binary_to_float/1

pub fn r_binary_to_integer_1() -> Int

Deprecated: NOT IMPLEMENTED

binary_to_integer/1

pub fn r_binary_to_integer_2() -> Int

Deprecated: NOT IMPLEMENTED

binary_to_integer/2

pub fn r_binary_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

binary_to_list/1

pub fn r_binary_to_list_3() -> Int

Deprecated: NOT IMPLEMENTED

pub fn r_binary_to_term_1() -> Int

Deprecated: NOT IMPLEMENTED

binary_to_term/1

pub fn r_binary_to_term_2() -> Int

Deprecated: NOT IMPLEMENTED

binary_to_term/2

pub fn r_bit_size_1() -> Int

Deprecated: NOT IMPLEMENTED

bit_size/1

pub fn r_bitstring_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

bitstring_to_list/1

pub fn r_byte_size_1() -> Int

Deprecated: NOT IMPLEMENTED

byte_size/1

pub fn r_ceil_1() -> Int

Deprecated: NOT IMPLEMENTED

ceil/1

pub fn r_decode_packet_3() -> Int

Deprecated: NOT IMPLEMENTED

decode_packet/3

pub fn r_delete_element_2() -> Int

Deprecated: NOT IMPLEMENTED

delete_element/2

pub fn r_display_1() -> Int

Deprecated: NOT IMPLEMENTED

display/1

pub fn r_element_2() -> Int

Deprecated: NOT IMPLEMENTED

element/2

pub fn r_external_size_1() -> Int

Deprecated: NOT IMPLEMENTED

external_size/1

pub fn r_external_size_2() -> Int

Deprecated: NOT IMPLEMENTED

external_size/2

pub fn r_float_1(value: Number) -> Float

Deprecated: This function is lacking tests

float/1

pub fn r_float_to_binary_1() -> Int

Deprecated: NOT IMPLEMENTED

float_to_binary/1

pub fn r_float_to_binary_2() -> Int

Deprecated: NOT IMPLEMENTED

float_to_binary/2

pub fn r_float_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

float_to_list/1

pub fn r_float_to_list_2() -> Int

Deprecated: NOT IMPLEMENTED

float_to_list/2

pub fn r_floor_1(value: Number) -> Int

Deprecated: This function is lacking tests

floor/1

pub fn r_fun_info() -> Int

Deprecated: NOT IMPLEMENTED

fun_info/2

pub fn r_fun_info_1() -> Int

Deprecated: NOT IMPLEMENTED

fun_info/1

pub fn r_fun_to_list_1(value: Any) -> String

Deprecated: This function is lacking tests. Likely buggy implementation

fun_to_list/1 Returns String that represents the code that created Fun

pub fn r_hd_1(value: AnyList) -> Any

Deprecated: Likely buggy implementation

hd/1

pub fn r_insert_element(
  index: PosInteger,
  tuple1: RTuple,
  term: Any,
) -> RTuple

insert_element/3

pub fn r_integer_to_binary_1(value: Int) -> BitArray

Deprecated: Lacking tests

integer_to_binary/1

pub fn r_integer_to_binary_2(val: Any, val2: Any) -> BitArray

Deprecated: Lacking tests

integer_to_binary/2

pub fn r_integer_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

integer_to_list/1

pub fn r_integer_to_list_2() -> Int

Deprecated: NOT IMPLEMENTED

integer_to_list/2

pub fn r_iolist_size_1() -> Int

Deprecated: NOT IMPLEMENTED

iolist_size/1

pub fn r_iolist_to_binary_1() -> Int

Deprecated: NOT IMPLEMENTED

iolist_to_binary/1

pub fn r_iolist_to_iovec_1() -> Int

Deprecated: NOT IMPLEMENTED

iolist_to_iovec/1

pub fn r_is_atom_1(value: Any) -> Bool

Deprecated: Lacking tests

is_atom/1

pub fn r_is_binary_1(value: Any) -> Bool

Deprecated: Lacking tests

is_binary/1

pub fn r_is_bitstring_1(value: Any) -> Bool

Deprecated: Gleam's standard library has tool for that: gleam/bitstring

is_bitstring/1

pub fn r_is_boolean_1(value: Any) -> Bool

Deprecated: Gleam's standard library has tool for that: gleam/dynamic/bool

is_boolean/1

pub fn r_is_float_1(value: Any) -> Bool

Deprecated: Gleam's standard library has tool for that: gleam/dynamic/float

is_float/1

pub fn r_is_function_1(value: Any) -> Bool

Deprecated: Lacking tests

is_function/1

pub fn r_is_function_2(value1: Any, value2: Any) -> Bool

Deprecated: Lacking tests

is_function/2

pub fn r_is_integer_1(value1: Any) -> Bool

Deprecated: Lacking tests

is_integer/1

pub fn r_is_list_1(value1: Any) -> Bool

Deprecated: Lacking tests

is_list/1

pub fn r_is_map_1(value: Any) -> Bool

Deprecated: Lacking tests

is_map/1

pub fn r_is_map_key_2(key: Atom, map: RMap) -> Bool

is_map_key/2

pub fn r_is_number_1(value: Any) -> Bool

Deprecated: Lacking tests

is_number/1

pub fn r_is_pid_1(value: Any) -> Bool

Deprecated: Lacking tests

is_pid/1

pub fn r_is_port_1(value: Any) -> Bool

Deprecated: Lacking tests

is_port/1

pub fn r_is_record_2(term: Any) -> Bool

Deprecated: BUGGY IMPLEMENTATION

is_record/2 It’s broken!

pub fn r_is_record_3(
  term: Any,
  record_tag: Atom,
  size: NonNegInteger,
) -> Bool

Deprecated: Lacking tests

is_record/3

pub fn r_is_reference_1(value: Any) -> Bool

Deprecated: Lacking tests

pub fn r_is_tuple_1(value: Any) -> Bool

Deprecated: Lacking tests

is_tuple/1

pub fn r_length_1(value: List(Any)) -> Int

Deprecated: Lacking tests

pub fn r_list_to_atom_1(value: String) -> Atom

Deprecated: Lacking tests

list_to_atom/1 From docu Returns the atom whose text representation is String. May contain any Unicode Character

pub fn r_list_to_binary_1(value: IoList) -> Binary

Deprecated: Lacking tests

list_to_binary/1

pub fn r_list_to_bitstring_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_bitstring/1

pub fn r_list_to_existing_atom_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_existing_atom/1

pub fn r_list_to_float_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_float/1

pub fn r_list_to_integer_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_integer/1

pub fn r_list_to_integer_2() -> Int

Deprecated: NOT IMPLEMENTED

list_to_integer/2

pub fn r_list_to_pid_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_pid/1

pub fn r_list_to_port_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_port/1

pub fn r_list_to_ref_1() -> Int

Deprecated: NOT IMPLEMENTED

list_to_ref/1

pub fn r_list_to_tuple() -> Int

Deprecated: NOT IMPLEMENTED

list_to_tuple/1

pub fn r_make_ref() -> Int

Deprecated: NOT IMPLEMENTED

make_ref/0

pub fn r_make_size_1() -> Int

Deprecated: NOT IMPLEMENTED

map_size/1

pub fn r_make_tuple_2() -> Int

Deprecated: NOT IMPLEMENTED

make_tuple/2

pub fn r_make_tuple_3() -> Int

Deprecated: NOT IMPLEMENTED

make_tuple/3

pub fn r_map_get_2() -> Int

Deprecated: NOT IMPLEMENTED

map_get/2

pub fn r_match_spec_test_3() -> Int

Deprecated: NOT IMPLEMENTED

match_spec_test/3

pub fn r_max_2() -> Int

Deprecated: NOT IMPLEMENTED

max/2

pub fn r_min_2() -> Int

Deprecated: NOT IMPLEMENTED

min/2

pub fn r_node_1() -> Int

Deprecated: NOT IMPLEMENTED

node/1

pub fn r_phash2_1() -> Int

Deprecated: NOT IMPLEMENTED

phash2/1

pub fn r_phash2_2() -> Int

Deprecated: NOT IMPLEMENTED

phash2/2

pub fn r_pid_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

pid_to_list/1

pub fn r_port_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

port_to_list/1

pub fn r_ref_to_list_1() -> Int

Deprecated: NOT IMPLEMENTED

ref_to_list/1

pub fn r_round_1(value: Number) -> Int

round/1

pub fn r_setelement_3() -> Int

Deprecated: NOT IMPLEMENTED

setelement/3

pub fn r_size_1() -> Int

Deprecated: NOT IMPLEMENTED

size/1

pub fn r_split_binary_2() -> Int

Deprecated: NOT IMPLEMENTED

split_binary/2

pub fn r_term_to_binary_1() -> Int

Deprecated: NOT IMPLEMENTED

term_to_binary/1

pub fn r_term_to_binary_2() -> Int

Deprecated: NOT IMPLEMENTED

term_to_binary/2

pub fn r_term_to_iovec() -> Int

Deprecated: NOT IMPLEMENTED

term_to_iovec/1

pub fn r_term_to_iovec_2(val: Any, val2: Any) -> Any

Deprecated: FIXME: I'm untyped

term_to_iovec/2

pub fn r_tl_1(value: NonEmptyMaybeImproperList) -> Any

Deprecated: This has no tests

tl/1

pub fn r_trunc(value: Number) -> Int

Deprecated: This has no tests

trunc/1

pub fn r_tuple_size(value: RTuple) -> Int

Deprecated: This has no tests

tuple_size/1

pub fn r_tuple_to_list() -> Int

Deprecated: NOT IMPLEMENTED

tuple_to_list/1

pub fn r_unique_integer_0() -> Int

Deprecated: This has no tests

unique_integer/0 Generates and returns an integer unique on current runtime system instance.

pub fn r_unique_integer_1() -> Int

Deprecated: NOT IMPLEMENTED

Search Document