This leads to more consistent formatting across entire Aiken programs. Before that commit, only long expressions would be formatted on a newline, causing non-consistent formatting and additional reading barrier when looking at source code. Programs also now take more vertical space, which is better for more friendly diffing in version control systems (especially git).
17 lines
250 B
Plaintext
17 lines
250 B
Plaintext
pub fn map(opt: Option<a>, f: fn(a) -> result) -> Option<result> {
|
|
when opt is {
|
|
None ->
|
|
None
|
|
Some(a) ->
|
|
Some(f(a))
|
|
}
|
|
}
|
|
|
|
test map_1() {
|
|
map(None, fn(_) { 14 }) == None
|
|
}
|
|
|
|
test map_2() {
|
|
map(None, fn(_) { Void }) == None
|
|
}
|