2018-11-05 20:55:03 -08:00
|
|
|
|
|
|
|
type Option<T> = Some(T) | None
|
|
|
|
type Color = Red | Green | Blue
|
|
|
|
type Ord = LT | EQ | GT
|
2018-11-06 03:02:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
fn map(input: Option<T>, func: Func): Option<T> {
|
|
|
|
if input {
|
|
|
|
is Some(x) -> Some(func(x)),
|
|
|
|
is None -> None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|