[Haskell-cafe] Quickcheck examples and Data.Word32

Joel Reymont joelr1 at gmail.com
Thu Oct 27 14:06:12 EDT 2005


This requires

{-# OPTIONS_GHC -fallow-undecidable-instances #-}

but since I'm using -fglasgow-exts in a lot of places I'm wondering  
if adding undecidable instances would be a bad habit. I guess not...  
not until I shoot myself in the foot :-).

Any explanation of undecidable instances, the good and the bad?

     Joel

On Oct 27, 2005, at 6:49 PM, Bryn Keller wrote:

> How about this?
>
> class ArbitraryDefault a where {}
>
> instance (Integral a, Bounded a, ArbitraryDefault a) => Arbitrary a  
> where
>    arbitrary = arbitraryBound
>    coarbitrary a = error "Not implemented"
>
> instance ArbitraryDefault Word16   instance ArbitraryDefault Word32
> instance ArbitraryDefault Word64

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list