Maybe

NONE

Represents the absence of a value in the Maybe type.

NONE    == 0

SOME

Wraps a value in the Maybe type.

SOME 5          == (0 5)
SOME b#hello    == (0 b#hello)
SOME []         == (0 [])

maybeCase

Pattern matches on a Maybe value, providing cases for NONE and SOME.

maybeCase NONE 0 inc              == 0
maybeCase (SOME 5) 0 inc          == 6
maybeCase (SOME b#a) b#none id    == b#a

maybe

Alias for maybeCase. Pattern matches on a Maybe value.

maybe 0 inc NONE              == 0
maybe 0 inc (SOME 5)          == 6
maybe b#none id (SOME b#a)    == b#a

fromSome

Extracts the value from a SOME, or returns a default for NONE.

unpackSome

Extracts the value from a SOME, or crashes for NONE.

isSome

Checks if a Maybe value is SOME.

isNone

Checks if a Maybe value is NONE.

fmapMaybe

Applies a function to the value inside a SOME, or returns NONE.

maybeGuard

Returns NONE if the condition is false, otherwise returns the Maybe value.

maybeGuardNot

Returns NONE if the condition is true, otherwise returns the Maybe value.

Last updated