pony-maybe
Utilities for handling optional data in Pony.
Status
Installation
- Install corral
corral add github.com/mfelsche/pony-maybe.git --version master
corral fetch
to fetch your dependenciesuse "maybe"
to include this packagecorral run -- ponyc
to compile your application
Usage
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
)