elm-explorations / test

Write unit and fuzz tests for Elm code.
https://package.elm-lang.org/packages/elm-explorations/test/latest
BSD 3-Clause "New" or "Revised" License
236 stars 40 forks source link

The document of `Shrink.map` has a mistake. #165

Closed Hexirp closed 3 years ago

Hexirp commented 3 years ago

The description of Shrink.map has a mistake on its code snippet.

https://github.com/elm-explorations/test/blob/74076ea9869d1ac70c8c7f674c87946784911506/src/Shrink.elm#L521-L532

It don't pass type checking.

Hexirp commented 3 years ago

I suggest:

  1. Change the code with map Vector (float x) |> andMap (float y) |> andMap (float x).
  2. Change map's type with LazyList a -> (a -> b) -> LazyList b.
  3. Add singleton : a -> LazyList a. Change the code with singleton Vector |> andMap (float x) |> andMap (float y) |> andMap (float x).
drathier commented 3 years ago

I don't think we should change the type of map so that it's only usable in applicative style. However, andMap mostly makes sense in applicative style, so singleton + andMap could be a pipeline friendly alternative, as in your 3rd point. Wanna make a PR?

Hexirp commented 3 years ago

Now, Shrink.andMap is deleted, because the module Shrink is moved to a module Simplify. I close this issue.