-
Notifications
You must be signed in to change notification settings - Fork 5
2015 003a Option
John Reppy edited this page Sep 2, 2015
·
1 revision
structure Option : OPTIONWe propose two new functions for the Option module.
This page is part of proposal 2015-003.
val isNone : 'a option -> bool
val fold : ('a * 'b -> 'b) -> 'b -> 'a option -> 'b-
isNone optreturnstrueifoptisNONEandfalseotherwise. -
fold f init optreturnsinitifoptisNONEandf(x, init)ifoptisSOME x.
Since isSome is part of the pervasive environment, isNone should also be
visible without qualification.
The isNone function provides a convienient test that was omitted from the original
Basis Library.
Likewise, the fold function fills a hole in the specification.
