[Haskell-cafe] SYB and opaque types

Simon Peyton-Jones simonpj at microsoft.com
Wed Apr 18 15:32:09 EDT 2007

| I know that the warnings about gunfold, toConstr and dataTypeOf are
| harmless but how would I define them to avoid the warnings?

I guess you could define them in the instance to be error calls:

instance Data SourcePos where
     gfoldl r k x = k x
     gunfold = error "gunfold:SourcePos"

That way you are making it clear that you didn't leave them out by accident.

| Also, the definition of strip above requires -fno-monomorphism-
| restriction. Should I not worry about it? The code runs just fine,
| locations are being stripped and tests pass.

Best thing is to give 'strip' a type signature; then it'll work regardless of flags.


More information about the Haskell-Cafe mailing list