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
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
Likely cannot be implemented in Gleam
pub type CPUTopology =
ROSETTABROKEN
pub type ConversionError {
NegativeIntegerError
}
Constructors
-
NegativeIntegerError
pub type DeprecatedTimeUnit {
Seconds
MilliSeconds
MicroSeconds
NanoSeconds
}
Constructors
-
Seconds
-
MilliSeconds
-
MicroSeconds
-
NanoSeconds
pub type DistHandle =
ROSETTABROKEN
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
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
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
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
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
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
Represents a type that has no implementation yet or has known compatibility issues.
pub type ROSETTABROKEN
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
stacktrace/0
pub type Stacktrace =
ROSETTABROKEN
stacktrace_extrainfo/0
pub type StacktraceExtrainfo =
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
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_2(value: Atom, encoding: Atom) -> Binary
pub fn r_atom_to_list(value: Atom) -> String
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_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_bitstring_to_list_1() -> Int
Deprecated: NOT IMPLEMENTED
bitstring_to_list/1
pub fn r_delete_element_2() -> Int
Deprecated: NOT IMPLEMENTED
delete_element/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_floor_1(value: Number) -> Int
Deprecated: This function is lacking tests
floor/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_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_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_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_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_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_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_match_spec_test_3() -> Int
Deprecated: NOT IMPLEMENTED
match_spec_test/3
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_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_tuple_size(value: RTuple) -> Int
Deprecated: This has no tests
tuple_size/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.