Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/std/core/maybe.kk
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ pub fun map( m : maybe<a>, f : a -> e b ) : e maybe<b>
Nothing -> Nothing
Just(x) -> Just(f(x))

pub fun flatmap( m : maybe<a>, f : a -> e maybe<b> ) : e maybe<b>
match m
Nothing -> Nothing
Just(x) -> f(x)

pub fun (||)( m1 : maybe<a>, m2: maybe<a> ) : maybe<a>
match m1
Nothing -> m2
Expand Down
5 changes: 5 additions & 0 deletions lib/std/core/maybe2.kk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ pub fun map( m : maybe2<a,b>, f : (a,b) -> e (c,d) ) : e maybe2<c,d>
Just2(x,y) -> match f(x,y)
(fx,fy) -> Just2(fx,fy)

pub fun flatmap( m : maybe2<a,b>, f : (a,b) -> e maybe2<c,d> ) : e maybe2<c,d>
match m
Nothing2 -> Nothing2
Just2(x,y) -> f(x,y)

pub fun (||)( m1 : maybe2<a,b>, m2: maybe2<a,b> ) : maybe2<a,b>
match m1
Nothing2 -> m2
Expand Down