elm-community / elm-community/random-extra

sequence and combine seem to be two different implementations of the same function

Open
#28 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
28
Forks
7
PR merge metrics
No merged PRs in 30d

Description

```elm
{-| Turn a list of generators into a generator of lists.
-}
combine : List (Generator a) -> Generator (List a)
combine generators =
case generators of
[] ->
constant []

g :: gs ->
Random.map2 (::) g (combine gs)
```

```elm
{-| Start with a list of generators, and turn them into a generator that returns a list.
-}
sequence : List (Generator a) -> Generator (List a)
sequence =
List.foldr (Random.map2 (::)) (Random.constant [])
```

The slightly different documentation can also be confusing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.