Proposal: Export Data.Word.Word from Prelude

Carter Schonwald carter.schonwald at gmail.com
Sat Aug 9 18:27:44 UTC 2014


strong +1 from me!


On Sat, Aug 9, 2014 at 7:38 AM, Herbert Valerio Riedel <hvr at gnu.org> wrote:

> Hello *,
>
> Proposal
> --------
>
> I hereby propose to export Haskell2010's Data.Word.Word type from the
> Prelude
>
>
> Motivation
> ----------
>
> Starting with Haskell2010, "Data.Word" exporting the type 'Word', "an
> unsigned integral type, with the same size as 'Int'" became part of the
> Haskell Report.
>
> 'Word' is usually a better choice than 'Int' when non-negative
> quantities (such as list lengths, bit or vector indices, or number of
> items in a container) need to be represented. Currently however, 'Word'
> is at a disadvantage (with respect to 'Int') in terms of public exposure
> by being accessible only after an "import Data.Word".
>
> Moreover, since 'Word' is now part of the Haskell Report, libraries
> should attempt to avoid name-clashing with 'Word' (and if they do, it
> ought to be a conscious decision, which ought to be declared by a
> requiring a "import Prelude hiding (Word)"). While one might think
> 'Word' would be a popular type-name to use in Haskell code, the current
> level of name collision is still rather low (as is shown in the next
> section), so the cost would still be bearable at this point in my
> opinion.
>
>
> Due diligence (w.r.t. code breakage impact)
> -------------------------------------------
>
> Packages depending on `haskell2010` or `haskell98` are not affected, and
> neither would be those depending on `base` with a PVP-suggested upper
> bound.
>
> However, to get a rough idea how widespread the use of 'Word' as a type
> on Hackage currently is, here's a simple check for current uses of
> 'Word' as a type-name performed with the simple heuristic search
>
>   find  -name '*.*hs*' -exec grep \
>      '\(data\|newtype\|type\)[[:space:]]\+Word[ =]' {} +
>
> over the unpacked source trees of the latest versions of the current
> 6766 packages on Hackage resulted in the following 43 packages being
> possibly affected (see specific source-code matches at end of email[1]):
>
>  1   adict-0.4.1
>  2   boxes-0.1.3
>  3   cjk-0.1.0.1
>  4   clash-prelude-0.5.1
>  5   combinat-0.2.5.0
>  6   concraft-pl-0.7.1
>  7   Craft3e-0.1.0.10
>  8   crf-chain1-0.2.2
>  9   crf-chain1-constrained-0.3.0
>  10  crf-chain2-generic-0.3.0
>  11  crf-chain2-tiers-0.2.1
>  12  delta-h-0.0.3
>  13  eros-0.6.0.0
>  14  estimators-0.1.4
>  15  estreps-0.3.1
>  16  FermatsLastMargin-0.1
>  17  fsmActions-0.4.4
>  18  gf-3.6
>  19  happraise-0.1
>  20  HAppS-Data-0.9.3
>  21  happstack-contrib-0.2.1
>  22  hist-pl-fusion-0.5.3
>  23  Holumbus-Searchengine-1.2.3
>  24  integer-pure-1.0
>  25  ixset-typed-0.3
>  26  language-bash-0.6.0
>  27  language-sh-0.0.3.1
>  28  lhc-0.10
>  29  MemoTrie-0.6.2
>  30  mpppc-0.1.3
>  31  nerf-0.5.2
>  32  regex-deriv-0.0.4
>  33  regex-pderiv-0.1.3
>  34  regexpr-symbolic-0.5
>  35  remote-0.1.1
>  36  soyuz-0.0.0
>  37  text-icu-0.6.3.7
>  38  text-register-machine-0.4.0
>  39  utf8-light-0.4.2
>  40  WordNet-1.1.0
>  41  WordNet-ghc74-0.1.3
>  42  xhaskell-library-0.0.6
>  43  york-lava-0.2
>
>
> Discussion period
> -----------------
>
> 2 weeks
>
>
> Footnotes
> ---------
>
>  [1] More specifically, here's the output of the above mentioned `grep`
> command:
>
> --8<---------------cut here---------------start------------->8---
> adict-0.4.1/src/NLP/Adict/Core.hs:type Word a = V.Vector a
> boxes-0.1.3/Text/PrettyPrint/Boxes.hs:data Word = Word { wLen :: Int,
> getWord  :: String }
> cjk-0.1.0.1/CJK/Data/CEDICT.hs:data Word = Word {
> clash-prelude-0.5.1/src/CLaSH/Tutorial.hs:type Word = Signed 4
> combinat-0.2.5.0/Math/Combinat/FreeGroups.hs:type Word a = [Generator a]
> concraft-pl-0.7.1/src/NLP/Concraft/Polish/Morphosyntax.hs:data Word = Word
> Craft3e-0.1.0.10/Chapter7.hs:type Word = String
> Craft3e-0.1.0.10/Index.hs:type Word = String
> crf-chain1-0.2.2/Data/CRF/Chain1/Dataset/External.hs:type Word a = S.Set a
> crf-chain1-constrained-0.3.0/src/Data/CRF/Chain1/Constrained/Dataset/External.hs:data
> Word a b = Word
> crf-chain2-generic-0.3.0/Data/CRF/Chain2/Generic/External.hs:data Word a b
> = Word {
> crf-chain2-tiers-0.2.1/src/Data/CRF/Chain2/Tiers/Dataset/External.hs:data
> Word a b = Word {
> delta-h-0.0.3/src/EvalSem.hs:type Word = String
> eros-0.6.0.0/src/Text/Eros/Message.hs:type Word         = L.Text
> estimators-0.1.4/NLP/Probability/Example/Trigram.hs:newtype Word = Word
> T.Text
> estreps-0.3.1/src/Repeats.lhs:-- type Word = Int
> FermatsLastMargin-0.1/FLM/WikiPages.hs:       newtype Word     = Word
> String
> fsmActions-0.4.4/Data/FsmActions.hs:newtype Word sy = Word [sy]
> gf-3.6/lib/src/finnish/wordnet/FreqFin.hs:type Word = String
> gf-3.6/treebanks/susanne/SusanneFormat.hs:type Word  = String
> gf-3.6/treebanks/talbanken/Format.hs:data Word     = W  {id :: Id, word ::
> String, pos :: Tag}
> happraise-0.1/Main.hs:type Word = String
> HAppS-Data-0.9.3/src/HAppS/Data/Atom.hs:    newtype Word = Word String
> happstack-contrib-0.2.1/src/Happstack/Contrib/Atom.hs:    newtype Word =
> Word String
> hist-pl-fusion-0.5.3/src/NLP/HistPL/Fusion.hs:type Word = T.Text
> Holumbus-Searchengine-1.2.3/src/Holumbus/Index/Common/BasicTypes.hs:type
> Word                       = String
> integer-pure-1.0/Data/Integer.hs:type Word    = Int    -- We fake the Word
> type, to avoid nasty conversions.
> ixset-typed-0.3/src/Data/IxSet/Typed.hs:    > newtype Word = Word String
> language-bash-0.6.0/src/Language/Bash/Word.hs:type Word = [Span]
> language-sh-0.0.3.1/Language/Sh/Syntax.hs:type Word = [Lexeme]
> lhc-0.10/lib/base/src/Data/Word.hs:type Word = Word32
> lhc-0.10/lib/base/src/GHC/Word.hs:data Word = W# Word# deriving (Eq, Ord)
> MemoTrie-0.6.2/src/Data/MemoTrie.hs:--     newtype Word :->: a = WordTrie
> ([Bool] :->: a)
> mpppc-0.1.3/src/Text/PrettyPrint/MPPPC/TwoDim/Combinators/Flow.hs:data
> Word s t = Printable s t =>
> nerf-0.5.2/src/NLP/Nerf/Types.hs:type Word = T.Text
> regex-deriv-0.0.4/Text/Regex/Deriv/ByteString/BitCode.hs:type Word =
> S.ByteString
> regex-deriv-0.0.4/Text/Regex/Deriv/ByteString/Posix.lhs:> type Word =
> S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/ByteString/LeftToRight.lhs:> type
> Word = S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/ByteString/LeftToRightD.lhs:> type
> Word = S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/ByteString/Posix.lhs:> type Word =
> S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/ByteString/RightToLeft.lhs:> type
> Word = S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/ByteString/TwoPasses.lhs:> type Word
> = S.ByteString
> regex-pderiv-0.1.3/Text/Regex/PDeriv/String/LeftToRightD.lhs:> type Word =
> String
> regexpr-symbolic-0.5/RegExpr/RegExprOperations.lhs:> type Word a = [a]
> remote-0.1.1/examples/tests/Test-MapReduce.hs:type Word = String
> remote-0.1.1/examples/kmeans/KMeans3.hs:type Word = String
> soyuz-0.0.0/DCPU16/Instructions.hs:data Word
> text-icu-0.6.3.7/Data/Text/ICU/Break.hsc:data Word = Uncategorized
> -- ^ A \"word\" that does not fit into another
> text-register-machine-0.4.0/Language/TRM/Base.hs:newtype Word = W [Letter]
> deriving (Eq, Monoid)
> utf8-light-0.4.2/src/Codec/Binary/UTF8/Light.hs:data Word = W# Word#
> WordNet-1.1.0/NLP/WordNet/Types.hs:type Word = String
> WordNet-ghc74-0.1.3/NLP/WordNet/Types.hs:type Word = String
> xhaskell-library-0.0.6/Text/Regex/PDeriv/ByteString/LeftToRight.lhs:> type
> Word = S.ByteString
> xhaskell-library-0.0.6/Text/Regex/PDeriv/ByteString/Posix.lhs:> type Word
> = S.ByteString
> xhaskell-library-0.0.6/Text/Regex/PDeriv/ByteString/RightToLeft.lhs:> type
> Word = S.ByteString
> xhaskell-library-0.0.6/Text/Regex/PDeriv/ByteString/TwoPasses.lhs:> type
> Word = S.ByteString
> york-lava-0.2/modules/Lava/Prelude.hs:type Word n = Vec n Bit
> --8<---------------cut here---------------end--------------->8---
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140809/dd5115c4/attachment.html>


More information about the Libraries mailing list