Skip to content

Utilities for working with optional values in Pony 🐴 🚫

Notifications You must be signed in to change notification settings

mfelsche/pony-maybe

Repository files navigation

pony-maybe

Utilities for handling optional data in Pony.

Status

CircleCI

Installation

{ 
  "type": "github",
  "repo": "mfelsche/pony-maybe"
}
  • stable fetch to fetch your dependencies
  • use "maybe" to include this package
  • stable env 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
    )

About

Utilities for working with optional values in Pony 🐴 🚫

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published