Gizra / elm-compat-019 / Random017

Like in other modules, the paramenters of andThen were flipped in Elm 0.18.

andThen : Random.Generator a -> (a -> Random.Generator b) -> Random.Generator b

Chain random operations, threading through the seed. In the following example, we will generate a random letter by putting together uppercase and lowercase letters.

letter : Generator Char
letter =
    bool
        `andThen`
            (\b ->
                if b then
                    uppercaseLetter

                else
                    lowercaseLetter
            )


-- bool : Generator Bool
-- uppercaseLetter : Generator Char
-- lowercaseLetter : Generator Char