1. 22 Nov, 2002 2 commits
  2. 21 Nov, 2002 14 commits
    • simonpj's avatar
      [project @ 2002-11-21 17:54:54 by simonpj] · 5e34dfe2
      simonpj authored
    • simonpj's avatar
      [project @ 2002-11-21 17:54:17 by simonpj] · 0df43546
      simonpj authored
      Another wibble
    • simonpj's avatar
      [project @ 2002-11-21 17:43:43 by simonpj] · d8a22a2b
      simonpj authored
    • simonpj's avatar
      [project @ 2002-11-21 15:51:43 by simonpj] · 11047b5e
      simonpj authored
      	Pass the current-module type envt
      to HscMain.compileExpr, and thence to the desugarer
      For Template Haskell it's important to have the type envt of
      the current module available to hand the desugarer.
      Should fix TH_spliceDecl3
    • simonpj's avatar
      [project @ 2002-11-21 14:59:51 by simonpj] · c9c01697
      simonpj authored
      	Better notion of what a 'value' is
      	Slightly better eta reduction
      1.  At various places we watch out for "values"; the predicate exprIsValue
      detects them. It was stupidly treating nullary constructors as non-values
      which is exceptionally stupid.  This (performance) bug has been there
      for ages.
      There's an exactly similar bug in SimplUtils.interestingArg, which looks
      for an interesting argument to trigger an inlining.
      2.  The eta reduction in SimplUtils.tryEtaReduce would only eta reduce if
      that left us with a variable.  That led to slightly tiresome thing like
      	:DMonad (/\a b -> foo @ s @ a @ b) ...
      where this would be neater
      	:DMonad (foo @ s)
      The fix is easy, and there's a little less code too.
    • simonpj's avatar
      [project @ 2002-11-21 11:32:45 by simonpj] · 99cccd62
      simonpj authored
      Add rawSystem back in for benefit of pre-504 compilers on Win32
    • simonpj's avatar
      [project @ 2002-11-21 11:31:51 by simonpj] · b2d633b6
      simonpj authored
      import trimming
    • simonpj's avatar
      [project @ 2002-11-21 11:31:34 by simonpj] · a06f5e7b
      simonpj authored
      	Compile instance declarations better
      This commit makes the type checker build better dictionaries
      from instance declarations.  "Better" in the sense that if a
      binding in the instance declaration mentions one of the other
      methods of the same class, we use that method directly rather
      than going via a (recursive) use of the dictionary.
      This makes it easier to unravel recursive knots, and that
      makes more inlining happen.  There's a long comment in
      Makes the Monad instance for ST much more inlinable, and that
      makes spectral/fibheaps go faster, among other things.
    • simonmar's avatar
      [project @ 2002-11-21 11:27:05 by simonmar] · 49c120b9
      simonmar authored
      these files should be on eval-apply-branch
    • simonmar's avatar
      [project @ 2002-11-21 10:04:20 by simonmar] · 98eae016
      simonmar authored
      Repair the HEAD after some file adds/removes that were supposed to
      happen on the eval-apply-branch yesterday mysteriously happened on the
      HEAD instead.
    • simonpj's avatar
      [project @ 2002-11-21 09:37:24 by simonpj] · 5f7e4514
      simonpj authored
      More wibbles to improve declaration splicing
    • simonpj's avatar
      [project @ 2002-11-21 09:36:48 by simonpj] · b8598510
      simonpj authored
      Less rn-tracing
    • simonpj's avatar
      [project @ 2002-11-21 09:36:03 by simonpj] · f0f69132
      simonpj authored
      	Fix and tidy the desugaring of
      	pattern-matching in do-notation
      In the reorgansiation of HsPat, failureFreePat had become incorrect (due to
      a catch-all case that caught a constructor that should have been matched).  So
      pattern-match failure in do-notation wasn't handled right.
      As it turned out, DsExpr.dsDo could be made much simpler and more elegant
      by using matchSimply instead of matchWrapper, and this had the side benefit
      of removing the last call to HsPat.failureFreePat.  So it's gone!
    • chak's avatar
      [project @ 2002-11-21 03:34:07 by chak] · 063123a0
      chak authored
      Convert : Added newly required import of `HsSyn.TySynonym'
      TcSplice: Adapted `tcRunQ' to new definition of `THSyntax.Q'
  3. 20 Nov, 2002 9 commits
    • chak's avatar
      [project @ 2002-11-20 23:27:37 by chak] · d31b5e62
      chak authored
    • simonpj's avatar
      [project @ 2002-11-20 15:43:37 by simonpj] · f2e26fc5
      simonpj authored
      Three Template Haskell improvements
      a) Add type synonyms to THSyntax (and DsMeta, Convert)
      b) Make Q into a newtype instead of a type synonym
      c) Eliminate tiresome and error prone argument to DsMeta.wrapGenSyms
         and similarly addTyVarBinds
    • simonpj's avatar
      [project @ 2002-11-20 15:40:32 by simonpj] · c0624c76
      simonpj authored
      Wibble to fix :info
    • simonpj's avatar
      [project @ 2002-11-20 15:39:47 by simonpj] · 916abd02
      simonpj authored
      	Improve occurrence analysis a little
      		x1 = a0 : []
      		x2 = a1 : x1
      		x3 = a2 : x2
      		g  = f x3
      First time round, it looks as if x1 and x2 occur as an arg of a
      let(rec)-bound constructor, and hence should not be inlined. (If the
      RHS of a let is just (C a b) where C is a constructor, then we like to
      keep it that way, with atomic a,b, so that it can be inlined easily at
      a 'case'.)
      But in this case, x3 is inlined in g's RHS... and now x2 is not an arg
      of a let-bound constructor, so it can be inlined, and then x1.   Result:
      		g = f (a2 : a1 : a0 : [])
      Which is fine.  What is *not* fine is that it has been costing us a
      whole simplifier iteration for each element!
      This commit adds another little hack to get around the problem: don't treat
      constructor RHSs specially if the bound variable looks as if it occurs just
      once so it'll be inlined.  This catches the common case very nicely.
      It's a pain that we have the atomic-args-for-constructor-RHSs invariant.
      But I can't see  how to do without it.
    • simonmar's avatar
      [project @ 2002-11-20 14:09:42 by simonmar] · 491f66f8
      simonmar authored
      Snapshot of the Eval/Apply changes, c. 15 Nov 2002.  This snapshot
      should be relatively stable, although GHCi and profiling are currently
      known to be broken.
    • simonmar's avatar
      [project @ 2002-11-20 13:34:20 by simonmar] · 0addb8f5
      simonmar authored
      Back out rev. 1.233
    • chak's avatar
      [project @ 2002-11-20 12:34:42 by chak] · cda70f58
      chak authored
      - We are forcing importing THSyntax.Q at every top splice now; this suffices
        to get simple splices that do not involve reifyDecl or declaration
        quasi-quotes to work.  NB: This worked already when the construction of the
        Dec term and the splice were in separated modules, but not when they are in
        the same (see the regression test "TH_spliceDecl1.hs").
      - The tests "TH_spliceDecl2.hs" and "TH_spliceDecl3.hs" use toplevel splices
        together with quasi-quoted and reifyDecl.  These currently still fail, as
        importing of some of the required type constructors from THSyntax isn't
    • simonpj's avatar
      [project @ 2002-11-20 09:37:45 by simonpj] · 34a10d66
      simonpj authored
      	Add -Werror flag, which makes warnings fatal
      -Werror is standard gcc-ism; it makes warnings into fatal errors
      so you don't miss them in a batch compile.
      Fairly easy to implement, by modifying ErrUtils.errorsFound
      Suggested by Ashley Yakeley
    • chak's avatar
      [project @ 2002-11-20 07:19:12 by chak] · dac19c07
      chak authored
      TH: Revised type variable handling in toplevel decls (became necessary due to
      recent addition of foralls in type representations).
  4. 19 Nov, 2002 7 commits
    • simonpj's avatar
      [project @ 2002-11-19 15:57:10 by simonpj] · 0316a9e6
      simonpj authored
      	Fix a terrible and long-standing strictness bug
      Simplify.simplifyArg was floating out lets from a lazy argument.
      Not only is this unprofitable, but it can actually be wrong it
      the floated let has a strict-demand flag on it.  (Simplify.simplLazyBind
      goes to some trouble to check for this case.)
      The situation is this
      	lazy_fn (let v = <expensive> in str_fn v v)
      Here, the strictness analyser may put a 'demanded' flag on
      v, and if is is *then* floated we'll get
      	let v* = <expensive>
      	lazy_fn (str_fn v v)
      and then <expensive> will always be evaluated.
      This bug has been in the compiler at least a year (since Sept 01), but
      in fact it's quite hard to make a test case for it, because the same
      bug meant that the let was floated out *before* strictness analysis
      	let v = <expensive>
      	lazy_fn (str_fn v v)
      and now v won't get a strict-demand flag.  So it's only if the let
      shows up (by inlining) after strictness analysis but not before.
    • simonpj's avatar
      [project @ 2002-11-19 15:51:16 by simonpj] · 821d7994
      simonpj authored
    • simonmar's avatar
      [project @ 2002-11-19 14:16:43 by simonmar] · de7a4a03
      simonmar authored
      - Fix a bug in eta-expansion of an application; it probably never bit
        us in practice.
      - Change the behaviour of State#-lambdas: previously a State# lambda
        was considered to be one-shot for the purposes of inlining and
        eta-expansion.  Both can lead to unbounded extra work, but inlining
        is more likely to kill us, and eta-expansion is the case we mostly
        care about (getting the State# lambda to the outside of the function
        is often very important).  So now we only consider a State# lambda to be
        one-shot in eta expansion, not for inlining.
    • simonmar's avatar
      [project @ 2002-11-19 13:49:30 by simonmar] · 459c7e36
      simonmar authored
      Don't recalculate dependencies if none of the source files have changed.
    • simonpj's avatar
      [project @ 2002-11-19 12:34:55 by simonpj] · 00e85a3c
      simonpj authored
      More newMethod tidying up
    • simonmar's avatar
      [project @ 2002-11-19 11:14:50 by simonmar] · 15ff8ef0
      simonmar authored
      - Pull in the appropriate $(GhcStageNHcOpts)
      - re-instate -I$(GHC_INCLUDE_DIR) in $(SRC_CC_OPTS) that I
        accidentally removed in rev. 1.226
    • simonpj's avatar
      [project @ 2002-11-19 09:37:08 by simonpj] · c12d117d
      simonpj authored
  5. 18 Nov, 2002 8 commits
    • simonpj's avatar
      [project @ 2002-11-18 17:01:01 by simonpj] · 0638e7d8
      simonpj authored
      	Perl and control-M's on Win32
      If the Cygwin 'perl' processes a file produced by a Mingw program
      (such as ghc -M), so that the latter has DOS-style line termination,
      the Cygwin 'perl' gets confused and adds extra control-M's.
      This affects
      	a) mkdependC, which processes the .depend file produced by
      		ghc -M
      	b) the perl post-procssing step in ghc/compiler/Makefile,
      		which makes .depend-1 etc from .depend-BASE
      The solution is to sprinkle few
      	binmode( HANDLE );
      statements around in the perl scripts.
      I think they don't affect the Unix version.
    • simonpj's avatar
      [project @ 2002-11-18 14:57:09 by simonpj] · a4a1d352
      simonpj authored
      Record some known bugs
    • simonpj's avatar
      [project @ 2002-11-18 14:35:57 by simonpj] · 3e0909fc
      simonpj authored
      A TH fix; and implicit-parameter documentation
    • simonpj's avatar
      [project @ 2002-11-18 14:25:50 by simonpj] · 4e84be0c
      simonpj authored
      	Class ops that do not introduce for-alls
      	MERGE TO STABLE (if poss)
      The handling of class ops that do not add an extra for-all
      was utterly bogus.  For example:
      	class C a where
      	    fc :: (?p :: String) => a;
      	class D a where
      	    fd :: (Ord a) => [a] -> [a]
      De-bogus-ing means
      a) Being careful when taking apart the class op type in
      b) Ditto when making the method Id in an instance binding.
         Hence new function Inst.tcInstClassOp, and its calls
         in TcInstDcls, and TcClassDcls
    • simonpj's avatar
      [project @ 2002-11-18 14:25:29 by simonpj] · fa654d6b
      simonpj authored
    • simonpj's avatar
      [project @ 2002-11-18 14:22:01 by simonpj] · 7ff78c25
      simonpj authored
      	Ambiguity for implicit parameters
      Implicit parameters do not cause amiguity. For example, this is OK:
      	foo :: (?x :: [a]) => Int -> Int
      	foo _ = length ?x
      Test is tcrun023.hs
    • simonmar's avatar
      [project @ 2002-11-18 10:45:45 by simonmar] · 9c7f3c9f
      simonmar authored
      Don't install HS_PROG in $libexecdir as well as $bindir on Win32.
    • simonmar's avatar
      [project @ 2002-11-18 10:03:24 by simonmar] · d062db6e
      simonmar authored
      Use -fvia-C when compiling with 4.08.x