Skip to content

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

New issue

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

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

Already on GitHub? # 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 <sandy@sandymaguire.me>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants