[Haskell-cafe] ghc overlapping instances

Stefan O'Rear stefanor at cox.net
Tue Dec 4 16:53:23 EST 2007


On Tue, Dec 04, 2007 at 03:36:20PM +0100, Steffen Mazanek wrote:
> Hello,
> 
> I want to quickcheck a property on a datatype representing
> programs (=[Stmt]) and need to define a specific instance
> 
> instance Arbitrary [Stmt]
> 
> (mainly to restrict the size of the list).
> 
> In quickcheck an instance Arbitrary of lists is already defined.
> Which parameters do I have to give ghc such that it accepts
> such an instance? In hugs -98 +o is enough. I have
> tried -XOverlappingInstances, -XFlexibleInstances and also
> -XIncoherentInstances, however I still got an overlapping
> instances error for this declaration.

You shouldn't use lists if you need to have special instance behavior -
lists are for perfectly ordinary sequences of things.  If a program is
just a bunch of unrelated statements, then use [], otherwise use a
custom (new)type.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071204/754a3441/attachment.bin


More information about the Haskell-Cafe mailing list