unfoldable-0.1.0: Class of data structures that can be unfolded from a seed value.

Safe HaskellSafe-Infered

Data.Splittable

Synopsis

Documentation

class Splittable s whereSource

Splittable datatypes are datatypes that can be used as seeds for unfolds.

Methods

split :: Int -> s -> [s]Source

split n s splits the seed s in n seeds.

choose :: [s -> x] -> s -> xSource

choose fs s uses part of the seed s to choose a function from the list fs, and passes the remainder to that function.

getInt :: s -> IntSource

Convert the seed value to an int.

boundedEnum :: forall s a. (Splittable s, Bounded a, Enum a) => s -> aSource

If a datatype is bounded and enumerable, we can use getInt to produce a value from a seed.

data Left Source

Constructors

L 

Instances

data Right Source

Constructors

R 

Instances