Skip to content

Long type error for Weights of large type #13

@sjakobi

Description

@sjakobi

I'm trying to use generic-random for the Arbitrary instance of a type with currently 67 constructors. I've defined Weights based on the old definitions use of frequency. I'm fairly confident that I'm covering all the constructors, but GHC doesn't seem to like it and I don't understand what it's trying to say. Any ideas?

BTW, all was fine and dandy (type-wise) while I was initially defining the weights as

(7 :: W "Const") % (1 :: W "Var") % … % undefined

up to where I had defined about 10 weights.

$ cabal test -w ghc-8.6.5 dhall:tasty
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
 - dhall-1.25.0 (test:tasty) (file tests/Dhall/Test/QuickCheck.hs changed)
Preprocessing test suite 'tasty' for dhall-1.25.0..
Building test suite 'tasty' for dhall-1.25.0..
[13 of 15] Compiling Dhall.Test.QuickCheck ( tests/Dhall/Test/QuickCheck.hs, /home/simon/src/dhall-haskell/dist-newstyle/build/x86_64-linux/ghc-8.6.5/dhall-1.25.0/t/tasty/build/tasty/tasty-tmp/Dhall/Test/QuickCheck.o )

tests/Dhall/Test/QuickCheck.hs:249:19: error:
    • Couldn't match type ‘(Generic.Random.Internal.Generic.L
                              "Equivalent",
                            Int,
                            (Generic.Random.Internal.Generic.L "Note"
                             Generic.Random.Internal.Generic.:| (Generic.Random.Internal.Generic.L
                                                                   "ImportAlt"
                                                                 Generic.Random.Internal.Generic.:| Generic.Random.Internal.Generic.L
                                                                                                      "Embed"),
                             Int, ()))’
                     with ‘()’
      Expected type: Generic.Random.Internal.Generic.Prec'
                       ((Generic.Random.Internal.Generic.L "Assert"
                         Generic.Random.Internal.Generic.:| Generic.Random.Internal.Generic.L
                                                              "Equivalent")
                        Generic.Random.Internal.Generic.:| (Generic.Random.Internal.Generic.L
                                                              "Note"
                                                            Generic.Random.Internal.Generic.:| (Generic.Random.Internal.Generic.L
                                                                                                  "ImportAlt"
                                                                                                Generic.Random.Internal.Generic.:| Generic.Random.Internal.Generic.L
                                                                                                                                     "Embed")),
                        Int, ())
        Actual type: ()
    • In the second argument of ‘(%)’, namely ‘()’
      In the second argument of ‘(%)’, namely ‘(0 :: W "Note") % ()’
      In the second argument of ‘(%)’, namely
        ‘(7 :: W "ImportAlt") % (0 :: W "Note") % ()’
    |
249 |                 % ()
    |                   ^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions