summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Ord.hs
Commit message (Collapse)AuthorAgeFilesLines
* Add `Enum (Down a)` instance that swaps `succ` and `pred`Gergo ERDI2022-10-171-2/+22
| | | | | | | | | | | See https://github.com/haskell/core-libraries-committee/issues/51 for discussion. The key points driving the implementation are the following two ideas: * For the `Int` type, `comparing (complement @Int)` behaves exactly as an order-swapping `compare @Int`. * `enumFrom @(Down a)` can be implemented in terms of `enumFromThen @a`, if only the corner case of starting at the very end is handled specially
* typosEric Lindblad2022-07-181-1/+1
|
* Expand `Ord` instance for `Down`konsumlamm2022-07-031-0/+6
| | | | Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/23#issuecomment-1172932610
* Correct doctestsOleg Grenrus2021-01-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's simpler to assume that base is NoImplicitPrelude, otherwise running doctest on `GHC.*` modules would be tricky. OTOH, most `GHC.List` (where the most name clashes are) examples could be changed to use `import qualified Data.List as L`. (GHC.List examples won't show for Foldable methods...). With these changes majority of doctest examples are GHCi-"faithful", my WIP GHC-independent doctest runner reports nice summary: Examples: 582; Tried: 546; Skipped: 34; Success: 515; Errors: 33; Property Failures 2 Most error cases are *Hangs forever*. I have yet to figure out how to demonstrate that in GHCi. Some of divergences are actually stack overflows, i.e. caught by runtime. Few errorful cases are examples of infinite output, e.g. >>> cycle [42] [42,42,42,42,42,42,42,42,42,42... while correct, they confuse doctest. Another erroneous cases are where expected output has line comment, like >>> fmap show (Just 1) -- (a -> b) -> f a -> f b Just "1" -- (Int -> String) -> Maybe Int -> Maybe String I think I just have to teach doctest to strip comments from expected output. This is a first patch in a series. There is plenty of stuff already.
* Fix `instance Bounded a => Bounded (Down a)` (#18716)David Beacham2020-10-271-6/+29
| | | | | | | * Flip `minBound` and `maxBound` to respect the change in ordering * Remove awkward `Enum` (and hence `Integral`) instances for `Data.Ord.Down` * Update changelog
* Add testsSandy Maguire2020-09-121-0/+4
|
* Add clamp function to Data.OrdSandy Maguire2020-09-121-0/+16
|
* base: Move Ix typeclass to GHC.IxBen Gamari2019-09-251-1/+1
| | | | | The `Ix` class seems rather orthogonal to its original home in `GHC.Arr`.
* Add more newtype-derived instances to Data.Ord.DownFumiaki Kinoshita2019-06-181-4/+22
| | | | | Metric Increase: haddock.base
* Data.Ord: give a field name getDown to DownFumiaki Kinoshita2019-06-181-3/+19
|
* Add @since annotations for derived instances in baseChaitanya Koparkar2018-03-021-5/+5
| | | | | | | | | | | | | | Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11767 Differential Revision: https://phabricator.haskell.org/D4452
* Make Semigroup a superclass of Monoid (re #14191)Herbert Valerio Riedel2017-09-071-0/+1
| | | | | | | | | | | | | | | | | | | Unfortunately, this requires introducing a couple of .hs-boot files to break up import cycles (mostly to provide class & typenames in order to be able to write type signatures). This does not yet re-export `(<>)` from Prelude (while the class-name `Semigroup` is reexported); that will happen in a future commit. Test Plan: local ./validate passed Reviewers: ekmett, austin, bgamari, erikd, RyanGlScott Reviewed By: ekmett, RyanGlScott GHC Trac Issues: #14191 Differential Revision: https://phabricator.haskell.org/D3927
* Add instances for Data.Ord.DownAdam Sandberg Eriksson2017-04-251-3/+23
| | | | | | | | | | | | | | | Namely `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup` and `Monoid` for `Data.Ord.Down` (#13097). Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: bgamari, RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #13097 Differential Revision: https://phabricator.haskell.org/D3500
* Add @since annotations to base instancesSeraphime Kirkovski2016-06-061-0/+1
| | | | | | | | | | | | | | | | | | Add @since annotations to instances in `base`. Test Plan: * ./validate # some commets shouldn't break the build * review the annotations for absurdities. Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari Reviewed By: RyanGlScott, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2277 GHC Trac Issues: #11767
* Convert `/Since: .../` to new `@since ...` syntaxHerbert Valerio Riedel2014-12-161-1/+1
| | | | | | Starting with Haddock 2.16 there's a new built-in support for since-annotations Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
* Tweak Haddock comments in `Data.Ord.Down` added in ebc85262cHerbert Valerio Riedel2014-03-011-1/+2
| | | | Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Add Show and Read instances for Data.Ord.DownKrzysztof Gogolewski2013-10-141-1/+4
| | | | libraries mailing list thread "Proposal: Show and Read for Data.Ord.Down", Sep 2013, http://www.haskell.org/pipermail/libraries/2013-September/020867.html
* Add Haddock `/Since: 4.6.0.0/` comments to symbolsHerbert Valerio Riedel2013-09-211-0/+2
| | | | | | | | | | This commit retroactively adds `/Since: 4.6.0.0/` annotations to symbols newly added/exposed in `base-4.6.0.0` (as shipped with GHC 7.6.1). See also 6368362f which adds the respective annotation for symbols newly added in `base-4.7.0.0` (that goes together with GHC 7.8.1). Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Constant-fold `__GLASGOW_HASKELL__` CPP conditionalsHerbert Valerio Riedel2013-09-171-3/+1
| | | | | | | | | | Now that HUGS and NHC specific code has been removed, this commit "folds" the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This renders `base` officially GHC only. This commit also removes redundant `{-# LANGUAGE CPP #-}`. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Move Down to Data.Ord (#7077)Paolo Capriotti2012-07-171-0/+11
|
* Update base for latest Safe Haskell.David Terei2011-10-251-0/+1
|
* SafeHaskell: Added SafeHaskell to baseDavid Terei2011-06-181-0/+1
|
* Use explicit language extensions & remove extension fields from base.cabalsimonpj@microsoft.com2011-01-281-1/+2
| | | | | | | | | | Add explicit {-# LANGUAGE xxx #-} pragmas to each module, that say what extensions that module uses. This makes it clearer where different extensions are used in the (large, variagated) base package. Now base.cabal doesn't need any extensions field Thanks to Bas van Dijk for doing all the work.
* Avoid using deprecated flagsIan Lynagh2008-06-161-1/+1
|
* [project @ 2005-03-14 16:26:47 by simonmar]simonmar2005-03-141-1/+1
| | | | Fix export of Ordering
* [project @ 2005-03-14 15:52:03 by simonmar]simonmar2005-03-141-0/+7
| | | | doc comparing
* [project @ 2005-03-14 15:46:12 by simonmar]simonmar2005-03-141-0/+27
Add Data.Ord and Data.Eq. Data.Ord also exports the new function 'comparing', as discussed on the libraries list a while back.