You can use a custom Prelude. E.g., the "base-prelude" project takes care of this problem: http://hackage.haskell.org/package/base-prelude


2015-04-12 11:14 GMT+03:00 Alan & Kim Zimmerman <alan.zimm@gmail.com>:
I have just solved one of these by doing

{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ < 709
import Data.Monoid hiding ((<>))
#endif

Alan


On Sun, Apr 12, 2015 at 9:55 AM, Brendan Hay <brendan.g.hay@gmail.com> wrote:
Hi,

I've run into a couple of cases when attempting to support multiple GHC
versions in my libraries (7.6.3 -> 7.10) where I've repeatedly made mistakes
due to being warned about unused imports for various modules that are now part
of the Prelude such as Data.Monoid, Data.Foldable, etc. which I subsequently
remove either manually or via editor automation sufficiently indistinguishable
from magic.

This then results in successful compilation on 7.10 and failure on earlier
versions of GHC due to missing imports (ie. Data.Monoid (mappend, mempty)),
which prior to my current workflow of manually building on multiple versions of
GHC before releasing a new version, manifested once or twice only after
uploading to Hackage.

Now this is all user/workflow error on my part, but I wondered if others have
some kind of trick up their sleeve for avoiding these kind of issues? I could
attempt to tailor the compiler's warning flags appropriately, but it bodes ill for
spotting genuinely unused imports.

Cheers,
Brendan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe