[Haskell-cafe] How best to deal with Monoid/Applicative changes in 7.10 in a backwards-compatable way

Doug Burke dburke.gw at gmail.com
Wed Dec 24 14:49:27 UTC 2014


I'm trying out the ghc 7.10 RC and am seeing lots of warnings about Monoid
and some symbols from Control.Applicative - e.g.

    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()

For now I'm wrapping the import with some CPP so that it will still compile
with older ghc versions (and a probably-pointless attempt to be
non-ghc-specific, since I have never tested my code with other compilers):

#if (!defined(__GLASGOW_HASKELL__)) || (__GLASGOW_HASKELL__ < 710)
import Control.Applicative (Applicative(pure), (<$>), (<*>))
import Data.Monoid (Monoid(..))
#else
import Control.Applicative ((<$>))
#endif

Is this the best way? Am I missing something really obvious?

Thanks,
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141224/ead12600/attachment.html>


More information about the Haskell-Cafe mailing list