Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Removing Fuzz.andThen #183

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Removing Fuzz.andThen #183

wants to merge 6 commits into from

Conversation

jwoudenberg
Copy link
Collaborator

@jwoudenberg jwoudenberg commented Jul 1, 2017

Resolves #160 and #161.

This removes Fuzz.andThen making it a breaking change.
It also fixes two points @mgold alluded to before:

  • the Fuzzer type is wrapped in a type instead of being a type alias to prevent people from casing on it. This is not a major change according to elm-package but it is to a user who for some reason is casing on the fuzzer now, so it makes sense to me to bundle the change in here.
  • Move the last two functions in Fuzz.Internal over to Fuzz.

Some things I think should be wrapped up before merging this:

  • Make solutions for users using andThen for building recusive fuzzers or Msg fuzzers presentable, either by publishing them in a library or linking to them as a sort of cookbook.
  • Consider if there's other breaking changes that should be bundled with this change. Personally, I'd like to change Test.Runner.fuzz so it doesn't need a Debug.crash anymore (the last in the codebase).

It allows user to case on it using the `Ok` and `Err` instructors, which
would make their tests dependant on the `Fuzzer` implementation.

elm-package doesn't consider this a major change, but it is one to users
who were doing this type of pattern matching.
It's sole purpose now is containing the hidden internal type of the Fuzzer,
like before.
@jwoudenberg
Copy link
Collaborator Author

From my perspective this is ready to merge but of course happy to make adjustments!

@rtfeldman
Copy link
Member

Love it! Looks good to me!

@@ -373,18 +374,15 @@ type Shrinkable a
{-| Given a fuzzer, return a random generator to produce a value and a
Shrinkable. The value is what a fuzz test would have received as input.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment saying why there is a Result in the return type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Something like this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, much better.

@mgold
Copy link
Member

mgold commented Jul 9, 2017

This looks good to me. I'm sorting through upcoming changes and don't want breaking API on master right this moment though.

@mgold mgold mentioned this pull request Jul 9, 2017
11 tasks
@rtfeldman
Copy link
Member

rtfeldman commented Jul 9, 2017 via email

@mgold
Copy link
Member

mgold commented Aug 1, 2017

Tagging major-release-blocker so we don't forget about this. Merge conflicts suck but I don't think it's worth resolving them now is we're still not ready to merge. Merging onto a breaking branch will just give us conflicts later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can create a crash by returning an invalid fuzzer from andThen
3 participants