flix

0.56.0

Eff.RandomCoin

eff RandomCoinSource

An effect used to throw a random coin.

Operations

def flip(): Bool Source

Returns true or false with equal chance.

Definitions

def handle(f: a -> b \ ef): a -> b \ (ef - RandomCoin) + NonDet + IO \ NonDet + IO Source

Handles the RandomCoin effect of the given function f.

In other words, re-interprets the RandomCoin effect using the NonDet and IO effects.

def runWithIO(f: Unit -> a \ ef): a \ (ef - RandomCoin) + NonDet + IO Source

Runs the RandomCoin effect of the given function f.

In other words, re-interprets the RandomCoin effect using the NonDet and IO effects.