summaryrefslogtreecommitdiff
path: root/compiler/utils/UniqFM.lhs
Commit message (Collapse)AuthorAgeFilesLines
* compiler: de-lhs utils/Austin Seipp2014-12-031-314/+0
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Remove redundant contexts from Foldable methodsDavid Feuer2014-11-051-17/+3
| | | | | | | | | | | New `Foldable` methods accidentally had `Foldable` contexts, which led to type roles being assigned incorrectly and preventing GND from deriving `Foldable` instances. Removing those fixes #9761. Moreover, this patch takes advantage of this fix by deriving `Foldable` (and `Eq`) for `UniqFM`. Differential Revision: https://phabricator.haskell.org/D425
* Use Data.Map.mergeWithKeyJoachim Breitner2014-10-081-7/+0
| | | | | | | | | | Summary: now that we can rely on having containers > 0.5. Reviewers: austin Subscribers: thomie, carter, ezyang, simonmar Differential Revision: https://phabricator.haskell.org/D321
* Export `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from PreludeHerbert Valerio Riedel2014-09-211-1/+6
| | | | | | | | | | | | | | | 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
* Better debug printingSimon Peyton Jones2014-06-121-2/+9
|
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-2/+2
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Major Call Arity reworkJoachim Breitner2014-03-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the call arity analysis in various ways. Most importantly, it enriches the analysis result information so that when looking at a call, we do not have to make a random choice about what side we want to take the information from. Instead we can combine the results in a way that does not lose valuable information. To do so, besides the incoming arities, we store remember "what can be called with what", i.e. an undirected graph between the (interesting) free variables of an expression. Of course it makes combining the results a bit more tricky (especially mutual recursion), but still doable. The actually implemation of the graph structure is abstractly put away in a module of its own (UnVarGraph.hs) The implementation is geared towards efficiently representing the graphs that we need (which can contain large complete and large complete bipartite graphs, which would be huge in other representations). If someone feels like designing data structures: There is surely some speed-up to be obtained by improving that data structure. Additionally, the analysis now takes into account that if a RHS stays a thunk, then its calls happen only once, even if the variables the RHS is bound to is evaluated multiple times, or is part of a recursive group.
* Implement pattern synonymsDr. ERDI Gergo2014-01-201-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements Pattern Synonyms (enabled by -XPatternSynonyms), allowing y ou to assign names to a pattern and abstract over it. The rundown is this: * Named patterns are introduced by the new 'pattern' keyword, and can be either *unidirectional* or *bidirectional*. A unidirectional pattern is, in the simplest sense, simply an 'alias' for a pattern, where the LHS may mention variables to occur in the RHS. A bidirectional pattern synonym occurs when a pattern may also be used in expression context. * Unidirectional patterns are declared like thus: pattern P x <- x:_ The synonym 'P' may only occur in a pattern context: foo :: [Int] -> Maybe Int foo (P x) = Just x foo _ = Nothing * Bidirectional patterns are declared like thus: pattern P x y = [x, y] Here, P may not only occur as a pattern, but also as an expression when given values for 'x' and 'y', i.e. bar :: Int -> [Int] bar x = P x 10 * Patterns can't yet have their own type signatures; signatures are inferred. * Pattern synonyms may not be recursive, c.f. type synonyms. * Pattern synonyms are also exported/imported using the 'pattern' keyword in an import/export decl, i.e. module Foo (pattern Bar) where ... Note that pattern synonyms share the namespace of constructors, so this disambiguation is required as a there may also be a 'Bar' type in scope as well as the 'Bar' pattern. * The semantics of a pattern synonym differ slightly from a typical pattern: when using a synonym, the pattern itself is matched, followed by all the arguments. This means that the strictness differs slightly: pattern P x y <- [x, y] f (P True True) = True f _ = False g [True, True] = True g _ = False In the example, while `g (False:undefined)` evaluates to False, `f (False:undefined)` results in undefined as both `x` and `y` arguments are matched to `True`. For more information, see the wiki: https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/Implementation Reviewed-by: Simon Peyton Jones <simonpj@microsoft.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix new Haddock doc parse failures.Austin Seipp2014-01-121-7/+11
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Clarify the default demand on demand environmentsJoachim Breitner2013-12-161-0/+28
| | | | by adding Notes and using easier to understand combinators.
* Implement "roles" into GHC.Richard Eisenberg2013-08-021-1/+1
| | | | | | | | | | | | | | | | Roles are a solution to the GeneralizedNewtypeDeriving type-safety problem. Roles were first described in the "Generative type abstraction" paper, by Stephanie Weirich, Dimitrios Vytiniotis, Simon PJ, and Steve Zdancewic. The implementation is a little different than that paper. For a quick primer, check out Note [Roles] in Coercion. Also see http://ghc.haskell.org/trac/ghc/wiki/Roles and http://ghc.haskell.org/trac/ghc/wiki/RolesImplementation For a more formal treatment, check out docs/core-spec/core-spec.pdf. This fixes Trac #1496, #4846, #7148.
* Fix typosIan Lynagh2012-11-011-1/+1
|
* Big changes on tc-untouchables branchSimon Peyton Jones2012-08-281-1/+4
| | | | (Before merging to HEAD we need to tidy up and write a proper commit message.)
* Whitespace only in UniqFMIan Lynagh2012-08-051-95/+88
|
* Change -X flags into LANGUAGE pragmasIan Lynagh2012-02-261-1/+3
|
* This patch includes:Dimitrios Vytiniotis2011-11-281-2/+11
| | | | | | | | | | | | | 0) Typo in panic message. 1) prioritization of equalities over family equalities in the worklists. 2) rewriting of inert substitutions and solveds on-the-spot instead of kicking them out in the inerts. This required a monadic map over substitutions hence the modifications in UniqFM. 3) Just comments and removing stale commented code. 4) Useful SCC for simplifyInfer. 5) Making CoreStats outputable.
* Use -fwarn-tabs when validatingIan Lynagh2011-11-041-0/+7
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* Add "alter" functions to UniqFM, VarEnv, NameEnvSimon Peyton Jones2011-07-281-2/+9
| | | | I need these for a trie data structure I'm working on
* derive Typeable (eliminate deprecation warnings for mkTyCon)Simon Marlow2011-07-121-0/+3
|
* New functionality required for the supercompiler pluginMax Bolingbroke2011-06-291-1/+9
|
* Add adjustUFM, adjustUFM_Directly and joinUFM to UniqFM.Edward Z. Yang2011-04-131-1/+22
| | | | | | | Renamed adjustUFM in GraphOps to adjustUFM_C, to account for alternate argument order. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Implement mapUFM_Directly.Edward Z. Yang2011-04-111-1/+3
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Remove code that is dead now that we need >= 6.12 to buildIan Lynagh2010-12-151-13/+0
|
* Fix build with GHC 6.10Ian Lynagh2010-05-041-0/+13
| | | | | In GHC 6.10, intersectionWith is (a -> b -> a) instead of (a -> b -> c), so we need to jump through some hoops to get the more general type.
* Replace FiniteMap and UniqFM with counterparts from containers.Milan Straka2010-05-031-749/+78
| | | | | | | | | | | | | | | The original interfaces are kept. There is small performance improvement: - when compiling for five nofib, we get following speedups: Average ----- -2.5% Average ----- -0.6% Average ----- -0.5% Average ----- -5.5% Average ----- -10.3% - when compiling HPC ten times, we get: switches oldmaps newmaps -O -fasm 117.402s 116.081s (98.87%) -O -fasm -fregs-graph 119.993s 118.735s (98.95%) -O -fasm -fregs-iterative 120.191s 118.607s (98.68%)
* Add splitUFM to UniqFM (used in a forthcoming patch)simonpj@microsoft.com2009-12-041-3/+23
| | | | | splitUFM :: Uniquable key => UniqFM elt -> key -> (UniqFM elt, Maybe elt, UniqFM elt) -- Splits a UFM into things less than, equal to, and greater than the key
* Require a bang pattern when unlifted types are where/let bound; #3182Ian Lynagh2009-04-241-2/+2
| | | | | For now we only get a warning, rather than an error, because the alex and happy templates don't follow the new rules yet.
* add assertion to check that UniqFM is only passed "positive" uniquesdias@eecs.harvard.edu2008-09-041-1/+21
| | | | | | | | | | | The insertion code in UniqFM fails if a unique key produces a negative FastInt. I've added an assertion to check that each insertion uses a positive Unique. Where do the negative uniques come from? Both Simom M and I have run into this problem when computing hashes for data structures. In both cases, we have avoided the problem by ensuring that the hashes remain positive.
* Document UniqFM and add listToUFM_CMax Bolingbroke2008-07-311-2/+11
|
* Don't import FastString in HsVersions.hIan Lynagh2008-03-291-4/+0
| | | | Modules that need it import it themselves instead.
* Make UniqFM non-strict again while we work out what we're doing.Ian Lynagh2008-02-251-1/+1
| | | | This "fixes" the very-slow problem we have when compiling dictionaries.
* Make UniqFM strict in its elementsIan Lynagh2008-02-061-2/+2
|
* Strictness tweaksIan Lynagh2008-02-031-3/+3
|
* WhitespaceIan Lynagh2008-02-031-4/+4
|
* Tweak strictnessIan Lynagh2008-02-021-1/+1
|
* lots of portability changes (#1405)Isaac Dupree2008-01-171-42/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | re-recording to avoid new conflicts was too hard, so I just put it all in one big patch :-( (besides, some of the changes depended on each other.) Here are what the component patches were: Fri Dec 28 11:02:55 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org> * document BreakArray better Fri Dec 28 11:39:22 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org> * properly ifdef BreakArray for GHCI Fri Jan 4 13:50:41 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * change ifs on __GLASGOW_HASKELL__ to account for... (#1405) for it not being defined. I assume it being undefined implies a compiler with relatively modern libraries but without most unportable glasgow extensions. Fri Jan 4 14:21:21 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * MyEither-->EitherString to allow Haskell98 instance Fri Jan 4 16:13:29 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * re-portabilize Pretty, and corresponding changes Fri Jan 4 17:19:55 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * Augment FastTypes to be much more complete Fri Jan 4 20:14:19 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * use FastFunctions, cleanup FastString slightly Fri Jan 4 21:00:22 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * Massive de-"#", mostly Int# --> FastInt (#1405) Fri Jan 4 21:02:49 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * miscellaneous unnecessary-extension-removal Sat Jan 5 19:30:13 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org> * add FastFunctions
* added foldUFM_Directly, used where appropriate, killed all warningsNorman Ramsey2007-09-151-45/+53
|
* Refactor MachRegs.trivColorable to do unboxed accumulationBen.Lippmeier@anu.edu.au2007-09-051-1/+2
| | | | | | | | | trivColorable was soaking up total 31% time, 41% alloc when compiling SHA1.lhs with -O2 -fregs-graph on x86. Refactoring to use unboxed accumulators and walk directly over the UniqFM holding the set of conflicts reduces this to 17% time, 6% alloc.
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-041-1/+1
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-031-2/+2
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-011-0/+7
|
* Remove code that is dead, as we require __GLASGOW_HASKELL__ >= 504Ian Lynagh2007-04-061-11/+1
|
* Module header tidyup #2Simon Marlow2006-10-111-3/+5
| | | | Push this further along, and fix build problems in the first patch.
* Add intersectsUFMsimonpj@microsoft.com2006-10-051-1/+5
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+847
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.