Giter Site home page Giter Site logo

generic-arbitrary's People

Contributors

4e6 avatar awjchen avatar dredozubov avatar ilyakooo0 avatar int-index avatar odr avatar s9gf4ult avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generic-arbitrary's Issues

Arbitrary getting stuck

I tried the following:

data Expr
    = Lit Int
    | Add Expr Expr
    | Mul Expr Expr
    deriving (Eq, Show, Generic)

instance Arbitrary Expr where
    arbitrary = genericArbitrary
    shrink = genericShrink

> generate arbitrary :: IO Expr

This usually never finishes, generating an infinitely large expression.

It did take a while to figure out that the arbitrary instance generates an infinite value rather than my other code getting stuck in an infinite loop.

I then tried using quickcheck-arbitrary-adt instead and my problem was solved. I'm not sure what the differences between the packages are.

Cheers! Yair

error `Test.QuickCheck.resize: negative size` since 0.2.1

GHCup uses generic-arbitrary: https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/test/GHCup/ArbitraryTypes.hs

Since 0.2.1 the tests fail with:

Test suite ghcup-test: RUNNING...
FF
Failures:

  src/Test/Aeson/Internal/RoundtripSpecs.hs:59:5:
  1) GHCup.Types.JSON, JSON encoding of GHCupInfo, allows to encode values with aeson and read them back
       uncaught exception: ErrorCall
       Test.QuickCheck.resize: negative size
       CallStack (from HasCallStack):
         error, called at src/Test/QuickCheck/Gen.hs:135:22 in QuickCheck-2.14.2-a4039abb5c2bf61956f8dce1084c880ba597c6b14935be0ae502da628dbe9111:Test.QuickCheck.Gen
       (after 1 test)
         Exception thrown while showing test case:
           Test.QuickCheck.resize: negative size
           CallStack (from HasCallStack):
             error, called at src/Test/QuickCheck/Gen.hs:135:22 in QuickCheck-2.14.2-a4039abb5c2bf61956f8dce1084c880ba597c6b14935be0ae502da628dbe9111:Test.QuickCheck.Gen


  To rerun use: --match "/GHCup.Types.JSON/JSON encoding of GHCupInfo/allows to encode values with aeson and read them back/"

  src/Test/QuickCheck/Gen.hs:135:22:
  2) GHCup.Types.JSON, JSON encoding of GHCupInfo, produces the same JSON as is found in test/golden/GHCupInfo.json
       uncaught exception: ErrorCall
       Test.QuickCheck.resize: negative size
       CallStack (from HasCallStack):
         error, called at src/Test/QuickCheck/Gen.hs:135:22 in QuickCheck-2.14.2-a4039abb5c2bf61956f8dce1084c880ba597c6b14935be0ae502da628dbe9111:Test.QuickCheck.Gen

  To rerun use: --match "/GHCup.Types.JSON/JSON encoding of GHCupInfo/produces the same JSON as is found in test/golden/GHCupInfo.json/"

Randomized with seed 25004185

Finished in 0.2310 seconds
2 examples, 2 failures

I'm suspecting it may be 0e2e124

Fails to build with GHC 9.2.1

Hi,
the package failing to build with GHC 9.2.1

this package is part of dependency in ghcup test suite and it causes it to fail when building/testing with GHC 9.2.1

The Logs :-

Failed to build generic-arbitrary-0.2.0.
Build log (
/home/username/.cabal/logs/ghc-9.2.1/generic-arbitrary-0.2.0-b7ba577fe184c21dde1df651e1a01fd625359d2e2adc1e72a43a5dae766cbcf6.log
):
Warning: generic-arbitrary.cabal:18:28: Packages with 'cabal-version: 1.12' or
later should specify a specific version of the Cabal spec of the form
'cabal-version: x.y'. Use 'cabal-version: 1.22'.
Configuring library for generic-arbitrary-0.2.0..
Preprocessing library for generic-arbitrary-0.2.0..
Building library for generic-arbitrary-0.2.0..
[1 of 1] Compiling Test.QuickCheck.Arbitrary.Generic ( src/Test/QuickCheck/Arbitrary/Generic.hs, dist/build/Test/QuickCheck/Arbitrary/Generic.o, dist/build/Test/QuickCheck/Arbitrary/Generic.dyn_o )

src/Test/QuickCheck/Arbitrary/Generic.hs:53:3: error:
    • Non type-variable argument in the constraint: GArbitrary (Rep a)
      (Use FlexibleContexts to permit this)
    • In the instance declaration for ‘Arbitrary (GenericArbitrary a)’
   |
53 |   ( Generic a,
   |   ^^^^^^^^^^^^...

src/Test/QuickCheck/Arbitrary/Generic.hs:82:10: error:
    • Non type-variable argument in the constraint: KnownNat (SumLen a)
      (Use FlexibleContexts to permit this)
    • In the instance declaration for ‘GArbitrary (a :+: b)’
   |
82 | instance (GArbitrary a, GArbitrary b, KnownNat (SumLen a), KnownNat (SumLen b)
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
cabal: Failed to build generic-arbitrary-0.2.0 (which is required by
test:ghcup-test from ghcup-0.1.17.4). See the build log above for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.