[Haskell-cafe] Dealing with GHC 7.10 prelude imports
mantkiew at gsd.uwaterloo.ca
Mon Apr 13 02:06:28 UTC 2015
the only problem with the "import Prelude" trick is that it does not help
when you explicitly list what you import. For example, in one of my files I
import Control.Applicative ((<$>))
which will still result in a warning. Simply change it to
However, sometimes there are conflicting names due to reexports. For
example, forM is both in Data.Traversable and Control.Monad. In such a
case, use "hiding" for one of them.
import <module> (<f>)
import <module> hiding (<everything except f>)
if you want to avoid CPP at all cost.
I too went through a few cycles 7.8.4 <-> 7.10.1 trying to make the code
warning free on both (I don't use Travis but having minghc on Windows or
using HVR's PPA on Ubuntu helps a lot).
On Sun, Apr 12, 2015 at 3:45 PM, Brendan Hay <brendan.g.hay at gmail.com>
> Thanks for the tips!
> On 12 April 2015 at 12:37, Benno Fünfstück <benno.fuenfstueck at gmail.com>
>> > 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.
>> A trick is to import Prelude at the very end, like:
>> import Control.Applicative
>> import Data.Monoid
>> import Prelude
>> Since the unused import check is done from top to bottom, and you almost
>> always use *something* from the Prelude, this will suppress the warning.
>> There are some problems with qualified/explicit import lists if I recall
>> correctly though. But it works for me most of the time.
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe