Added janky map to prelude
This commit is contained in:
parent
cee5b085d5
commit
836bed1207
@ -2,3 +2,12 @@
|
|||||||
type Option<T> = Some(T) | None
|
type Option<T> = Some(T) | None
|
||||||
type Color = Red | Green | Blue
|
type Color = Red | Green | Blue
|
||||||
type Ord = LT | EQ | GT
|
type Ord = LT | EQ | GT
|
||||||
|
|
||||||
|
|
||||||
|
fn map(input: Option<T>, func: Func): Option<T> {
|
||||||
|
if input {
|
||||||
|
is Some(x) -> Some(func(x)),
|
||||||
|
is None -> None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user