1. 24 Jun, 2003 8 commits
    • simonmar's avatar
      [project @ 2003-06-24 09:43:23 by simonmar] · fa2fe973
      simonmar authored
      Fix up compilation with GHC 5.02
      fa2fe973
    • stolz's avatar
      [project @ 2003-06-24 09:32:34 by stolz] · 9d5c1a04
      stolz authored
      Fix another occurence of openFileEx in stage2
      9d5c1a04
    • stolz's avatar
      [project @ 2003-06-24 08:49:55 by stolz] · b996479a
      stolz authored
      - AP_UPD got renamed to AP in rev. 1.18 of ClosureTypes.h
      - #if 0-out section which is a sure segfault in the colouring loop
      b996479a
    • stolz's avatar
      [project @ 2003-06-24 08:47:05 by stolz] · 717412ee
      stolz authored
      Can't use tab stops in GTK
      717412ee
    • stolz's avatar
      [project @ 2003-06-24 08:31:35 by stolz] · 02928be0
      stolz authored
      Make 'depend' treated GTK includes as missing when building with FrontPanel.
      02928be0
    • stolz's avatar
      [project @ 2003-06-24 08:29:13 by stolz] · 073ba748
      stolz authored
      Eliminate warnings for ELF_*
      073ba748
    • simonpj's avatar
      [project @ 2003-06-24 08:03:15 by simonpj] · d2fcb5a6
      simonpj authored
      comments only
      d2fcb5a6
    • simonpj's avatar
      [project @ 2003-06-24 07:58:18 by simonpj] · 16e4ce4c
      simonpj authored
      ----------------------------------------------
      	Add support for Ross Paterson's arrow notation
      	----------------------------------------------
      
      Ross Paterson's ICFP'01 paper described syntax to support John Hughes's
      "arrows", rather as do-notation supports monads.  Except that do-notation is
      relatively modest -- you can write monads by hand without much trouble --
      whereas arrow-notation is more-or-less essential for writing arrow programs.
      It desugars to a massive pile of tuple construction and selection!
      
      For some time, Ross has had a pre-processor for arrow notation, but the
      resulting type error messages (reported in terms of the desugared code)
      are impenetrable.  This commit integrates the syntax into GHC.  The
      type error messages almost certainly still require tuning, but they should
      be better than with the pre-processor.
      
      Main syntactic changes (enabled with -farrows)
      
         exp ::= ... | proc pat -> cmd
      
         cmd ::= exp1 -<  exp2   |  exp1 >-  exp2
      	|  exp1 -<< exp2   |  exp1 >>- exp2
      	| \ pat1 .. patn -> cmd
      	| let decls in cmd
      	| if exp then cmd1 else cmd2
      	| do { cstmt1 .. cstmtn ; cmd }
      	| (| exp |) cmd1 .. cmdn
      	| cmd1 qop cmd2
      	| case exp of { calts }
      
         cstmt :: = let decls
      	 |   pat <- cmd
      	 |   rec { cstmt1 .. cstmtn }
      	 |   cmd
      
      New keywords and symbols:
      	proc rec
      	-<   >-   -<<   >>-
      	(|  |)
      
      The do-notation in cmds was not described in Ross's ICFP'01 paper; instead
      it's in his chapter in The Fun of Programming (Plagrave 2003).
      
      The four arrow-tail forms (-<) etc cover
        (a) which order the pices come in (-<  vs  >-), and
        (b) whether the locally bound variables can be used in the
      		arrow part (-<  vs  -<<) .
      In previous presentations, the higher-order-ness (b) was inferred,
      but it makes a big difference to the typing required so it seems more
      consistent to be explicit.
      
      The 'rec' form is also available in do-notation:
        * you can use 'rec' in an ordinary do, with the obvious meaning
        * using 'mdo' just says "infer the minimal recs"
      
      
      Still to do
      ~~~~~~~~~~~
      Top priority is the user manual.
      
      The implementation still lacks an implementation of
      the case form of cmd.
      
      
      Implementation notes
      ~~~~~~~~~~~~~~~~~~~~
      Cmds are parsed, and indeed renamed, as expressions.  The type checker
      distinguishes the two.
      16e4ce4c
  2. 23 Jun, 2003 5 commits
    • sof's avatar
      [project @ 2003-06-23 19:40:21 by sof] · 67d41f03
      sof authored
      setTmpDir: canonicalise temp file paths under mingw:
        - convert backslashes into forward ones
        - drop trailing slash
        - translate /cygdrive/drive/path to drive:/path, coping with
          cygwin-centric settings for TMP or TEMP.
      67d41f03
    • simonpj's avatar
      [project @ 2003-06-23 11:46:40 by simonpj] · e7fb057f
      simonpj authored
      ------------------------------------------------------
      	Make the strictness analyser more conservative for I/O
      	------------------------------------------------------
      
      Consider
      	do { let len = <expensive> ;
      	   ; when (...) (exitWith ExitSuccess)
      	   ; print len }
      
      Is it safe to evaluate <expensive> before doing the 'when'?  Remember,
      <expensive> might raise an exception etc as well.
      
      Normal strictness analysis answer: yes, because either the when... diverges
      or raises an exception, or the print will happen.
      
      Correct I/O answer: no, because it's perfectly OK to terminate the program
      successfully.  And don't say the 'len' could be pushed down, because (a) sometimes
      it can't and (b) sometimes the compiler might float it out.
      
      This commit adds a hack to the demand analyser, so that it treats a case that
      looks like I/O (unboxed pair, real-world as first bindre) specially, by lub'ing
      the returned strictness type with TopType.  A bit like adding a dummy never-taken
      branch.  This seems a bit hack-oid, but it's quick and it works.  Not clear
      how to do it 'right', either.
      
      Test is in stranal/should_run/strun003.
      e7fb057f
    • simonpj's avatar
      [project @ 2003-06-23 11:46:06 by simonpj] · 0c33b675
      simonpj authored
      Fix previous -main-is commit
      0c33b675
    • simonpj's avatar
      [project @ 2003-06-23 10:35:15 by simonpj] · d28ba8c8
      simonpj authored
      -------------------
      	Dealing with 'main'
      	-------------------
      
      1.  In GHC 6.0, a module with no "module Main ... where" header
          elicited an error "main is not in scope" if 'main' is not defined.  We
          don't want this behaviour in GHCi.  This happened because the parser
          expanded the (absent) header to "module Main( main ) where", and the
          'main' in the export list isn't.
      
      Solution: elaborate HsModule to record whether the 'module ..." header was
      given explicitly by the user or not.
      
      
      2.  Add a -main-is flag, and document it, so that you can have a 'main' function
      that is not Main.main.  Summary of changes
      
      * The -main-is flag nominates what the main function is to be (see the documentation).
      	No -main-is flag 	says that the main function is Main.main
      	-main-is Foo.baz	says that the main function is Foo.baz
      	-main-is Foo		says that the main function is Foo.main
      	-main-is baz		says that the main function is Main.baz
      
        Let's say  you say -main-is Foo.baz
      
      * TcRnDriver injects the extra definition
      	$Mian.main :: IO t
      	$Main.main = baz
        in the module Foo.   Note the naming, which is a bit different than before;
        previously the extra defn was for Main.$main.  The RTS invokes zdMain_main_closure.
      
      * CodeGen injects an extra initialisation block into module Foo, thus
      	stginit_zdMain {
      		stginit_Foo
      	}
        That ensures that the RTS can initialise stginit_zdMain.
      d28ba8c8
    • simonmar's avatar
      [project @ 2003-06-23 10:13:03 by simonmar] · dd6fe036
      simonmar authored
      openFileEx can't be gotten from GHC.Handle any more.
      dd6fe036
  3. 20 Jun, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-06-20 11:14:18 by simonpj] · 1f861358
      simonpj authored
      ------------------------------
      	Fix a small quantification bug
      	------------------------------
      
      We were quantifying over too few type variables, because fdPredsOfInsts was
      being too eager to discard predicates. This only affects rather obscure
      programs.  Here's the one Iavor found:
      
      	class C a b where f :: a -> b
      	g x = fst (f x)
      
      We want to get the type
         	g :: forall a b c.  C a (b,c) => a -> b
      but GHC 6.0 bogusly gets
         	g :: forall a b.  C a (b,()) => a -> b
      
      A test is in should_compile/tc168
      1f861358
  4. 19 Jun, 2003 5 commits
    • sof's avatar
      [project @ 2003-06-19 18:53:09 by sof] · 4418c8e9
      sof authored
      add -traditional to SRC_CPP_OPTS to silence (harmless)
      'unterminated char constant' warnings when processing .pp files.
      4418c8e9
    • simonmar's avatar
      [project @ 2003-06-19 12:47:08 by simonmar] · 2ba64673
      simonmar authored
      small optimisation: when evacuating a TSO, only copy the part of the
      stack that is above the stack pointer and hence in use (doesn't apply
      to most stacks, which are large objects and don't get copied anyhow).
      2ba64673
    • simonmar's avatar
      [project @ 2003-06-19 11:27:42 by simonmar] · c4a80e88
      simonmar authored
      Remove slightly bogus -traditional flag from SRC_CPP_OPTS here.
      c4a80e88
    • simonmar's avatar
      [project @ 2003-06-19 10:42:24 by simonmar] · d89872a4
      simonmar authored
      Add raiseIO# primop.
      
      This is part of ensuring that exceptions are *precise* in the IO monad
      (as opposed to imprecise exceptions in the pure world).  If we allow
      the strictness analyser to see the definition of throwIO:
      
        throwIO e = IO $ \s -> throw e
      
      then it might re-order evaluation in the IO monad, with the result
      that we get _|_ instead of an exception, or one kind of exception when
      we were expecting another.  We therefore must prevent the strictness
      analyser from doing these reorderings in the IO monad.  Hiding the
      definition of throwIO by making it a primop solves part of the problem
      (there's more to come).
      
      See SourceForge bug #752149.
      d89872a4
    • simonmar's avatar
      [project @ 2003-06-19 10:35:37 by simonmar] · 1f730da4
      simonmar authored
      Style nits only
      1f730da4
  5. 17 Jun, 2003 1 commit
  6. 16 Jun, 2003 2 commits
    • simonpj's avatar
      [project @ 2003-06-16 15:32:16 by simonpj] · f5fbd41c
      simonpj authored
      --------------------------
      	Remove some wired-in types
      	--------------------------
      
      ptrTyCon, funPtrTyCon, addrTyCon, stablePtrTyCon have no business
      being wired in. This commit makes them into knownKey Names, which
      is much better.
      f5fbd41c
    • simonpj's avatar
      [project @ 2003-06-16 15:31:13 by simonpj] · 76c6edcb
      simonpj authored
      ----------------------------------
      	Fix the "no interface file" bug
      	----------------------------------
      
      The problem was this.
      
      * Module A imports module B
      
      * ghc --make A
      
      * Remove B.hs, B.hi, and edit A so that it doesn't import B
      
      * ghc --make A
      
      Then GHC would fail, saying it can't find an interface file for B.
      Reason: when loading A.hi (loadOldIface) it makes a Name for the
      usages it finds.  To make a Name for B things, it needs B's package;
      but it can't find B.hi, so it bombs instead.
      
      Solution: don't complain if loadOldIface fails; instead behave just like
      if you can't find A.hi.
      
      Fixes a long-standing infelicity.
      76c6edcb
  7. 14 Jun, 2003 1 commit
  8. 13 Jun, 2003 4 commits
  9. 12 Jun, 2003 6 commits
    • simonpj's avatar
      [project @ 2003-06-12 16:50:19 by simonpj] · 0116f059
      simonpj authored
      ----------------------------------
      	Fix the no-GHC.Err problem in GHCi
      	----------------------------------
      
      Merge this to the stable branch.
      
      Pattern-match failure error-ids are wired-in, which means the
      GHC.Err interface isn't loaded, which in turn confused the linker
      when tried to find what package GHC.Err is from.
      
      Now we exclude wired-in names from the free variables looked at
      by the linker (in Linker.linkExpr), and make sure the base package
      is loaded unconditionally (DriverState.initPackageList).
      0116f059
    • simonmar's avatar
      [project @ 2003-06-12 16:25:31 by simonmar] · 187dc566
      simonmar authored
      Urk, don't quote/escape the command name on Windows, because the
      compiler is exceedingly naughty and sometimes uses 'perl "..."' as the
      command name.
      187dc566
    • simonmar's avatar
      [project @ 2003-06-12 16:06:05 by simonmar] · 526db217
      simonmar authored
      Change the type of System.Cmd.rawSystem:
      
        rawSystem :: FilePath -> [String] -> IO ExitCode
      
      and implement it properly on both Windows & Unix.  The intended
      meaning is that the program is executed with *exactly* these
      arguments.
      
      We now re-use this rawSystem in the compiler itself (using it directly
      from the library if __GLASGOW_HASKELL__ >= 601).
      
      The previous implementation of SysTools.runSomething was broken on
      4.08, because Posix.executeFile was broken.  However, implementing the
      new rawSystem on 4.08 is tricky, because it uses the FFI marshalling
      libraries which weren't present on 4.08.  Hence, bootstrapping from
      4.08 is now not possible (it was already not possible on Windows).  It
      could be made possible by importing enough FFI marshalling support,
      but I won't bother doing that unless/until it is needed.
      526db217
    • simonpj's avatar
      [project @ 2003-06-12 14:37:21 by simonpj] · dc2ae820
      simonpj authored
      Comments
      dc2ae820
    • simonpj's avatar
      [project @ 2003-06-12 14:36:59 by simonpj] · b30bffd8
      simonpj authored
      Fix lack of deriving(Typeable) in existentials; merge to stable
      b30bffd8
    • simonpj's avatar
      [project @ 2003-06-12 09:48:17 by simonpj] · b6d15868
      simonpj authored
      Add more comments from Sigbjorn
      b6d15868
  10. 11 Jun, 2003 2 commits
  11. 10 Jun, 2003 5 commits
    • sof's avatar
      [project @ 2003-06-10 17:54:56 by sof] · 9413f9ed
      sof authored
      Normalise filepaths of all source files before doing any processing
      of them. This, unsurprisingly, simplifies filepath comparisons on
      platforms that support multiple path syntaxes (cf., bidirectional
      slashes under mingw/win32.)
      
      This tentatively fixes Sourceforge bug #751175; assuming now bad
      interactions arise, a similar change will be made on STABLE.
      9413f9ed
    • sof's avatar
      [project @ 2003-06-10 17:46:06 by sof] · 930d53b9
      sof authored
      - renamed unDosifyPath as normalisePath
      - renamed dosifyPath as platformPath
      - dropped dosifyPaths; unused.
      - platformPath (ne dosifyPath): drop slicing off of /cygdrive prefixes
      930d53b9
    • simonpj's avatar
      [project @ 2003-06-10 13:40:11 by simonpj] · cb2da7a5
      simonpj authored
      ----------------------------------
      	Fix the crossDllArg crash (take 2)
      	----------------------------------
      
      I got this fix completely wrong, again.
      
      The original CoreUtils.rhsIsNonUpd is now renamed again, to
      CoreUtils.rhsIsStatic. Yet more comments explain its (now
      simplified) working.
      cb2da7a5
    • simonmar's avatar
      [project @ 2003-06-10 13:21:26 by simonmar] · e3d6a95f
      simonmar authored
      Add some more optional space to a pattern for compatibility with GCC 3.3.
      e3d6a95f
    • simonmar's avatar
      [project @ 2003-06-10 13:01:09 by simonmar] · 6fa5e486
      simonmar authored
      Explain that the hierarchy is not cleanly divided into packages - two
      people (at least) have so far been confused that System.Posix.Types is
      in base but System.Posix is in unix.
      6fa5e486