summaryrefslogtreecommitdiff
path: root/libraries/base/Control/Monad/Fix.hs
Commit message (Collapse)AuthorAgeFilesLines
* Data.Ord: give a field name getDown to DownFumiaki Kinoshita2019-06-181-1/+0
|
* Doc-only fixesAlec Theriault2018-11-221-4/+4
| | | | | | * laws are capitalized definition lists, no emphasis on the labels * adds missing hyperlinks * fixes other misc. Haddock markup issues.
* Fix ambiguous/out-of-scope Haddock identifiersAlec Theriault2018-08-211-1/+1
| | | | | | | | | | | | | | | | | This drastically cuts down on the number of Haddock warnings when making docs for `base`. Plus this means more actual links end up in the docs! Also fixed other small mostly markup issues in the documentation along the way. This is a docs-only change. Reviewers: hvr, bgamari, thomie Reviewed By: thomie Subscribers: thomie, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5055
* Harden fixSTDavid Feuer2018-07-211-1/+1
| | | | | | | | | | | | | | | | Trac #15349 reveals that lazy blackholing can cause trouble for `fixST` much like it can for `fixIO`. Make `fixST` work just like `fixIO`. Reviewers: simonmar, hvr, bgamari Reviewed By: simonmar Subscribers: rwbarton, thomie, carter GHC Trac Issues: #15349 Differential Revision: https://phabricator.haskell.org/D4948
* base: Add missing instances for Data.Ord.DownBen Gamari2018-06-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: * MonadFix * MonadZip * Data * Foldable * Traversable * Eq1 * Ord1 * Read1 * Show1 * Generic * Generic1 Fixes #15098. Reviewers: RyanGlScott, hvr Reviewed By: RyanGlScott Subscribers: sjakobi, rwbarton, thomie, ekmett, carter GHC Trac Issues: #15098 Differential Revision: https://phabricator.haskell.org/D4870
* base: Introduce Data.Monoid.Apchessai2018-05-271-1/+5
| | | | | This data type witnesses the lifting of a monoid into an applicative pointwise.
* Move NonEmpty definition into GHC.BaseHerbert Valerio Riedel2017-09-041-1/+9
| | | | | | This is a preparatory refactoring for Semigroup=>Monoid as it prevents a messy .hs-boot file which would interact inconveniently with the buildsystem...
* Add @since annotations to base instancesSeraphime Kirkovski2016-06-061-0/+16
| | | | | | | | | | | | | | | | | | 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
* Add more type class instances for GHC.GenericsRyanGlScott2016-02-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GHC.Generics provides several representation data types that have obvious instances of various type classes in base, along with various other types of meta-data (such as associativity and fixity). Specifically, instances have been added for the following type classes (where possible): - Applicative - Data - Functor - Monad - MonadFix - MonadPlus - MonadZip - Foldable - Traversable - Enum - Bounded - Ix - Generic1 Thanks to ocharles for starting this! Test Plan: Validate Reviewers: ekmett, austin, hvr, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D1937 GHC Trac Issues: #9043
* Allow CallStacks to be frozenEric Seidel2015-12-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces "freezing," an operation which prevents further locations from being appended to a CallStack. Library authors may want to prevent CallStacks from exposing implementation details, as a matter of hygiene. For example, in ``` head [] = error "head: empty list" ghci> head [] *** Exception: head: empty list CallStack (from implicit params): error, called at ... ``` including the call-site of `error` in `head` is not strictly necessary as the error message already specifies clearly where the error came from. So we add a function `freezeCallStack` that wraps an existing CallStack, preventing further call-sites from being pushed onto it. In other words, ``` pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack ``` Now we can define `head` to not produce a CallStack at all ``` head [] = let ?callStack = freezeCallStack emptyCallStack in error "head: empty list" ghci> head [] *** Exception: head: empty list CallStack (from implicit params): error, called at ... ``` --- 1. We add the `freezeCallStack` and `emptyCallStack` and update the definition of `CallStack` to support this functionality. 2. We add `errorWithoutStackTrace`, a variant of `error` that does not produce a stack trace, using this feature. I think this is a sensible wrapper function to provide in case users want it. 3. We replace uses of `error` in base with `errorWithoutStackTrace`. The rationale is that base does not export any functions that use CallStacks (except for `error` and `undefined`) so there's no way for the stack traces (from Implicit CallStacks) to include user-defined functions. They'll only contain the call to `error` itself. As base already has a good habit of providing useful error messages that name the triggering function, the stack trace really just adds noise to the error. (I don't have a strong opinion on whether we should include this third commit, but the change was very mechanical so I thought I'd include it anyway in case there's interest) 4. Updates tests in `array` and `stm` submodules Test Plan: ./validate, new test is T11049 Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari Reviewed By: simonpj Subscribers: thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1628 GHC Trac Issues: #11049
* Add more MonadZip instancesOleg Grenrus2015-03-171-1/+5
| | | | | | | | | | | | | | Summary: Add MonadZip Alt and MonadFix Alt instances Reviewers: ekmett, dfeuer, hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D716 GHC Trac Issues: #10107
* Add various instances to newtypes in Data.MonoidOleg Grenrus2015-03-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Summary: Add Functor instances for Dual, Sum and Product Add Foldable instances for Dual, Sum and Product Add Traversable instances for Dual, Sum and Product Add Foldable and Traversable instances for First and Last Add Applicative, Monad instances to Dual, Sum, Product Add MonadFix to Data.Monoid wrappers Derive Data for Identity Add Data instances to Data.Monoid wrappers Add Data (Alt f a) instance Reviewers: ekmett, dfeuer, hvr, austin Reviewed By: dfeuer, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D673 GHC Trac Issues: #10107
* `M-x delete-trailing-whitespace` & `M-x untabify`Herbert Valerio Riedel2014-09-241-1/+1
| | | | ...several modules in `base` recently touched by me
* Move `mapM` and `sequence` to GHC.Base and break import-cyclesHerbert Valerio Riedel2014-09-211-2/+1
| | | | | | | | | | This simplifies the import graph and more importantly removes import cycles that arise due to `Control.Monad` & `Data.List` importing `Data.Traversable` (preparation for #9586) Reviewed By: ekmett, austin Differential Revision: https://phabricator.haskell.org/D234
* Export `Traversable()` and `Foldable()` from PreludeHerbert Valerio Riedel2014-09-151-3/+8
| | | | | | | | | | | | | | | | | | | | | | This exposes *only* the type-classes w/o any of their methods. This is the very first step for implementing BPP (see #9586), which already requires breaking up several import-cycles leading back to `Prelude`. Ideally, importing `Prelude` should be avoided in most `base` modules, as `Prelude` does not define any entities, but rather re-exports existing ones. Test Plan: validate passes Reviewers: ekmett, austin Reviewed By: ekmett, austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D209 GHC Trac Issues: #9586
* Constant-fold `__GLASGOW_HASKELL__` CPP conditionalsHerbert Valerio Riedel2013-09-171-6/+0
| | | | | | | | | | 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>
* Remove Hugs98 specific codeHerbert Valerio Riedel2013-09-171-5/+0
| | | | | | | For rationale. see http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/2349 Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Remove commented types in module export listsIan Lynagh2012-10-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These comments are rather less useful now that haddock can give docs with the same informatino in the module synopsis. Having to maintain them when making changes to the library is a pain, and when people forget about doing so there is nothing that checks that the comments are right, so mistakes tend to linger. Of the comments that my script detected, 78 of 684 were already incorrect in one way or another, e.g. missing context: Text.Show.showsPrec Comment type: Int -> a -> ShowS Actual type: Show a => Int -> a -> ShowS wrong context: Numeric.readInt Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a Actual type: Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a not following a class change (e.g. Num losing its Eq superclass): Text.Read.Lex.readOctP Comment type: Num a => ReadP a Actual type: (Eq a, Num a) => ReadP a not following the Exceptions change: GHC.Conc.childHandler Comment type: Exception -> IO () Actual type: SomeException -> IO () or just always been wrong: GHC.Stable.deRefStablePtr Comment type: StablePtr a -> a Actual type: StablePtr a -> IO a
* Moved the instances from Control.Monad.Instances to GHC.Base and Data.EitherBas van Dijk2012-01-131-6/+0
|
* SafeHaskell: Added SafeHaskell to baseDavid Terei2011-06-181-0/+1
|
* Use explicit language extensions & remove extension fields from base.cabalsimonpj@microsoft.com2011-01-281-0/+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.
* move Monad and MonadFix instances for Either from mtl (proposal #4159)Ross Paterson2010-07-291-0/+7
| | | | | | | | | The Monad and MonadFix instances for Either (formerly in the mtl package) are moved to Control.Monad.Instances and Control.Monad.Fix respectively. The Monad instance is still an orphan, to retain Haskell 98 compatibility, but the MonadFix instance is together with its class. The Error constraint is removed from both instances, and the default definition of fail is used.
* De-orphan the MonadFix ST instance for GHCIan Lynagh2009-11-231-0/+9
|
* Fix more warningsIan Lynagh2008-08-201-0/+1
|
* untabifyDon Stewart2008-03-081-14/+14
|
* Hugs now gets MonadFix(mfix) from its preludeRoss Paterson2007-06-201-0/+5
|
* move fix to Data.FunctionRoss Paterson2006-11-101-5/+1
|
* add Functor and Monad instances for Prelude typesRoss Paterson2006-04-101-0/+4
|
* [project @ 2005-07-10 23:01:24 by ross]ross2005-07-101-1/+1
| | | | | | doc fix from Remi Turk MERGE to STABLE
* [project @ 2004-09-10 22:43:20 by ross]ross2004-09-101-12/+13
| | | | doc tweaks
* [project @ 2004-09-10 20:38:53 by ross]ross2004-09-101-6/+26
| | | | docs
* [project @ 2004-08-09 12:00:34 by simonmar]simonmar2004-08-091-2/+1
| | | | whitespace changes to the header only, for new compatibility with new Haddock
* [project @ 2003-03-08 19:02:39 by panne]panne2003-03-081-1/+1
| | | | | Fixed some broken/redirected/canonicalized links found by a very picky link checker.
* [project @ 2002-10-01 16:29:47 by ross]ross2002-10-011-13/+1
| | | | | | Removed the strict ST instance (already in Control.Monad.ST) and moved the lazy ST instance to Control.Monad.ST.Lazy, so Control.Monad.Fix contains only instances for Prelude types, and is portable.
* [project @ 2002-10-01 15:58:11 by erkok]erkok2002-10-011-7/+26
| | | | | | | | | | | | | Merge Fix.hs with MonadRec.hs, and remove the latter. As agreed, the class is now called "MonadFix", and the library is called "Control.Monad.Fix". Note: The old Control.Monad.Fix used to export the function fix :: (a -> a) -> a I retained that behavior, but I don't think it should export it.
* [project @ 2002-05-09 13:16:29 by simonmar]simonmar2002-05-091-1/+1
| | | | Rename libraries/core to libraries/base in the module headers.
* [project @ 2002-05-09 13:15:07 by simonmar]simonmar2002-05-091-6/+5
| | | | Various tweaks needed to get the source processed cleanly with Haddock.
* [project @ 2002-04-26 13:34:05 by simonmar]simonmar2002-04-261-2/+0
| | | | | Remove \$Id\$ from all files: it isn't particularly useful (see previous discussion on cvs-ghc@haskell.org), and it confuses Haddock.
* [project @ 2002-04-24 16:31:37 by simonmar]simonmar2002-04-241-2/+2
| | | | | Add the single character '|' to the header comment of each module so that Haddock will parse it as the module documentation.
* [project @ 2002-03-22 10:20:24 by simonmar]simonmar2002-03-221-10/+2
| | | | This module now lives above the Prelude in the dependency tree.
* [project @ 2002-03-14 12:09:49 by simonmar]simonmar2002-03-141-2/+7
| | | | | | | | | | | Eliminate some orphan-instance modules to speed up compilation. I decided to just bite the bullet and give Data.Dynamic an .hi-boot file, so I could remove GHC.Dynamic altogether, move its data types into Data.Dynamic and hence prevent Data.Dynamic from being an orphan module. Furthermore, GHC.Dynamic wasn't GHC specific - its only purpose in life was to prevent module loops, so having it at all was artificial.
* [project @ 2001-07-03 11:37:49 by simonmar]simonmar2001-07-031-13/+10
| | | | | | | | | | Latest round of changes, incorporating: - some changes to the portability/stability requested by Malcolm - Control.Monad.Fix is portable, IO/ST instances moved to System.IO, Control.Monad.ST respectively. - GHC.Tup moved to Data.Tuple, the code in here is mostly portable (and the interface better be).
* [project @ 2001-06-28 14:15:04 by simonmar]simonmar2001-06-281-0/+55
First cut of the Haskell Core Libraries ======================================= NOTE: it's not meant to be a working snapshot. The code is just here to look at and so the NHC/Hugs guys can start playing around with it. There is no build system. For GHC, the libraries tree is intended to be grafted onto an existing fptools/ tree, and the Makefile in libraries/core is a quick hack for that setup. This won't work at the moment without the other changes needed in fptools/ghc, which I haven't committed because they'll cause breakage. However, with the changes required these sources build a working Prelude and libraries. The layout mostly follows the one we agreed on, with one or two minor changes; in particular the Data/Array layout probably isn't final (there are several choices here). The document is in libraries/core/doc as promised. The cbits stuff is just a copy of ghc/lib/std/cbits and has GHC-specific stuff in it. We should really separate the compiler-specific C support from any compiler-independent C support there might be. Don't pay too much attention to the portability or stability status indicated in the header of each source file at the moment - I haven't gone through to make sure they're all consistent and make sense. I'm using non-literate source outside of GHC/. Hope that's ok with everyone. We need to discuss how the build system is going to work...