Safe Haskell | Safe-Infered |
---|

- class Splittable s where
- boundedEnum :: forall s a. (Splittable s, Bounded a, Enum a) => s -> a
- data Left = L
- data Right = R

# Documentation

class Splittable s whereSource

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

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.

Convert the seed value to an `int`

.

Splittable Integer | The |

Splittable StdGen | Choose randomly |

Splittable Right | Always choose the last item. |

Splittable Left | Always choose the first item. |

Splittable s => Splittable (Dual s) | Reverse the split output and the choose input. |

(Splittable a, Splittable b) => Splittable (Either a b) | Choose between 2 ways to split and choose. |

(Splittable a, Splittable b) => Splittable (a, b) | The |

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.