Probably you need to implement coarbitrary, too. My ghci session for your code:
$ ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude> :l t.hs [1 of 1] Compiling Main ( t.hs, interpreted ) t.hs:4:0: Warning: No explicit method nor default method for `coarbitrary' In the instance declaration for `Arbitrary L.ByteString' Ok, modules loaded: Main. *Main> quickCheck prop_LPS Loading package array-0.1.0.0 ... linking ... done. Loading package bytestring-0.9.0.1 ... linking ... done. Loading package old-locale-1.0.0.0 ... linking ... done. Loading package old-time-1.0.0.0 ... linking ... done. Loading package random-1.0.0.0 ... linking ... done. Loading package QuickCheck-1.1.0.0 ... linking ... done. OK, passed 100 tests. On 6/24/08, Thomas M. DuBuisson <[EMAIL PROTECTED]> wrote: > Cafe > I'm a bit lost on this exception and curious about what's going on. Is > there a valid reason for this exception that I am missing? Note the > hard-coded [0..100] could be any Word8 list you want (generated via > arbitrary, [], or other) and it gives the same result. > > Load the module and perform: > :break prop_LPS > quickCheck prop_LPS > :step > :force ps > *** Exception: Prelude.head: empty list > >> import qualified Data.ByteString as L >> import Test.QuickCheck >> >> instance Arbitrary L.ByteString where >> arbitrary = do >> return $ L.pack [0..100] >> >> prop_LPS :: L.ByteString -> Bool >> prop_LPS ps = ps `seq` True > > P.S. Same result with GHCi 6.8.2 and 6.8.3. > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
