1. 04 Oct, 2004 2 commits
  2. 30 Sep, 2004 1 commit
    • simonpj's avatar
      [project @ 2004-09-30 10:35:15 by simonpj] · 23f40f0e
      simonpj authored
      ------------------------------------
      	Add Generalised Algebraic Data Types
      	------------------------------------
      
      This rather big commit adds support for GADTs.  For example,
      
          data Term a where
       	  Lit :: Int -> Term Int
      	  App :: Term (a->b) -> Term a -> Term b
      	  If  :: Term Bool -> Term a -> Term a
      	  ..etc..
      
          eval :: Term a -> a
          eval (Lit i) = i
          eval (App a b) = eval a (eval b)
          eval (If p q r) | eval p    = eval q
          		    | otherwise = eval r
      
      
      Lots and lots of of related changes throughout the compiler to make
      this fit nicely.
      
      One important change, only loosely related to GADTs, is that skolem
      constants in the typechecker are genuinely immutable and constant, so
      we often get better error messages from the type checker.  See
      TcType.TcTyVarDetails.
      
      There's a new module types/Unify.lhs, which has purely-functional
      unification and matching for Type. This is used both in the typechecker
      (for type refinement of GADTs) and in Core Lint (also for type refinement).
      23f40f0e
  3. 02 Sep, 2004 1 commit
  4. 16 Aug, 2004 1 commit
  5. 25 May, 2004 2 commits
    • simonpj's avatar
      [project @ 2004-05-25 09:06:38 by simonpj] · dc9ffb20
      simonpj authored
      -----------------------------------------------
      	Decent error on re-use of built-in syntax
      	-----------------------------------------------
      
      Make the renamer complain nicely on stupid stuff like
      
      	data T = []
      
      (except in the Prelude, of course!)
      dc9ffb20
    • simonpj's avatar
      [project @ 2004-05-25 08:09:37 by simonpj] · c6713d35
      simonpj authored
      -----------------------------------------------
      	Improve location info on unused-import warnings
      	-----------------------------------------------
      
      Improving the location involves plumbing the location of the import a bit
      more assiduously -- hence change to imp_mods in TcRnTypes
      c6713d35
  6. 06 Apr, 2004 1 commit
    • simonpj's avatar
      [project @ 2004-04-06 09:29:49 by simonpj] · 3f885dcb
      simonpj authored
      The "rebindable-syntax" stuff wasn't dealing with the new location
      information correctly.  This commit fixes the problem, and thereby
      makes mdofail004 work right.  Maybe others too.
      3f885dcb
  7. 09 Jan, 2004 1 commit
  8. 31 Dec, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-12-31 08:23:25 by simonpj] · 7473349e
      simonpj authored
      -----------------------------
              Improve deprecation reporting
      	-----------------------------
      
      	[PS: the 1.31 commit of basicTypes/RdrName.lhs
      	 also belongs in this commit.]
      
      Up to now, deprecated functions are only reported when imported
      from the module defining them, but not when re-exporting.  This
      seems wrong -- often a "root" module gathers exports from sub-modules.
      
      It turned out that there was a structural problem: the deprectaions
      were getting put in the GlobalRdrEnv, and it simply doesn't have
      the defining-module's interface to hand.
      
      So this commit removes gre_deprec from GRE, and moves deprecation
      reporting from the individual occurrences (RnEnv.lookupGreRn) to
      RnNames.reportUnusedNames.  In many ways this is a better place for it,
      because there we get a global view of the entire module.  For example,
      repeated use of a single deprecated thing will only give rise to one
      warning instead of multiple warnings.
      
      So here's what we now get:
      
        Foo.hs:3:0:
          Warning: Deprecated use of Variable `withObject'
      	     (imported from Foreign.Marshal, but defined in Foreign.Marshal.Utils)
      	     use `with' instead
      7473349e
  9. 10 Dec, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-12-10 14:15:16 by simonmar] · 55042138
      simonmar authored
      Add accurate source location annotations to HsSyn
      -------------------------------------------------
      
      Every syntactic entity in HsSyn is now annotated with a SrcSpan, which
      details the exact beginning and end points of that entity in the
      original source file.  All honest compilers should do this, and it was
      about time GHC did the right thing.
      
      The most obvious benefit is that we now have much more accurate error
      messages; when running GHC inside emacs for example, the cursor will
      jump to the exact location of an error, not just a line somewhere
      nearby.  We haven't put a huge amount of effort into making sure all
      the error messages are accurate yet, so there could be some tweaking
      still needed, although the majority of messages I've seen have been
      spot-on.
      
      Error messages now contain a column number in addition to the line
      number, eg.
      
         read001.hs:25:10: Variable not in scope: `+#'
      
      To get the full text span info, use the new option -ferror-spans.  eg.
      
         read001.hs:25:10-11: Variable not in scope: `+#'
      
      I'm not sure whether we should do this by default.  Emacs won't
      understand the new error format, for one thing.
      
      In a more elaborate editor setting (eg. Visual Studio), we can arrange
      to actually highlight the subexpression containing an error.  Eventually
      this information will be used so we can find elements in the abstract
      syntax corresponding to text locations, for performing high-level editor
      functions (eg. "tell me the type of this expression I just highlighted").
      
      Performance of the compiler doesn't seem to be adversely affected.
      Parsing is still quicker than in 6.0.1, for example.
      
      Implementation:
      
      This was an excrutiatingly painful change to make: both Simon P.J. and
      myself have been working on it for the last three weeks or so.  The
      basic changes are:
      
       - a new datatype SrcSpan, which represents a beginning and end position
         in a source file.
      
       - To reduce the pain as much as possible, we also defined:
      
            data Located e = L SrcSpan e
      
       - Every datatype in HsSyn has an equivalent Located version.  eg.
      
            type LHsExpr id = Located (HsExpr id)
      
         and pretty much everywhere we used to use HsExpr we now use
         LHsExpr.  Believe me, we thought about this long and hard, and
         all the other options were worse :-)
      
      
      Additional changes/cleanups we made at the same time:
      
        - The abstract syntax for bindings is now less arcane.  MonoBinds
          and HsBinds with their built-in list constructors have gone away,
          replaced by HsBindGroup and HsBind (see HsSyn/HsBinds.lhs).
      
        - The various HsSyn type synonyms have now gone away (eg. RdrNameHsExpr,
          RenamedHsExpr, and TypecheckedHsExpr are now HsExpr RdrName,
          HsExpr Name, and HsExpr Id respectively).
      
        - Utilities over HsSyn are now collected in a new module HsUtils.
          More stuff still needs to be moved in here.
      
        - MachChar now has a real Char instead of an Int.  All GHC versions that
          can compile GHC now support 32-bit Chars, so this was a simplification.
      55042138
  10. 06 Nov, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-11-06 17:09:50 by simonpj] · 1f5e5580
      simonpj authored
      ------------------------------------
      	Major increment for Template Haskell
      	------------------------------------
      
      1.  New abstract data type "Name" which appears where String used to be.
          E.g. 	data Exp = VarE Name | ...
      
      2.  New syntax 'x and ''T, for quoting Names.  It's rather like [| x |]
          and [t| T |] respectively, except that
      
      	a) it's non-monadic:  'x :: Name
      	b) you get a Name not an Exp or Type
      
      3.  reify is an ordinary function
      	reify :: Name -> Q Info
          New data type Info which tells what TH knows about Name
      
      4.  Local variables work properly.  So this works now (crashed before):
      	f x = $( [| x |] )
      
      5.  THSyntax is split up into three modules:
      
        Language.Haskell.TH		TH "clients" import this
      
        Language.Haskell.TH.THSyntax	data type declarations and internal stuff
      
        Language.Haskell.TH.THLib	Support library code (all re-exported
      				by TH), including smart constructors and
      				pretty printer
      
      6.  Error reporting and recovery are in (not yet well tested)
      
      	report :: Bool {- True <=> fatal -} -> String -> Q ()
      	recover :: Q a -> Q a -> Q a
      
      7.  Can find current module
      
      	currentModule :: Q String
      
      
      Much other cleaning up, needless to say.
      1f5e5580
  11. 09 Oct, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-10-09 11:58:39 by simonpj] · 98688c6e
      simonpj authored
      -------------------------
      		GHC heart/lung transplant
      		-------------------------
      
      This major commit changes the way that GHC deals with importing
      types and functions defined in other modules, during renaming and
      typechecking.  On the way I've changed or cleaned up numerous other
      things, including many that I probably fail to mention here.
      
      Major benefit: GHC should suck in many fewer interface files when
      compiling (esp with -O).  (You can see this with -ddump-rn-stats.)
      
      It's also some 1500 lines of code shorter than before.
      
      **	So expect bugs!  I can do a 3-stage bootstrap, and run
      **	the test suite, but you may be doing stuff I havn't tested.
      ** 	Don't update if you are relying on a working HEAD.
      
      
      In particular, (a) External Core and (b) GHCi are very little tested.
      
      	But please, please DO test this version!
      
      
      	------------------------
      		Big things
      	------------------------
      
      Interface files, version control, and importing declarations
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * There is a totally new data type for stuff that lives in interface files:
      	Original names			IfaceType.IfaceExtName
      	Types				IfaceType.IfaceType
      	Declarations (type,class,id)	IfaceSyn.IfaceDecl
      	Unfoldings			IfaceSyn.IfaceExpr
        (Previously we used HsSyn for type/class decls, and UfExpr for unfoldings.)
        The new data types are in iface/IfaceType and iface/IfaceSyn.  They are
        all instances of Binary, so they can be written into interface files.
        Previous engronkulation concering the binary instance of RdrName has
        gone away -- RdrName is not an instance of Binary any more.  Nor does
        Binary.lhs need to know about the ``current module'' which it used to,
        which made it specialised to GHC.
      
        A good feature of this is that the type checker for source code doesn't
        need to worry about the possibility that we might be typechecking interface
        file stuff.  Nor does it need to do renaming; we can typecheck direct from
        IfaceSyn, saving a whole pass (module TcIface)
      
      * Stuff from interface files is sucked in *lazily*, rather than being eagerly
        sucked in by the renamer. Instead, we use unsafeInterleaveIO to capture
        a thunk for the unfolding of an imported function (say).  If that unfolding
        is every pulled on, TcIface will scramble over the unfolding, which may
        in turn pull in the interface files of things mentioned in the unfolding.
      
        The External Package State is held in a mutable variable so that it
        can be side-effected by this lazy-sucking-in process (which may happen
        way later, e.g. when the simplifier runs).   In effect, the EPS is a kind
        of lazy memo table, filled in as we suck things in.  Or you could think
        of it as a global symbol table, populated on demand.
      
      * This lazy sucking is very cool, but it can lead to truly awful bugs. The
        intent is that updates to the symbol table happen atomically, but very bad
        things happen if you read the variable for the table, and then force a
        thunk which updates the table.  Updates can get lost that way. I regret
        this subtlety.
      
        One example of the way it showed up is that the top level of TidyPgm
        (which updates the global name cache) to be much more disciplined about
        those updates, since TidyPgm may itself force thunks which allocate new
        names.
      
      * Version numbering in interface files has changed completely, fixing
        one major bug with ghc --make.  Previously, the version of A.f changed
        only if A.f's type and unfolding was textually different.  That missed
        changes to things that A.f's unfolding mentions; which was fixed by
        eagerly sucking in all of those things, and listing them in the module's
        usage list.  But that didn't work with --make, because they might have
        been already sucked in.
      
        Now, A.f's version changes if anything reachable from A.f (via interface
        files) changes.  A module with unchanged source code needs recompiling
        only if the versions of any of its free variables changes. [This isn't
        quite right for dictionary functions and rules, which aren't mentioned
        explicitly in the source.  There are extensive comments in module MkIface,
        where all version-handling stuff is done.]
      
      * We don't need equality on HsDecls any more (because they aren't used in
        interface files).  Instead we have a specialised equality for IfaceSyn
        (eqIfDecl etc), which uses IfaceEq instead of Bool as its result type.
        See notes in IfaceSyn.
      
      * The horrid bit of the renamer that tried to predict what instance decls
        would be needed has gone entirely.  Instead, the type checker simply
        sucks in whatever instance decls it needs, when it needs them.  Easy!
      
        Similarly, no need for 'implicitModuleFVs' and 'implicitTemplateHaskellFVs'
        etc.  Hooray!
      
      
      Types and type checking
      ~~~~~~~~~~~~~~~~~~~~~~~
      * Kind-checking of types is far far tidier (new module TcHsTypes replaces
        the badly-named TcMonoType).  Strangely, this was one of my
        original goals, because the kind check for types is the Right Place to
        do type splicing, but it just didn't fit there before.
      
      * There's a new representation for newtypes in TypeRep.lhs.  Previously
        they were represented using "SourceTypes" which was a funny compromise.
        Now they have their own constructor in the Type datatype.  SourceType
        has turned back into PredType, which is what it used to be.
      
      * Instance decl overlap checking done lazily.  Consider
      	instance C Int b
      	instance C a Int
        These were rejected before as overlapping, because when seeking
        (C Int Int) one couldn't tell which to use.  But there's no problem when
        seeking (C Bool Int); it can only be the second.
      
        So instead of checking for overlap when adding a new instance declaration,
        we check for overlap when looking up an Inst.  If we find more than one
        matching instance, we see if any of the candidates dominates the others
        (in the sense of being a substitution instance of all the others);
        and only if not do we report an error.
      
      
      
      	------------------------
      	     Medium things
      	------------------------
      
      * The TcRn monad is generalised a bit further.  It's now based on utils/IOEnv.lhs,
        the IO monad with an environment.  The desugarer uses the monad too,
        so that anything it needs can get faulted in nicely.
      
      * Reduce the number of wired-in things; in particular Word and Integer
        are no longer wired in.  The latter required HsLit.HsInteger to get a
        Type argument.  The 'derivable type classes' data types (:+:, :*: etc)
        are not wired in any more either (see stuff about derivable type classes
        below).
      
      * The PersistentComilerState is now held in a mutable variable
        in the HscEnv.  Previously (a) it was passed to and then returned by
        many top-level functions, which was painful; (b) it was invariably
        accompanied by the HscEnv.  This change tidies up top-level plumbing
        without changing anything important.
      
      * Derivable type classes are treated much more like 'deriving' clauses.
        Previously, the Ids for the to/from functions lived inside the TyCon,
        but now the TyCon simply records their existence (with a simple boolean).
        Anyone who wants to use them must look them up in the environment.
      
        This in turn makes it easy to generate the to/from functions (done
        in types/Generics) using HsSyn (like TcGenDeriv for ordinary derivings)
        instead of CoreSyn, which in turn means that (a) we don't have to figure
        out all the type arguments etc; and (b) it'll be type-checked for us.
        Generally, the task of generating the code has become easier, which is
        good for Manuel, who wants to make it more sophisticated.
      
      * A Name now says what its "parent" is. For example, the parent of a data
        constructor is its type constructor; the parent of a class op is its
        class.  This relationship corresponds exactly to the Avail data type;
        there may be other places we can exploit it.  (I made the change so that
        version comparison in interface files would be a bit easier; but in
        fact it tided up other things here and there (see calls to
        Name.nameParent).  For example, the declaration pool, of declararations
        read from interface files, but not yet used, is now keyed only by the 'main'
        name of the declaration, not the subordinate names.
      
      * New types OccEnv and OccSet, with the usual operations.
        OccNames can be efficiently compared, because they have uniques, thanks
        to the hashing implementation of FastStrings.
      
      * The GlobalRdrEnv is now keyed by OccName rather than RdrName.  Not only
        does this halve the size of the env (because we don't need both qualified
        and unqualified versions in the env), but it's also more efficient because
        we can use a UniqFM instead of a FiniteMap.
      
        Consequential changes to Provenance, which has moved to RdrName.
      
      * External Core remains a bit of a hack, as it was before, done with a mixture
        of HsDecls (so that recursiveness and argument variance is still inferred),
        and IfaceExprs (for value declarations).  It's not thoroughly tested.
      
      
      	------------------------
      	     Minor things
      	------------------------
      
      * DataCon fields dcWorkId, dcWrapId combined into a single field
        dcIds, that is explicit about whether the data con is a newtype or not.
        MkId.mkDataConWorkId and mkDataConWrapId are similarly combined into
        MkId.mkDataConIds
      
      * Choosing the boxing strategy is done for *source* type decls only, and
        hence is now in TcTyDecls, not DataCon.
      
      * WiredIn names are distinguished by their n_sort field, not by their location,
        which was rather strange
      
      * Define Maybes.mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]
        and use it here and there
      
      * Much better pretty-printing of interface files (--show-iface)
      
      Many, many other small things.
      
      
      	------------------------
      	     File changes
      	------------------------
      * New iface/ subdirectory
      * Much of RnEnv has moved to iface/IfaceEnv
      * MkIface and BinIface have moved from main/ to iface/
      * types/Variance has been absorbed into typecheck/TcTyDecls
      * RnHiFiles and RnIfaces have vanished entirely.  Their
        work is done by iface/LoadIface
      * hsSyn/HsCore has gone, replaced by iface/IfaceSyn
      * typecheck/TcIfaceSig has gone, replaced by iface/TcIface
      * typecheck/TcMonoType has been renamed to typecheck/TcHsType
      * basicTypes/Var.hi-boot and basicTypes/Generics.hi-boot have gone altogether
      98688c6e
  12. 23 Jul, 2003 1 commit
  13. 09 Jul, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-07-09 11:06:31 by simonpj] · f8031f57
      simonpj authored
      --------------------------
      	Fix two External-Core bugs
      	--------------------------
      
      1.  An inadvertent "let x = ...x..." bug in TcRnDriver
      
      2.  Adjust the new -main-is story, so that the root module is called
      	":Main" instead of "$Main".
          This means that the z-encoded module name is "ZCMain" rather than "zdMain",
          which in keeps the External-Core lexer happy.  And is more consistent generally.
      
      3.  Make the renamer happy to see definitions from modules other than the "home" one,
          when doing External Core.  In the main module, there'll be a definition for
          ZCMain.main.
      f8031f57
  14. 03 Jul, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-07-03 14:33:18 by simonpj] · 5affd811
      simonpj authored
      -----------------------
      	Type defaulting in GHCi
      	-----------------------
      
      	[Merge to stable branch, I think.]
      
      
      Extend type defaulting in GHCi so that
      
      	ghci>  []
      	[]
      
      works.  Suggested by Ralf Hinze.
      5affd811
  15. 24 Jun, 2003 1 commit
    • 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
  16. 21 Feb, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-02-21 13:27:53 by simonpj] · 84ed91ab
      simonpj authored
      -------------------------------------
      	Improve the "unused binding" warnings
      	-------------------------------------
      
      We've had a succession of hacks for reporting warnings for
      unused bindings.  Consider
      
      	module M( f ) where
      
       	f x = x
      
      	g x = g x + h x
      	h x = x
      
      Here, g mentions itself and h, but is not itself mentioned. So
      really both g and h are dead code.  We've been getting this wrong
      for ages, and every hack so far has failed on some simple programs.
      
      This commit does a much better job.  The renamer applied to a bunch
      of bindings returns a NameSet.DefUses, which is a dependency-ordered
      lists of def/use pairs.  It's documented in NameSet.
      Given this, we can work out precisely what is not used, in a nice
      tidy way.
      
      It's less convenient in the case of type and class declarations, because
      the strongly-connected-component analysis can span module boundaries.
      So things are pretty much as they were for these.
      
      
      As usual, there was a lot of chuffing around tidying things up.
      I havn't tested it at all thoroughly yet.
      
      Various unrelated import-decl-pruning has been done too.
      84ed91ab
  17. 23 Jan, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-01-23 14:54:35 by simonpj] · 9aba9a7f
      simonpj authored
      Suppress "No explicit method or default decl given for m"
      	if the method name starts with an underscore
      
      	This in response to a suggestion by George Russel
      9aba9a7f
  18. 13 Jan, 2003 1 commit
  19. 09 Jan, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-01-09 16:15:51 by simonpj] · ba580284
      simonpj authored
      --------------------------
      	Fix export-calculation bug
      	--------------------------
      
      Ross points out that in
       	module M where
       	import List as M
       	sort = "foo"
      
      there is no conflict in the export list. GHC used to treat this
      like
      
      	module M( module M ) where ...
      
      which is wrong, wrong, wrong.
      
      Now fixed.   Test in modules/mod200.hs
      
      Some other small tidying up (notably in GRE.gre_parent).
      ba580284
  20. 08 Jan, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-01-08 15:28:04 by simonmar] · b1f1b152
      simonmar authored
      Improve missing-module error messages.  eg.
      
      hello2.hs:1:
          Failed to load interface for `Foo':
              Could not find interface file for `Foo'
              (use -v to see a list of the files searched for)
      
      and if we add the -v flag:
      
      hello2.hs:1:
          Failed to load interface for `Foo':
              Could not find interface file for `Foo'
              locations searched:
                  Foo.hi
                  Foo.hi-boot-6
                  Foo.hi-boot
                  /home/simonmar/builds/i386-unknown-linux/libraries/haskell-src/Foo.hi
                  /home/simonmar/builds/i386-unknown-linux/libraries/haskell98/Foo.hi
                  /home/simonmar/builds/i386-unknown-linux/libraries/readline/Foo.hi
                  /home/simonmar/builds/i386-unknown-linux/libraries/unix/Foo.hi
                  /home/simonmar/builds/i386-unknown-linux/libraries/network/Foo.hi
                  /home/simonmar/builds/i386-unknown-linux/libraries/base/Foo.hi
      b1f1b152
  21. 11 Dec, 2002 1 commit
  22. 10 Dec, 2002 2 commits
  23. 28 Oct, 2002 1 commit
  24. 24 Oct, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-10-24 14:17:46 by simonpj] · e0445ffa
      simonpj authored
      ------------------------------------------
      	1. New try and module and package dependencies
      	2. OrigNameCache always contains final info
      	------------------------------------------
      
      These things nearly complete sorting out the incremental
      linking problem that started us off!
      
      1. This commit separates two kinds of information:
      
        (a) HscTypes.Dependencies:
      	What (i)  home-package modules, and
      	     (ii) other packages
            this module depends on, transitively.
      
            That is, to link the module, it should be enough
            to link the dependent modules and packages (plus
            any C stubs etc).
      
            Along with this info we record whether the dependent module
            is (a) a boot interface or (b) an orphan module.  So in
            fact (i) can contain non-home-package modules, namely the
            orphan ones in other packages (sigh).
      
        (b) HscTypes.Usage:
            What version of imported things were used to
            actually compile the module.  This info is used for
            recompilation control only.
      
      
      
      2. The Finder now returns a correct Module (incl package indicator)
      first time, so we can install the absolutely final Name in the
      OrigNameCache when we first come across an occurrence of that name,
      even if it's only an occurrence in an unfolding in some other interface
      file.  This is much tidier.
      
      As a result Module.lhs is much cleaner
      	No DunnoYet
      	No mkVanillaModule
      ALl very joyful stuff.
      e0445ffa
  25. 09 Oct, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-10-09 15:03:48 by simonpj] · 8c1b6bd7
      simonpj authored
      -----------------------------------
      	Lots more Template Haskell stuff
      	-----------------------------------
      
      At last!  Top-level declaration splices work!
      Syntax is
      
      	$(f x)
      
      not "splice (f x)" as in the paper.
      
      Lots jiggling around, particularly with the top-level plumbining.
      Note the new data type HsDecls.HsGroup.
      8c1b6bd7
  26. 27 Sep, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-09-27 08:20:43 by simonpj] · dbc254c3
      simonpj authored
      --------------------------------
              Implement recursive do-notation
      	--------------------------------
      
      This commit adds recursive do-notation, which Hugs has had for some time.
      
      	mdo { x <- foo y ;
      	      y <- baz x ;
      	      return (y,x) }
      
      turns into
      
      	do { (x,y) <- mfix (\~(x,y) -> do { x <- foo y;
      					    y <- baz x }) ;
      	     return (y,x) }
      
      This is all based on work by Levent Erkok and John Lanuchbury.
      
      The really tricky bit is in the renamer (RnExpr.rnMDoStmts) where
      we break things up into minimal segments.  The rest is easy, including
      the type checker.
      
      Levent laid the groundwork, and Simon finished it off. Needless to say,
      I couldn't resist tidying up other stuff, so there's no guaranteed I
      have not broken something.
      dbc254c3
  27. 13 Sep, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-09-13 15:02:25 by simonpj] · 9af77fa4
      simonpj authored
      --------------------------------------
      	Make Template Haskell into the HEAD
      	--------------------------------------
      
      This massive commit transfers to the HEAD all the stuff that
      Simon and Tim have been doing on Template Haskell.  The
      meta-haskell-branch is no more!
      
      WARNING: make sure that you
      
        * Update your links if you are using link trees.
          Some modules have been added, some have gone away.
      
        * Do 'make clean' in all library trees.
          The interface file format has changed, and you can
          get strange panics (sadly) if GHC tries to read old interface files:
          e.g.  ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
      	  Binary.get(TyClDecl): ForeignType
      
        * You need to recompile the rts too; Linker.c has changed
      
      
      However the libraries are almost unaltered; just a tiny change in
      Base, and to the exports in Prelude.
      
      
      NOTE: so far as TH itself is concerned, expression splices work
      fine, but declaration splices are not complete.
      
      
      		---------------
      		The main change
      		---------------
      
      The main structural change: renaming and typechecking have to be
      interleaved, because we can't rename stuff after a declaration splice
      until after we've typechecked the stuff before (and the splice
      itself).
      
      * Combine the renamer and typecheker monads into one
      	(TcRnMonad, TcRnTypes)
        These two replace TcMonad and RnMonad
      
      * Give them a single 'driver' (TcRnDriver).  This driver
        replaces TcModule.lhs and Rename.lhs
      
      * The haskell-src library package has a module
      	Language/Haskell/THSyntax
        which defines the Haskell data type seen by the TH programmer.
      
      * New modules:
      	hsSyn/Convert.hs 	converts THSyntax -> HsSyn
      	deSugar/DsMeta.hs 	converts HsSyn -> THSyntax
      
      * New module typecheck/TcSplice type-checks Template Haskell splices.
      
      		-------------
      		Linking stuff
      		-------------
      
      * ByteCodeLink has been split into
      	ByteCodeLink	(which links)
      	ByteCodeAsm	(which assembles)
      
      * New module ghci/ObjLink is the object-code linker.
      
      * compMan/CmLink is removed entirely (was out of place)
        Ditto CmTypes (which was tiny)
      
      * Linker.c initialises the linker when it is first used (no need to call
        initLinker any more).  Template Haskell makes it harder to know when
        and whether to initialise the linker.
      
      
      	-------------------------------------
      	Gathering the LIE in the type checker
      	-------------------------------------
      
      * Instead of explicitly gathering constraints in the LIE
      	tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
        we now dump the constraints into a mutable varabiable carried
        by the monad, so we get
      	tcExpr :: RenamedExpr -> TcM TypecheckedExpr
      
        Much less clutter in the code, and more efficient too.
        (Originally suggested by Mark Shields.)
      
      
      		-----------------
      		Remove "SysNames"
      		-----------------
      
      Because the renamer and the type checker were entirely separate,
      we had to carry some rather tiresome implicit binders (or "SysNames")
      along inside some of the HsDecl data structures.  They were both
      tiresome and fragile.
      
      Now that the typechecker and renamer are more intimately coupled,
      we can eliminate SysNames (well, mostly... default methods still
      carry something similar).
      
      		-------------
      		Clean up HsPat
      		-------------
      
      One big clean up is this: instead of having two HsPat types (InPat and
      OutPat), they are now combined into one.  This is more consistent with
      the way that HsExpr etc is handled; there are some 'Out' constructors
      for the type checker output.
      
      So:
      	HsPat.InPat	--> HsPat.Pat
      	HsPat.OutPat	--> HsPat.Pat
      	No 'pat' type parameter in HsExpr, HsBinds, etc
      
      	Constructor patterns are nicer now: they use
      		HsPat.HsConDetails
      	for the three cases of constructor patterns:
      		prefix, infix, and record-bindings
      
      	The *same* data type HsConDetails is used in the type
      	declaration of the data type (HsDecls.TyData)
      
      Lots of associated clean-up operations here and there.  Less code.
      Everything is wonderful.
      9af77fa4
  28. 29 Jul, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-07-29 12:22:37 by simonpj] · 2ddea0a8
      simonpj authored
      *** MERGE TO STABLE BRANCH ***
      
      
      Surprisingly large delta to make rebindable names work properly.
      I was sloppily not checking the type of the user-supplied name,
      and Ashley Yakeley's first experiment showed up the problem!
      
      Solution: typechecker has to check both the 'standard' name and
      the 'user' name and check the latter has a type compatible with the
      former.
      
      The main comment is with Inst.tcSyntaxName (a new function).
      2ddea0a8
  29. 27 Jun, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-06-27 15:38:56 by simonmar] · 9e9367d6
      simonmar authored
      Finally fix foreign export and foreign import "wrapper" so that
      exceptions raised during the call are handled properly rather than
      causing the RTS to bomb out.
      
      In particular, calling System.exitWith in a foreign export will cause
      the program to terminate cleanly with the desired exit code.  All
      other exceptions are printed on stderr (and the program is
      terminated).
      
      Details:
      
      GHC.TopHandler.runMain is now called runIO, and has type IO a -> IO a
      (previously it had type IO a -> IO (), but that's not general enough
      for a foreign export).  The stubs for foreign export and forein import
      "wrapper" now automatically wrap the computation in runIO or its dual,
      runNonIO.  It turned out to be simpler to do it this way than to do
      the wrapping in Haskell land (plain foreign exports don't have
      wrappers in Haskell).
      9e9367d6
  30. 17 Jun, 2002 1 commit
  31. 05 Jun, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-06-05 14:39:27 by simonpj] · b2f644fa
      simonpj authored
      ---------------------------------------
      	Add rebindable syntax for do-notation
      		(this time, on the HEAD)
      	---------------------------------------
      
      Make do-notation use rebindable syntax, so that -fno-implicit-prelude
      makes do-notation use whatever (>>=), (>>), return, fail are in scope,
      rather than the Prelude versions.
      
      On the way, combine HsDo and HsDoOut into one constructor in HsSyn,
      and tidy up type checking of HsDo.
      b2f644fa
  32. 27 May, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-05-27 15:28:07 by simonpj] · ef2b170c
      simonpj authored
      Allow infix type constructors
      
      This commit adds infix type constructors (but not yet class constructors).
      The documentation describes what should be the case.  Lots of tiresome
      changes, but nothing exciting.
      
      Allows infix type constructors everwhere a type can occur, and in a data
      or type synonym decl.  E.g.
      
      	data a :*: b = ....
      
      
      You can give fixity decls for type constructors, but the fixity decl
      applies both to the tycon and the corresponding data con.
      ef2b170c
  33. 23 Apr, 2002 2 commits
  34. 01 Apr, 2002 1 commit
  35. 28 Mar, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-03-28 17:52:08 by simonmar] · eb2a3ce7
      simonmar authored
      In lookupTopBndrRn, if we're in an interface file, then create the
      binder in the cache with the correct Module (inc. package name) rather
      than making a vanilla module as we do currently.
      
      This helps to get the package names right in names from interfaces
      that we've read via checkOldIface (ie. "skipped" modules), and fixes a
      bug to do with unnecessary version bumping and recompilation.
      
      (Simon P.J. will add a better comment later)
      
      MERGE TO STABLE
      eb2a3ce7
  36. 14 Mar, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-03-14 15:47:52 by simonmar] · b9312420
      simonmar authored
      Remove the interface file parser, and move .hi-boot parsing into the
      main parser.  The syntax of .hi-boot files is now greatly improved in
      terms of readability; here's an example:
      
      	module M where
      	data T
      	f :: T -> GHC.Base.Int
      
      note that
      	(a) layout can be used
      	(b) there's no explcit export list; everything declared
      	    is implicitly exported
      	(c) Z-encoding of names is no longer required
      	(d) Any identifier not declared in the current module must
      	    still be quailified with the module which originally
      	    defined it (eg. GHC.Base.Int above).
      
      We'd like to relax (d), but that will come later.
      b9312420