Skip to content

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

Closed
@isovector

Description

@isovector
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))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions