1. 02 Dec, 2014 1 commit
    • puffnfresh's avatar
      Make `read . show = id` for Data.Fixed (fix #9240) · 7c38e985
      puffnfresh authored
      The QuickCheck property now succeeds:
      
          prop :: Fixed B7 -> Bool
          prop a = read (show a) == a
      
      This changes the Show instance for Fixed to round up, rather than down
      when calculating a digit. This needs to happen because Read also
      rounds down:
      
          data B7
      
          instance HasResolution B7 where
            resolution _ = 128
      
          1 / 128 = 0.0078125
      
          read "0.007" = (0.000 :: Fixed B7)
      
      Here is an example of the change to Show:
      
          showFixed False (0.009 :: Fixed B7)
      
          -- Broken: "0.007"
          -- Fixed:  "0.008"
      
      And now Read can continue to round down:
      
          read "0.008" = (0.0078125 :: Fixed B7)
      
      Reviewed By: hvr, ekmett
      
      Differential Revision: https://phabricator.haskell.org/D547
      7c38e985
  2. 25 Nov, 2014 1 commit
  3. 24 Nov, 2014 2 commits
  4. 23 Nov, 2014 1 commit
  5. 22 Nov, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Implement `Natural` number type (re #9818) · 8a8cdbbf
      Herbert Valerio Riedel authored
      This implements a `Natural` type for representing unsigned arbitrary
      precision integers.
      
      When available, `integer-gmp>=1.0.0`'s `BigNat` type is used as
      building-block to construct `Natural` as an algebraic data-type.
      Otherwise, `Natural` falls back being a `newtype`-wrapper around
      `Integer` (as is done in Edward Kmett's `nats` package).
      
      The `GHC.Natural` module exposes an internal GHC-specific API, while
      `Numeric.Natural` provides the official & portable API.
      
      Reviewed By: austin, ekmett
      
      Differential Revision: https://phabricator.haskell.org/D473
      8a8cdbbf
  6. 21 Nov, 2014 6 commits
  7. 10 Nov, 2014 1 commit
  8. 07 Nov, 2014 1 commit
  9. 05 Nov, 2014 1 commit
  10. 04 Nov, 2014 1 commit
  11. 31 Oct, 2014 1 commit
  12. 26 Oct, 2014 1 commit
  13. 18 Oct, 2014 2 commits
  14. 01 Oct, 2014 4 commits
  15. 28 Sep, 2014 1 commit
  16. 21 Sep, 2014 2 commits
    • Herbert Valerio Riedel's avatar
      Export `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from Prelude · b8f58392
      Herbert Valerio Riedel authored
      This finally exposes also the methods of these 3 classes in the Prelude
      in order to allow to define basic class instances w/o needing imports.
      
      This almost completes the primary goal of #9586
      
      NOTE: `fold`, `foldl'`, `foldr'`, and `toList` are not exposed yet,
            as they require upstream fixes for at least `containers` and
            `bytestring`, and are not required for defining basic instances.
      
      Reviewed By: ekmett, austin
      
      Differential Revision: https://phabricator.haskell.org/D236
      b8f58392
    • Herbert Valerio Riedel's avatar
      Generalise Data.List/Control.Monad to Foldable/Traversable · 1f7f46f9
      Herbert Valerio Riedel authored
      This flips the switch and replaces the entities in
      `Data.List`/`Control.Monad` conflicting with
      `Data.{Foldable,Traversable}` with re-exports of the more general
      versions.
      
      As of this commit, the code below (which is also added as a test-case)
      compiles w/o error.
      
          module XPrelude (module X) where
      
          import Control.Monad     as X
          import Data.Foldable     as X
          import Data.List         as X
          import Data.Monoid       as X
          import Data.Traversable  as X
          import Prelude           as X
      
      This addresses #9568
      
      Reviewed By: ekmett, austin
      
      Differential Revision: https://phabricator.haskell.org/D235
      1f7f46f9
  17. 20 Sep, 2014 3 commits
  18. 19 Sep, 2014 1 commit
  19. 09 Sep, 2014 1 commit
  20. 04 Sep, 2014 1 commit
  21. 31 Aug, 2014 2 commits
    • Herbert Valerio Riedel's avatar
      Add `FiniteBits(count{Leading,Trailing}Zeros)` · a8a969ae
      Herbert Valerio Riedel authored
      This exposes the newly added CLZ/CTZ primops from
      e0c1767d (re #9340)
      via two new methods `countLeadingZeros` and `countTrailingZeros`
      in the `Data.Bits.FiniteBits` class.
      
      The original proposal can be found at
      
        http://www.haskell.org/pipermail/libraries/2014-August/023567.html
      
      Test Plan: successful validate
      
      Reviewers: ekmett, tibbe
      
      GHC Trac Issues: #9532
      
      Differential Revision: https://phabricator.haskell.org/D158
      a8a969ae
    • Herbert Valerio Riedel's avatar
      Re-export Word from Prelude (re #9531) · 393b8202
      Herbert Valerio Riedel authored
      The original proposal text can be found at
      
        http://www.haskell.org/pipermail/libraries/2014-August/023491.html
      
      The proposal passed with a clear majority, and was additionally
      confirmed by the core libraries committee.
      
      *Compatibility Note*
      
      Only code that imports `Data.Word` for the sole purpose of using `Word`
      *and* requires to be `-Werror`-clean (due to `-fwarn-unused-imports`)
      is affected by this change.
      
      In order to write warning-free forward/backward compatible against `base`,
      a variant of the following CPP-based snippet can be used:
      
        -- Starting with base>4.7.0 or GHC>7.8 Prelude re-exports 'Word'
        -- The following is needed, if 'Word' is the *only* entity needed from Data.Word
        #ifdef MIN_VERSION_base
        # if !MIN_VERSION_base(4,7,1)
        import Data.Word (Word)
        # endif
        -- no cabal_macros.h -- fallback to __GLASGOW_HASKELL__
        #elif __GLASGOW_HASKELL__ < 709
        import Data.Word (Word)
        #endif
      
      This also updates the haddock submodule in order to avoid a compile warning
      393b8202
  22. 19 Aug, 2014 2 commits
    • bernalex's avatar
      Make Prelude.signum handle -0.0 correctly (#7858) · d9a20573
      bernalex authored
      Summary:
      Make the `Float` and `Double` implementations of `signum` handle -0.0
      correctly per IEEE-754.
      
      This, together with "Make Prelude.abs handle -0.0 correctly (#7858)",
      fixes Trac #7858.
      
      Depends on D145
      Signed-off-by: bernalex's avatarAlexander Berntsen <alexander@plaimi.net>
      
      Test Plan:
      signum of (-0.0) should be (-0.0) not 0.0.
      
      Test program:
      
        main =
          putStrLn $ p ++ " " ++ n
          where
            f = show . signum
            p = f (-0.0 :: Double)
          n = f (0.0 :: Double)
      
      Reviewers: ekmett, hvr, rwbarton, austin
      
      Reviewed By: austin
      
      Subscribers: phaskell, simonmar, relrod, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D148
      
      GHC Trac Issues: #7858
      d9a20573
    • bernalex's avatar
      Make Prelude.abs handle -0.0 correctly (#7858) · 6f6ee6ea
      bernalex authored
      Summary:
      Make the `Float` and `Double` implementations of `abs` handle -0.0
      correctly per IEEE-754.
      
      abs (-0.0::Float) and abs (-0.0::Double) previously returned -0.0, when
      they should return 0.0. This patch fixes this.
      Signed-off-by: bernalex's avatarAlexander Berntsen <alexander@plaimi.net>
      
      Test Plan: abs (-0.0::Double) should = 0.0 instead of (-0.0)
      
      Reviewers: ekmett, hvr, austin, rwbarton
      
      Reviewed By: austin, rwbarton
      
      Subscribers: phaskell, trofi, simonmar, relrod, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D145
      
      GHC Trac Issues: #7858
      6f6ee6ea
  23. 20 Jul, 2014 1 commit
  24. 11 Jul, 2014 1 commit
  25. 14 May, 2014 1 commit