binary icon indicating copy to clipboard operation
binary copied to clipboard

don't re-export Data.Word from Data.Binary

Open mzero opened this issue 10 years ago • 0 comments

Data.Binary is small enough, and exports names that are unique enough, that it can commonly be simply imported wholesale:

import Data.Binary

However, this also happens to re-export Data.Word, which is surprising, and generates a warning from GHC, if code that uses it also imports Data.Word:

Import Data.Binary
Import Data.Word

yields:

src/Foo.hs:7:1: Warning:
     The import of ‘Data.Word’ is redundant
      except perhaps to import instances from ‘Data.Word’
    To import instances alone, use: import Data.Word()

In a module that uses both Binary and Word explicitly, it makes for poor developer experience to rely on Data.Binary to export the names from Data.Word. If you move the Data.Binary dependent code out of the module, and delete the import - the remaining Data.Word code doesn't compile.

mzero avatar Jun 10 '15 05:06 mzero