summaryrefslogtreecommitdiff
path: root/compiler/deSugar/DsListComp.lhs
Commit message (Collapse)AuthorAgeFilesLines
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-1/+1
| | | | | | | | | | | | | | | | | | 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.
* Fix spellingGabor Greif2013-02-061-1/+1
|
* Define ListSetOps.getNth, and use itSimon Peyton Jones2013-01-021-2/+3
| | | | | | | | I was tracking down an error looking like Prelude.(!!): index too large which is very unhelpful. This patch replaces at least some uses of (!!) in GHC with getNth, which has a more helpful error message (with DEBUG anyway)
* Some alpha renamingIan Lynagh2012-10-161-1/+1
| | | | | Mostly d -> g (matching DynFlag -> GeneralFlag). Also renamed if* to when*, matching the Haskell if/when names
* This big patch re-factors the way in which arrow-syntax is handledSimon Peyton Jones2012-10-031-20/+20
| | | | | | | | | | | | | | | | | | | | | | All the work was done by Dan Winograd-Cort. The main thing is that arrow comamnds now have their own data type HsCmd (defined in HsExpr). Previously it was punned with the HsExpr type, which was jolly confusing, and made it hard to do anything arrow-specific. To make this work, we now parameterise * MatchGroup * Match * GRHSs, GRHS * StmtLR and friends over the "body", that is the kind of thing they enclose. This "body" parameter can be instantiated to either LHsExpr or LHsCmd respectively. Everything else is really a knock-on effect; there should be no change (yet!) in behaviour. But it should be a sounder basis for fixing bugs.
* Pass DynFlags down to showSDocIan Lynagh2012-06-121-4/+6
|
* Change how macros like ASSERT are definedIan Lynagh2012-06-051-0/+1
| | | | | By using Haskell's debugIsOn rather than CPP's "#ifdef DEBUG", we don't need to kludge things to keep the warning checker happy etc.
* Tidy up a remaining glitch in unificationSimon Peyton Jones2012-05-011-21/+18
| | | | | | | | | | | | | | | | | | There was one place, in type checking parallel list comprehensions where we were unifying types, but had no convenient way to use the resulting coercion; instead we just checked that it was Refl. This was Wrong Wrong; it might fail unpredicably in a GADT-like situation, and it led to extra error-generation code used only in this one place. This patch tidies it all up, by moving the 'return' method from the *comprehension* to the ParStmtBlock. The latter is a new data type, now used for each sub-chunk of a parallel list comprehension. Because of the data type change, quite a few modules are touched, but only in a fairly trivial way. The real changes are in TcMatches (and corresponding desugaring); plus deleting code from TcUnify. This patch also fixes the pretty-printing bug in Trac #6060
* Remove getDOptsDs; use getDynFlags insteadIan Lynagh2012-01-191-1/+1
|
* Allow full constraint solving under a for-all (Trac #5595)Simon Peyton Jones2011-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main idea is that when we unify forall a. t1 ~ forall a. t2 we get constraints from unifying t1~t2 that mention a. We are producing a coercion witnessing the equivalence of the for-alls, and inside *that* coercion we need bindings for the solved constraints arising from t1~t2. We didn't have way to do this before. The big change is that here's a new type TcEvidence.TcCoercion, which is much like Coercion.Coercion except that there's a slot for TcEvBinds in it. This has a wave of follow-on changes. Not deep but broad. * New module TcEvidence, which now contains the HsWrapper TcEvBinds, EvTerm etc types that used to be in HsBinds * The typechecker works exclusively in terms of TcCoercion. * The desugarer converts TcCoercion to Coercion * The main payload is in TcUnify.unifySigmaTy. This is the function that had a gross hack before, but is now beautiful. * LCoercion is gone! Hooray. Many many fiddly changes in conssequence. But it's nice.
* GHC is now independent of the DPH library structureManuel M T Chakravarty2011-11-101-8/+8
| | | | | | | | | | | * if -XParallelArrays is given, the symbols for the desugarer are taken from 'Data.Array.Parallel' (from whichever package is exposed and has the module — the home package is fine, too) * if -fvectorise is given, the symbols for the vectoriser are taken from 'Data.Array.Parallel.Prim' (as above) (There is one wired in symbol left, namely the data constructor 'base:GHC.PArr.[::]. It'll die another day.)
* Fix warnings in deSugar/DsListComp.lhsIan Lynagh2011-11-061-7/+10
|
* Whitespace in deSugar/DsListComp.lhsIan Lynagh2011-11-061-164/+157
|
* 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.
* Final batch of monad-comprehension stuffSimon Peyton Jones2011-05-041-6/+6
| | | | | | | | * Do-notation in arrows is marked with HsStmtContext = ArrowExpr * tcMDoStmt (which was only used for arrows) is moved to TcArrows, and renamed tcArrDoStmt * Improved documentation in the user manual * Lots of other minor changes
* More hacking on monad-compmonad-compSimon Peyton Jones2011-05-031-126/+73
| | | | | | Lots of refactoring. In particular I have now combined TansformStmt and GroupStmt into a single constructor TransStmt. This gives lots of useful code sharing.
* More hacking on monad-comp; now worksSimon Peyton Jones2011-05-021-175/+71
|
* Simon's hacking on monad-comp; incompleteSimon Peyton Jones2011-04-291-182/+190
|
* Preliminary monad-comprehension patch (Trac #4370)Simon Peyton Jones2011-04-281-13/+353
| | | | | | | | This is the work of Nils Schweinsberg <mail@n-sch.de> It adds the language extension -XMonadComprehensions, which generalises list comprehension syntax [ e | x <- xs] to work over arbitrary monads.
* Added a VECTORISE pragmaManuel M T Chakravarty2011-02-201-8/+8
| | | | | | | | | | | | | | | - Added a pragma {-# VECTORISE var = exp #-} that prevents the vectoriser from vectorising the definition of 'var'. Instead it uses the binding '$v_var = exp' to vectorise 'var'. The vectoriser checks that the Core type of 'exp' matches the vectorised Core type of 'var'. (It would be quite complicated to perform that check in the type checker as the vectorisation of a type needs the state of the VM monad.) - Added parts of a related VECTORISE SCALAR pragma - Documented -ddump-vect - Added -ddump-vt-trace - Some clean up
* Fix Trac #4534: renamer bugsimonpj@microsoft.com2010-12-101-9/+8
| | | | | | | | The renamer wasn't attaching the right used-variables to a TransformStmt constructor. The real modification is in RnExpr; the rest is just pretty-printing and white space.
* Move error-ids to MkCore (from PrelRules)simonpj@microsoft.com2010-09-141-1/+0
| | | | and adjust imports accordingly
* Refactor part of the renamer to fix Trac #3901simonpj@microsoft.com2010-03-041-25/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | This one was bigger than I anticipated! The problem was that were were gathering the binders from a pattern before renaming -- but with record wild-cards we don't know what variables are bound by C {..} until after the renamer has filled in the "..". So this patch does the following * Change all the collect-X-Binders functions in HsUtils so that they expect to only be called *after* renaming. That means they don't need to return [Located id] but just [id]. Which turned out to be a very worthwhile simplification all by itself. * Refactor the renamer, and in ptic RnExpr.rnStmt, so that it doesn't need to use collectLStmtsBinders on pre-renamed Stmts. * This in turn required me to understand how GroupStmt and TransformStmts were renamed. Quite fiddly. I rewrote most of it; result is much shorter. * In doing so I flattened HsExpr.GroupByClause into its parent GroupStmt, with trivial knock-on effects in other files. Blargh.
* Add tuple sections as a new featuresimonpj@microsoft.com2009-07-231-2/+2
| | | | | | | | | | | | | | | | This patch adds tuple sections, so that (x,,z) means \y -> (x,y,z) Thanks for Max Bolinbroke for doing the hard work. In the end, instead of using two constructors in HsSyn, I used just one (still called ExplicitTuple) whose arguments can be Present (LHsExpr id) or Missing PostTcType While I was at it, I did a bit of refactoring too.
* mkErrorAppDs now takes an SDoc rather than a StringIan Lynagh2009-03-311-2/+3
| | | | | This avoids some showSDoc's where the String then gets converted back into an SDoc.
* Special-case desugaring of simple parallel array comprehensionsRoman Leshchinskiy2009-03-071-1/+23
|
* Fix flaggery for RULES (cf Trac #2497)simonpj@microsoft.com2008-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | This patch executes the plan described in the discussion in Trac #2497. Specficially: * Inside a RULE, switch on the forall-as-keyword in the lexer, unconditionally. (Actually this is done by an earlier patch.) * Merge the -XScopedTypeVariables and -XPatternSignatures flags, and deprecate the latter. Distinguishing them isn't senseless, but it's jolly confusing. * Inside a RULE, switch on -XScopedTypeVariables unconditionally. * Change -frewrite-rules to -fenable-rewrite-rules; deprecate the former. Internally the DynFlag is now Opt_EnableRewriteRules. There's a test in typecheck/should_compile/T2497.hs
* Handle introduction of MkCore in DsListCompMax Bolingbroke2008-07-311-1/+2
|
* Split the Id related functions out from Var into Id, document Var and some of IdMax Bolingbroke2008-07-311-1/+1
|
* Don't import FastString in HsVersions.hIan Lynagh2008-03-291-2/+0
| | | | Modules that need it import it themselves instead.
* Make explicit lists more fusableMax Bolingbroke2008-02-281-24/+6
|
* Fixed warnings in deSugar/DsListComp, except for incomplete pattern matchesTwan van Laarhoven2008-02-031-3/+10
|
* Monadify deSugar/DsListComp: use do, return, applicative, standard monad ↵Twan van Laarhoven2008-01-171-115/+98
| | | | functions
* Implement generalised list comprehensionssimonpj@microsoft.com2007-12-201-148/+299
| | | | | | | | | | | | | | | | | | | | This patch implements generalised list comprehensions, as described in the paper "Comprehensive comprehensions" (Peyton Jones & Wadler, Haskell Workshop 2007). If you don't use the new comprehensions, nothing should change. The syntax is not exactly as in the paper; see the user manual entry for details. You need an accompanying patch to the base library for this stuff to work. The patch is the work of Max Bolingbroke [batterseapower@hotmail.com], with some advice from Simon PJ. The related GHC Wiki page is http://hackage.haskell.org/trac/ghc/wiki/SQLLikeComprehensions
* Optimise desugaring of parallel array comprehensionsRoman Leshchinskiy2007-12-051-4/+12
|
* 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
|
* Warning fix for unused and redundant importsMichael D. Adams2007-05-101-1/+0
|
* Make -frewrite-rules into a dynamic flag; off for -O0simonpj@microsoft.com2007-05-041-1/+1
| | | | | | | | | | | | | | Argubly rewrite rules should not fire with -O0, and it turns out that when compiling GHC.Base with -O0 we get a crash if the rewrite rules do fire (see Note [Scoping for Builtin rules] in PrelRules). So unless someone yells, rewrite rules are off with -O0. The new (now dynamic) flag is -frewrite rules (with -fno-rewrite-rules to disable) The old (static) flag -frules-off is gone.
* Fixed desugaring of parallel array comprehensionsManuel M T Chakravarty2007-04-021-36/+55
| | | | ** MERGE into 6.6.1 **
* Module header tidyup, phase 1Simon Marlow2006-10-111-19/+17
| | | | | | | | | | | | This patch is a start on removing import lists and generally tidying up the top of each module. In addition to removing import lists: - Change DATA.IOREF -> Data.IORef etc. - Change List -> Data.List etc. - Remove $Id$ - Update copyrights - Re-order imports to put non-GHC imports last - Remove some unused and duplicate imports
* Massive patch for the first months work adding System FC to GHC #12Manuel M T Chakravarty2006-08-041-3/+3
| | | | | | | | Broken up massive patch -=chak Original log message: This is (sadly) all done in one patch to avoid Darcs bugs. It's not complete work... more FC stuff to come. A compiler using just this patch will fail dismally.
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+516
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.