-
Notifications
You must be signed in to change notification settings - Fork 125
New instances and CI cleanup #427
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
base: master
Are you sure you want to change the base?
Conversation
1dc8463
to
3e3799d
Compare
@nick8325 @UlfNorell and @Rewbert I'd like to get some input on the state of the |
Looks really nice! I will try to add some instances to get more familiar with it. @MaximilianAlgehed This PR will stay open for a while, right? Or will we squeeze all our proposed changes into different PRs? |
@Rewbert maybe the best thing to do right now is to move the |
Makes sense. I hope to find some time tomorrow to look at more instances :) |
Pushed some silly instance for It exports only three types, and it is trivial to derive instances instance Arbitrary (ArgDescr Int) where
arbitrary = oneof [ NoArg <$> arbitrary
, ReqArg <$> arbitrary <*> arbitrary
, OptArg <$> arbitrary <*> arbitrary
]
instance Arbitrary (ArgOrder Int) where
arbitrary = oneof [ return RequireOrder
, return Permute
, ReturnInOrder <$> arbitrary
]
instance Arbitrary (OptDescr Int) where
arbitrary = Option
<$> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary But it is very unlikely that anything sensible will be generated. However, anything sensitive will be dependent on some context, which we cannot supply lmao. I am not sure that I am a fan of these instances. Had a look at |
These are fine AFAIK, but it would be nice with shrinking and CPP pragmas to make sure the build passes! ;) |
Haha right, I will make sure to fix it. |
CI won't trigger because there are conflicts I think. |
Looks like a silly conflict! |
|
6a9edc4
to
ed72ec4
Compare
…sion that supports it. Also shrinking
4e7135c
to
acab693
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revision.
Looks like some consequences of base >= 4.14
have not been pushed through yet...
QuickCheck.cabal
Outdated
@@ -136,17 +134,6 @@ library | |||
if !impl(ghc >= 7.4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional can also be deleted, as ghc >= 7.4 will never be false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically, ghc >= 7.4
is false when you're not compiling for ghc
?
QuickCheck.cabal
Outdated
-- Safe Haskell appeared in GHC 7.2, but GHC.Generics isn't safe until 7.4. | ||
if impl (ghc < 7.4) | ||
cpp-options: -DNO_SAFE_HASKELL | ||
|
||
-- random is explicitly Trustworthy since 1.0.1.0 | ||
-- similar constraint for containers | ||
if impl(ghc >= 7.2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make unconditional (and some more below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was confused by this I think when I went over these impl(ghc >= 7.2)
is not true if you're running on hugs
or another compiler so I think the right thing to do would be to change these to impl(ghc)
.
src/Test/QuickCheck/Arbitrary.hs
Outdated
import qualified Data.Semigroup as Semigroup | ||
import Data.Ord | ||
|
||
#if MIN_VERSION_base(4,14,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always true, so you can make this unconditional.
@@ -1035,6 +1089,158 @@ instance Arbitrary (f a) => Arbitrary (Monoid.Alt f a) where | |||
arbitrary = fmap Monoid.Alt arbitrary | |||
shrink = map Monoid.Alt . shrink . Monoid.getAlt | |||
#endif | |||
|
|||
#if MIN_VERSION_base(4,9,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always true.
src/Test/QuickCheck/Arbitrary.hs
Outdated
shrink = map Down . shrink . getDown | ||
#endif | ||
|
||
#if MIN_VERSION_base(4,14,0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always true.
No description provided.