Skip to content

Wingman produces silly arbitrary instance for single-constructor types #1879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
isovector opened this issue May 31, 2021 · 0 comments · Fixed by #2644
Closed

Wingman produces silly arbitrary instance for single-constructor types #1879

isovector opened this issue May 31, 2021 · 0 comments · Fixed by #2644
Labels

Comments

@isovector
Copy link
Collaborator

data CourseData = CD
  { cd_dur :: Dur
  , cd_end :: Time
  }

instance Arbitrary CourseData where
  arbitrary
    = let terminal = [(CD <$> arbitrary) <*> arbitrary]
      in
        sized
          $ (\ n
               -> case n <= 1 of
                    True -> oneof terminal
                    False -> oneof $ ([] <> terminal))
@mergify mergify bot closed this as completed in #2644 Jan 28, 2022
mergify bot pushed a commit that referenced this issue Jan 28, 2022
Co-authored-by: Sandy Maguire <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants