Utilities for handling optional data in Pony.
- Install pony-stable
- Update your
bundle.json
{
"type": "github",
"repo": "mfelsche/pony-maybe"
}
stable fetch
to fetch your dependenciesuse "maybe"
to include this packagestable env ponyc
to compile your application
use "maybe"
class WithOptionalStuff
let _stuff: Maybe[String] = None
fun update_stuff(new_stuff: String): Maybe[String] =>
_stuff = new_stuff
fun size(): USize =>
Opt.get[USize](
Opt.map[String, USize](_stuff, {(s) => s.size() }),
0
)