Skip to content

Commit

Permalink
update .mbti interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Guest0x0 committed Jan 14, 2025
1 parent c3acb33 commit fa7db8d
Show file tree
Hide file tree
Showing 28 changed files with 199 additions and 63 deletions.
3 changes: 2 additions & 1 deletion buffer/buffer.mbti
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package moonbitlang/core/buffer

// Values
fn new(size_hint~ : Int = ..) -> T

// Types and methods
type T
impl T {
contents(Self) -> Bytes
is_empty(Self) -> Bool
length(Self) -> Int
new(size_hint~ : Int = ..) -> Self
new(size_hint~ : Int = ..) -> Self //deprecated
reset(Self) -> Unit
to_bytes(Self) -> Bytes
to_string(Self) -> String //deprecated
Expand Down
9 changes: 9 additions & 0 deletions bytes/bytes.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
package moonbitlang/core/bytes

// Values
fn default() -> Bytes

fn from_array(Array[Byte]) -> Bytes

fn from_fixedarray(FixedArray[Byte], len? : Int) -> Bytes

fn from_iter(Iter[Byte]) -> Bytes

fn of(FixedArray[Byte]) -> Bytes

// Types and methods
impl Bytes {
Expand Down
15 changes: 11 additions & 4 deletions deque/deque.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package moonbitlang/core/deque

// Values
fn from_array[A](Array[A]) -> T[A]

fn from_iter[A](Iter[A]) -> T[A]

fn new[A](capacity~ : Int = ..) -> T[A]

fn of[A](FixedArray[A]) -> T[A]

// Types and methods
type T
Expand All @@ -14,17 +21,17 @@ impl T {
each[A](Self[A], (A) -> Unit) -> Unit
eachi[A](Self[A], (Int, A) -> Unit) -> Unit
filter_map_inplace[A](Self[A], (A) -> A?) -> Unit //deprecated
from_array[A](Array[A]) -> Self[A]
from_iter[A](Iter[A]) -> Self[A]
from_array[A](Array[A]) -> Self[A] //deprecated
from_iter[A](Iter[A]) -> Self[A] //deprecated
front[A](Self[A]) -> A?
is_empty[A](Self[A]) -> Bool
iter[A](Self[A]) -> Iter[A]
iter2[A](Self[A]) -> Iter2[Int, A]
length[A](Self[A]) -> Int
map[A, U](Self[A], (A) -> U) -> Self[U]
mapi[A, U](Self[A], (Int, A) -> U) -> Self[U]
new[A](capacity~ : Int = ..) -> Self[A]
of[A](FixedArray[A]) -> Self[A]
new[A](capacity~ : Int = ..) -> Self[A] //deprecated
of[A](FixedArray[A]) -> Self[A] //deprecated
op_equal[A : Eq](Self[A], Self[A]) -> Bool
op_get[A](Self[A], Int) -> A
op_set[A](Self[A], Int, A) -> Unit
Expand Down
2 changes: 2 additions & 0 deletions double/double.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package moonbitlang/core/double

// Values
fn from_int(Int) -> Double

let infinity : Double

let max_value : Double
Expand Down
2 changes: 2 additions & 0 deletions float/float.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package moonbitlang/core/float

// Values
fn default() -> Float

let infinity : Float

let max_value : Float
Expand Down
15 changes: 11 additions & 4 deletions hashmap/hashmap.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ package moonbitlang/core/hashmap
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[K : Hash + Eq, V](Array[(K, V)]) -> T[K, V]

fn from_iter[K : Hash + Eq, V](Iter[(K, V)]) -> T[K, V]

fn new[K, V](capacity~ : Int = ..) -> T[K, V]

fn of[K : Eq + Hash, V](FixedArray[(K, V)]) -> T[K, V]

// Types and methods
type T
Expand All @@ -12,16 +19,16 @@ impl T {
contains[K : Hash + Eq, V](Self[K, V], K) -> Bool
each[K, V](Self[K, V], (K, V) -> Unit) -> Unit
eachi[K, V](Self[K, V], (Int, K, V) -> Unit) -> Unit
from_array[K : Hash + Eq, V](Array[(K, V)]) -> Self[K, V]
from_iter[K : Hash + Eq, V](Iter[(K, V)]) -> Self[K, V]
from_array[K : Hash + Eq, V](Array[(K, V)]) -> Self[K, V] //deprecated
from_iter[K : Hash + Eq, V](Iter[(K, V)]) -> Self[K, V] //deprecated
get[K : Hash + Eq, V](Self[K, V], K) -> V?
get_or_default[K : Hash + Eq, V](Self[K, V], K, V) -> V
get_or_init[K : Hash + Eq, V](Self[K, V], K, () -> V) -> V
is_empty[K, V](Self[K, V]) -> Bool
iter[K, V](Self[K, V]) -> Iter[(K, V)]
iter2[K, V](Self[K, V]) -> Iter2[K, V]
new[K, V](capacity~ : Int = ..) -> Self[K, V]
of[K : Eq + Hash, V](FixedArray[(K, V)]) -> Self[K, V]
new[K, V](capacity~ : Int = ..) -> Self[K, V] //deprecated
of[K : Eq + Hash, V](FixedArray[(K, V)]) -> Self[K, V] //deprecated
op_get[K : Hash + Eq, V](Self[K, V], K) -> V?
op_set[K : Hash + Eq, V](Self[K, V], K, V) -> Unit
remove[K : Hash + Eq, V](Self[K, V], K) -> Unit
Expand Down
15 changes: 11 additions & 4 deletions hashset/hashset.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ package moonbitlang/core/hashset
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[K : Hash + Eq](Array[K]) -> T[K]

fn from_iter[K : Hash + Eq](Iter[K]) -> T[K]

fn new[K](capacity~ : Int = ..) -> T[K]

fn of[K : Hash + Eq](FixedArray[K]) -> T[K]

// Types and methods
type T
Expand All @@ -14,14 +21,14 @@ impl T {
difference[K : Hash + Eq](Self[K], Self[K]) -> Self[K]
each[K](Self[K], (K) -> Unit) -> Unit
eachi[K](Self[K], (Int, K) -> Unit) -> Unit
from_array[K : Hash + Eq](Array[K]) -> Self[K]
from_iter[K : Hash + Eq](Iter[K]) -> Self[K]
from_array[K : Hash + Eq](Array[K]) -> Self[K] //deprecated
from_iter[K : Hash + Eq](Iter[K]) -> Self[K] //deprecated
insert[K : Hash + Eq](Self[K], K) -> Unit //deprecated
intersection[K : Hash + Eq](Self[K], Self[K]) -> Self[K]
is_empty[K](Self[K]) -> Bool
iter[K](Self[K]) -> Iter[K]
new[K](capacity~ : Int = ..) -> Self[K]
of[K : Hash + Eq](FixedArray[K]) -> Self[K]
new[K](capacity~ : Int = ..) -> Self[K] //deprecated
of[K : Hash + Eq](FixedArray[K]) -> Self[K] //deprecated
remove[K : Hash + Eq](Self[K], K) -> Unit
size[K](Self[K]) -> Int
symmetric_difference[K : Hash + Eq](Self[K], Self[K]) -> Self[K]
Expand Down
23 changes: 17 additions & 6 deletions immut/array/array.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ package moonbitlang/core/immut/array
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[A](Array[A]) -> T[A]

fn from_iter[A](Iter[A]) -> T[A]

fn make[A](Int, A) -> T[A]

fn makei[A](Int, (Int) -> A) -> T[A]

fn new[A]() -> T[A]

fn of[A](FixedArray[A]) -> T[A]

// Types and methods
type T
Expand All @@ -13,16 +24,16 @@ impl T {
fold[A, B](Self[A], init~ : B, (B, A) -> B) -> B
fold_left[A](Self[A], (A, A) -> A, init~ : A) -> A //deprecated
fold_right[A](Self[A], (A, A) -> A, init~ : A) -> A //deprecated
from_array[A](Array[A]) -> Self[A]
from_iter[A](Iter[A]) -> Self[A]
from_array[A](Array[A]) -> Self[A] //deprecated
from_iter[A](Iter[A]) -> Self[A] //deprecated
is_empty[A](Self[A]) -> Bool
iter[A](Self[A]) -> Iter[A]
length[A](Self[A]) -> Int
make[A](Int, A) -> Self[A]
makei[A](Int, (Int) -> A) -> Self[A]
make[A](Int, A) -> Self[A] //deprecated
makei[A](Int, (Int) -> A) -> Self[A] //deprecated
map[A, B](Self[A], (A) -> B) -> Self[B]
new[A]() -> Self[A]
of[A](FixedArray[A]) -> Self[A]
new[A]() -> Self[A] //deprecated
of[A](FixedArray[A]) -> Self[A] //deprecated
op_get[A](Self[A], Int) -> A
push[A](Self[A], A) -> Self[A]
rev_fold[A, B](Self[A], init~ : B, (B, A) -> B) -> B
Expand Down
15 changes: 11 additions & 4 deletions immut/hashmap/hashmap.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ package moonbitlang/core/immut/hashmap
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[K : Eq + Hash, V](Array[(K, V)]) -> T[K, V]

fn from_iter[K : Eq + Hash, V](Iter[(K, V)]) -> T[K, V]

fn new[K, V]() -> T[K, V]

fn of[K : Eq + Hash, V](FixedArray[(K, V)]) -> T[K, V]

// Types and methods
type T
impl T {
add[K : Eq + Hash, V](Self[K, V], K, V) -> Self[K, V]
each[K, V](Self[K, V], (K, V) -> Unit) -> Unit
find[K : Eq + Hash, V](Self[K, V], K) -> V?
from_array[K : Eq + Hash, V](Array[(K, V)]) -> Self[K, V]
from_iter[K : Eq + Hash, V](Iter[(K, V)]) -> Self[K, V]
from_array[K : Eq + Hash, V](Array[(K, V)]) -> Self[K, V] //deprecated
from_iter[K : Eq + Hash, V](Iter[(K, V)]) -> Self[K, V] //deprecated
iter[K, V](Self[K, V]) -> Iter[(K, V)]
new[K, V]() -> Self[K, V]
of[K : Eq + Hash, V](FixedArray[(K, V)]) -> Self[K, V]
new[K, V]() -> Self[K, V] //deprecated
of[K : Eq + Hash, V](FixedArray[(K, V)]) -> Self[K, V] //deprecated
op_get[K : Eq + Hash, V](Self[K, V], K) -> V?
remove[K : Eq + Hash, V](Self[K, V], K) -> Self[K, V]
size[K, V](Self[K, V]) -> Int
Expand Down
15 changes: 11 additions & 4 deletions immut/hashset/hashset.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ package moonbitlang/core/immut/hashset
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[A : Eq + Hash](Array[A]) -> T[A]

fn from_iter[A : Eq + Hash](Iter[A]) -> T[A]

fn new[A]() -> T[A]

fn of[A : Eq + Hash](FixedArray[A]) -> T[A]

// Types and methods
type T
impl T {
add[A : Eq + Hash](Self[A], A) -> Self[A]
contains[A : Eq + Hash](Self[A], A) -> Bool
each[A](Self[A], (A) -> Unit) -> Unit
from_array[A : Eq + Hash](Array[A]) -> Self[A]
from_iter[A : Eq + Hash](Iter[A]) -> Self[A]
from_array[A : Eq + Hash](Array[A]) -> Self[A] //deprecated
from_iter[A : Eq + Hash](Iter[A]) -> Self[A] //deprecated
is_empty[A](Self[A]) -> Bool
iter[A](Self[A]) -> Iter[A]
new[A]() -> Self[A]
of[A : Eq + Hash](FixedArray[A]) -> Self[A]
new[A]() -> Self[A] //deprecated
of[A : Eq + Hash](FixedArray[A]) -> Self[A] //deprecated
remove[A : Eq + Hash](Self[A], A) -> Self[A]
size[A](Self[A]) -> Int
}
Expand Down
2 changes: 1 addition & 1 deletion immut/internal/sparse_array/sparse_array.mbti
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package moonbitlang/core/immut/internal/sparse_array

// Values
fn singleton[X](Int, X) -> SparseArray[X]

// Types and methods
pub(all) type Bitset UInt
Expand All @@ -23,7 +24,6 @@ impl SparseArray {
has[X](Self[X], Int) -> Bool
op_get[X](Self[X], Int) -> X?
replace[X](Self[X], Int, X) -> Self[X]
singleton[X](Int, X) -> Self[X]
size[X](Self[X]) -> Int
}
impl[X : Eq] Eq for SparseArray[X]
Expand Down
21 changes: 16 additions & 5 deletions immut/list/list.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ alias @moonbitlang/core/json as @json
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn default[X]() -> T[X]

fn from_array[A](Array[A]) -> T[A]

fn from_iter[A](Iter[A]) -> T[A]

fn from_json[A : @json.FromJson](Json) -> T[A][email protected]

fn of[A](FixedArray[A]) -> T[A]

fn repeat[A](Int, A) -> T[A]

fn singleton[A](A) -> T[A]
Expand All @@ -22,7 +32,7 @@ impl T {
concat[A](Self[A], Self[A]) -> Self[A]
concat_map[A, B](Self[A], (A) -> Self[B]) -> Self[B] //deprecated
contains[A : Eq](Self[A], A) -> Bool
default[X]() -> Self[X]
default[X]() -> Self[X] //deprecated
drop[A](Self[A], Int) -> Self[A]
drop_while[A](Self[A], (A) -> Bool) -> Self[A]
each[A](Self[A], (A) -> Unit) -> Unit
Expand All @@ -40,9 +50,9 @@ impl T {
fold_right[A, B](Self[A], (A, B) -> B, init~ : B) -> B //deprecated
fold_righti[A, B](Self[A], (Int, A, B) -> B, init~ : B) -> B //deprecated
foldi[A, B](Self[A], init~ : B, (Int, B, A) -> B) -> B
from_array[A](Array[A]) -> Self[A]
from_iter[A](Iter[A]) -> Self[A]
from_json[A : @json.FromJson](Json) -> Self[A][email protected]
from_array[A](Array[A]) -> Self[A] //deprecated
from_iter[A](Iter[A]) -> Self[A] //deprecated
from_json[A : @json.FromJson](Json) -> Self[A][email protected] //deprecated
head[A](Self[A]) -> A?
head_exn[A](Self[A]) -> A //deprecated
init_[A](Self[A]) -> Self[A]
Expand All @@ -62,7 +72,7 @@ impl T {
minimum[A : Compare](Self[A]) -> A?
nth[A](Self[A], Int) -> A?
nth_exn[A](Self[A], Int) -> A //deprecated
of[A](FixedArray[A]) -> Self[A]
of[A](FixedArray[A]) -> Self[A] //deprecated
op_add[A](Self[A], Self[A]) -> Self[A]
remove[A : Eq](Self[A], A) -> Self[A]
remove_at[A](Self[A], Int) -> Self[A]
Expand All @@ -88,6 +98,7 @@ impl T {
unzip[A, B](Self[(A, B)]) -> (Self[A], Self[B])
zip[A, B](Self[A], Self[B]) -> Self[(A, B)]?
}
impl[X] Default for T[X]
impl[A : Eq] Eq for T[A]
impl[A : Hash] Hash for T[A]
impl[A : Show] Show for T[A]
Expand Down
11 changes: 8 additions & 3 deletions immut/priority_queue/priority_queue.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@ package moonbitlang/core/immut/priority_queue
alias @moonbitlang/core/quickcheck as @quickcheck

// Values
fn from_array[A : Compare](Array[A]) -> T[A]

fn new[A : Compare]() -> T[A]

fn of[A : Compare](FixedArray[A]) -> T[A]

// Types and methods
type T
impl T {
from_array[A : Compare](Array[A]) -> Self[A]
from_array[A : Compare](Array[A]) -> Self[A] //deprecated
from_iter[A : Compare](Iter[A]) -> Self[A]
is_empty[A](Self[A]) -> Bool
iter[A : Compare](Self[A]) -> Iter[A]
length[A](Self[A]) -> Int
new[A : Compare]() -> Self[A]
of[A : Compare](FixedArray[A]) -> Self[A]
new[A : Compare]() -> Self[A] //deprecated
of[A : Compare](FixedArray[A]) -> Self[A] //deprecated
peek[A](Self[A]) -> A?
pop[A : Compare](Self[A]) -> Self[A]?
pop_exn[A : Compare](Self[A]) -> Self[A] //deprecated
Expand Down
Loading

0 comments on commit fa7db8d

Please sign in to comment.