Add array and monad lib files.
This commit is contained in:
parent
0dd58cdfdc
commit
919b312d68
@ -1,5 +1,12 @@
|
|||||||
ns std::core
|
ns std::core
|
||||||
|
|
||||||
decl pub int Array {
|
decl pub int Array<T> : Monad {
|
||||||
length: Int
|
length: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod array {
|
||||||
|
// Usage:
|
||||||
|
// let int_array = array::of(1, 2, 3)
|
||||||
|
// assert_eq(3, int_array.length)
|
||||||
|
decl pub fn of<T>(ts: ...T): Array<T>
|
||||||
|
}
|
||||||
|
4
dm_lib/std/core/monad.dm
Normal file
4
dm_lib/std/core/monad.dm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub hkt Monad[T<A>] {
|
||||||
|
fn <B> map(m: fn (from: A) => B): T<B>
|
||||||
|
fn <B> flat_map(m: fn (from: A) => T<B>): T<B>
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user