Merge pull request #267 from aeternity/option-fix

Fixed `force` function
This commit is contained in:
Radosław Rowicki 2020-06-18 15:05:55 +02:00 committed by GitHub
commit 6b60fde2df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,9 @@ namespace Option =
/** Assume it is `Some` /** Assume it is `Some`
*/ */
function force(o : option('a)) : 'a = default(abort("Forced None value"), o) function force(o : option('a)) : 'a = switch(o)
None => abort("Forced None value")
Some(x) => x
function on_elem(o : option('a), f : 'a => unit) : unit = match((), f, o) function on_elem(o : option('a), f : 'a => unit) : unit = match((), f, o)