1. 15 Jul, 2000 1 commit
  2. 14 Jul, 2000 2 commits
    • simonpj's avatar
      [project @ 2000-07-14 13:37:53 by simonpj] · 71352675
      simonpj authored
      Wibbles in the new kind-checking stuff
      71352675
    • simonpj's avatar
      [project @ 2000-07-14 08:17:36 by simonpj] · 77a8c0db
      simonpj authored
      This commit completely re-does the kind-inference mechanism.
      Previously it was inter-wound with type inference, but that was
      always hard to understand, and it finally broke when we started
      checking for ambiguity when type-checking a type signature (details
      irrelevant).
      
      So now kind inference is more clearly separated, so that it never
      takes place at the same time as type inference.  The biggest change
      is in TcTyClsDecls, which does the kind inference for a group of
      type and class declarations.  It now contains comments to explain
      how it all works.
      
      There are also comments in TypeRep which describes the slightly
      tricky way in which we deal with the fact that kind 'type' (written
      '*') actually has 'boxed type' and 'unboxed type' as sub-kinds.
      The whole thing is a bit of a hack, because we don't really have 
      sub-kinding, but it's less of a hack than before.
      
      A lot of general tidying up happened at the same time.
      In particular, I removed some dead code here and there
      77a8c0db
  3. 11 Jul, 2000 1 commit
  4. 30 Jun, 2000 1 commit
  5. 18 Jun, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-06-18 08:37:17 by simonpj] · 91ef36b9
      simonpj authored
      *** MERGE WITH 4.07 ***
      
      * Fix the ambiguity check in TcMonotype.lhs so that
        it is not carried out for types read from interface 
        files.  Some workers may get ambiguous types but that
        does not matter, and should not make compilation fail.
        More detail in the comments with TcMonoType.tc_type_kind
        (the HsForAll case)
      
      * Don't create specialisations for type applications 
        where there's a matching rule.  The rule should
        clearly take precedence.  (Bug reported by Sven.)
        I havn't tested this fix.
      
      * Run the occurrence analyser after tidyCore, so that
        occurrence info (notably dead-var info) is correct
        for the code generators.  This should fix Erik's problem,
        but again I've not tested the fix.  The extra call 
        is in Main.lhs
      
      * Fix CoreToStg so that it can handle an StgLam in mkStgCase.
        This only shows up in a wierd case, documented in 
        CoreToStg.mkStgCase
      91ef36b9
  6. 09 Jun, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-06-09 15:53:12 by simonpj] · b610eca3
      simonpj authored
      GHC gets upset if you have types like
      
      	Eq a => a->a
      
      where 'a' is *not* universally quantified.
      By "upset" I mean that the typechecker generates
      rather bogus code, that subsequently kills Lint.
      
      Such types used to be rejected in the renamer,
      but Jeff removed that in favour of an ambiguity
      check in TcMonoType.  I remember agreeing to move
      the renamer check to the type checker, and Jeff did this,
      but the check in TcMonoType was only checking for
      *ambiguity*, which isn't quite the same.
      
      I've restored the missing check and commented it
      better in TcMonoType.
      
      Jeff: if this isn't right for you, let's dicuss.
      
      Incidentally, I also generalise the ambiguity check
      to detect
      	forall a. ?x::a => Int
      which is ambiguous.
      
      I did a few formatting changes too.
      b610eca3
  7. 31 May, 2000 1 commit
    • lewie's avatar
      [project @ 2000-05-31 10:13:57 by lewie] · e7f04a0d
      lewie authored
      Cleanup pass on functional dependencies.  Most noticeably, make it so that
      signatures involving classes with functional dependencies work.  Also,
      Fundeps are now properly handled by the simplifier, resolving problems
      where the fundeps were sometimes being discarded too early, and sometimes
      hanging around too long.  Took out the early ambiguity testing in the
      renamer, because that's too early (you don't know the fundeps yet).  Now,
      the ambiguity test happens in the typechecker.
      Functional Dependencies should now be up to snuff with Mark's paper,
      however, the derived instances and superclass extensions found in hugs
      are still not in there.
      It would be nice if this were merged into 4.07.  I have diffs against
      the 4.07 tree in case it's too thorny working around Simon's big commit.
      e7f04a0d
  8. 25 May, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-05-25 12:41:14 by simonpj] · 495ef8bd
      simonpj authored
      ~~~~~~~~~~~~
      		Apr/May 2000
      		~~~~~~~~~~~~
      
      This is a pretty big commit!  It adds stuff I've been working on
      over the last month or so.  DO NOT MERGE IT WITH 4.07!
      
      Interface file formats have changed a little; you'll need
      to make clean before remaking.
      
      						Simon PJ
      
      Recompilation checking
      ~~~~~~~~~~~~~~~~~~~~~~
      Substantial improvement in recompilation checking.  The version management
      is now entirely internal to GHC.  ghc-iface.lprl is dead!
      
      The trick is to generate the new interface file in two steps:
        - first convert Types etc to HsTypes etc, and thereby
      	build a new ParsedIface
        - then compare against the parsed (but not renamed) version of the old
      	interface file
      Doing this meant adding code to convert *to* HsSyn things, and to
      compare HsSyn things for equality.  That is the main tedious bit.
      
      Another improvement is that we now track version info for
      fixities and rules, which was missing before.
      
      
      Interface file reading
      ~~~~~~~~~~~~~~~~~~~~~~
      Make interface files reading more robust.
        * If the old interface file is unreadable, don't fail. [bug fix]
      
        * If the old interface file mentions interfaces
          that are unreadable, don't fail. [bug fix]
      
        * When we can't find the interface file,
          print the directories we are looking in.  [feature]
      
      
      Type signatures
      ~~~~~~~~~~~~~~~
        * New flag -ddump-types to print type signatures
      
      
      Type pruning
      ~~~~~~~~~~~~
      When importing
      	data T = T1 A | T2 B | T3 C
      it seems excessive to import the types A, B, C as well, unless
      the constructors T1, T2 etc are used.  A,B,C might be more types,
      and importing them may mean reading more interfaces, and so on.
       So the idea is that the renamer will just import the decl
      	data T
      unless one of the constructors is used.  This turns out to be quite
      easy to implement.  The downside is that we must make sure the
      constructors are always available if they are really needed, so
      I regard this as an experimental feature.
      
      
      Elimininate ThinAir names
      ~~~~~~~~~~~~~~~~~~~~~~~~~
      Eliminate ThinAir.lhs and all its works.  It was always a hack, and now
      the desugarer carries around an environment I think we can nuke ThinAir
      altogether.
      
      As part of this, I had to move all the Prelude RdrName defns from PrelInfo
      to PrelMods --- so I renamed PrelMods as PrelNames.
      
      I also had to move the builtinRules so that they are injected by the renamer
      (rather than appearing out of the blue in SimplCore).  This is if anything simpler.
      
      Miscellaneous
      ~~~~~~~~~~~~~
      * Tidy up the data types involved in Rules
      
      * Eliminate RnEnv.better_provenance; use Name.hasBetterProv instead
      
      * Add Unique.hasKey :: Uniquable a => a -> Unique -> Bool
        It's useful in a lot of places
      
      * Fix a bug in interface file parsing for __U[!]
      495ef8bd
  9. 03 Apr, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-04-03 16:46:41 by simonpj] · 6f531423
      simonpj authored
      * Minor wibble to type checker error message
      
      * Make error messages come out to stderr (I'd switched
        to stdout temporarily when fighting the Dreaded Stderr Bug
        and forgot to change back)
      6f531423
  10. 27 Mar, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-03-27 13:23:49 by simonpj] · 8ddfc3c1
      simonpj authored
      Improve the error messages given when a definition isn't polymorphic enough.
      In paticular, for this program:
      
          let v = runST (newSTRef True)
          in
          runST (readSTRef v)
      
      we get the message
      
          Inferred type is less polymorphic than expected
      	Quantified type variable `s' escapes
      	It is reachable from the type variable(s) `a'
      	  which are free in the signature
          Signature type:     forall s. ST s a
          Type to generalise: ST s (STRef s Bool)
          When checking an expression type signature
          In the first argument of `runST', namely `(newSTRef True)'
          In the right-hand side of a pattern binding: runST (newSTRef True)
      8ddfc3c1
  11. 24 Mar, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-03-24 17:49:29 by simonpj] · 6c872fff
      simonpj authored
      a) Small wibbles to do with inlining and floating
      
      b) Implement Ralf's request, so that one can write
      
      	type F = forall a. a -> a
      
      	f :: Int -> F
      	f = ...
      
         The for-alls inside F are hoisted out to the top of
         the type signature for f.  This applies uniformly to
         all user-written types
      6c872fff
  12. 01 Mar, 2000 1 commit
  13. 28 Feb, 2000 1 commit
    • lewie's avatar
      [project @ 2000-02-28 21:59:32 by lewie] · f8e67a2c
      lewie authored
      Fix signatures w/ implicit parameter types in them (in particular,
      correctly handle the case where there are no type variables).  Also
      made a few more things Outputable.  Nuke outdated comment in Parser.y.
      f8e67a2c
  14. 09 Feb, 2000 1 commit
  15. 28 Jan, 2000 1 commit
    • lewie's avatar
      [project @ 2000-01-28 20:52:37 by lewie] · 266fadd9
      lewie authored
      First pass at implicit parameters.  Honest, I didn't really go in *intending*
      to modify every file in the typechecker... ;-)  The breadth of the change
      is partly due to generalizing contexts so that they are not hardwired to
      be (Class, [Type]) pairs.  See types/Type.lhs for details (look for PredType).
      266fadd9
  16. 30 Nov, 1999 1 commit
    • lewie's avatar
      [project @ 1999-11-30 16:10:07 by lewie] · e1e1d020
      lewie authored
      First bits o' functional dependencies - just the syntax and related
      datatypes, plus started moving some of the static checks from the
      renamer (where we don't know about fundeps) to later in the typechecker.
      e1e1d020
  17. 16 Jul, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-07-16 09:36:07 by simonpj] · c3cf681e
      simonpj authored
      * Fix long-standing bug in TcIfaceSig which meant it occasionally complained
        about a lint error in an unfolding, with a locally-defined name not
        being in scope.   This only happened when hi-boot loops were being
        tied, so an unfolding might mention a locally-defined name.
      c3cf681e
  18. 15 Jul, 1999 1 commit
    • keithw's avatar
      [project @ 1999-07-15 14:08:03 by keithw] · 9d787ef5
      keithw authored
      This commit makes a start at implementing polymorphic usage
      annotations.
      
      * The module Type has now been split into TypeRep, containing the
        representation Type(..) and other information for `friends' only,
        and Type, providing the public interface to Type.  Due to a bug in
        the interface-file slurping prior to ghc-4.04, {-# SOURCE #-}
        dependencies must unfortunately still refer to TypeRep even though
        they are not friends.
      
      * Unfoldings in interface files now print as __U instead of __u.
        UpdateInfo now prints as __UA instead of __U.
      
      * A new sort of variables, UVar, in their own namespace, uvName, has
        been introduced for usage variables.
      
      * Usage binders __fuall uv have been introduced.  Usage annotations
        are now __u - ty (used once), __u ! ty (used possibly many times),
        __u uv ty (used uv times), where uv is a UVar.  __o and __m have
        gone.  All this still lives only in a TyNote, *for now* (but not for
        much longer).
      
      * Variance calculation for TyCons has moved from
        typecheck/TcTyClsDecls to types/Variance.
      
      * Usage annotation and inference are now done together in a single
        pass.  Provision has been made for inferring polymorphic usage
        annotations (with __fuall) but this has not yet been implemented.
        Watch this space!
      9d787ef5
  19. 18 May, 1999 1 commit
  20. 11 May, 1999 1 commit
    • keithw's avatar
      [project @ 1999-05-11 16:37:29 by keithw] · d133b73a
      keithw authored
      (this is number 4 of 9 commits to be applied together)
      
        The major purpose of this commit is to introduce usage information
        and usage analysis into the compiler, per the paper _Once Upon a
        Polymorphic Type_ (Keith Wansbrough and Simon Peyton Jones, POPL'99,
        and Glasgow TR-1998-19).
      
        Usage information has been added to types, in the form of a new kind
        of NoteTy: (UsgNote UsageAnn(UsOnce|UsMany|UsVar UVar)).  Usages
        print as __o (once), __m (many, usually omitted), or (not in
        interface files) __uvxxxx.  Usage annotations should only appear at
        certain places in a type (see the paper).  The `default' annotation
        is __m, and so an omitted annotation implies __m.  Utility functions
        for handling usage annotations are provided in Type.
      
        If the compiler is built with -DUSMANY (a flag intended for use in
        debugging by KSW only), __m are *required* and may not be omitted.
      
        The major constraint is that type arguments (eg to mkAppTy) must be
        unannotated on top.  To maintain this invariant, many functions
        required the insertion of Type.unUsgTy (removing annot from top of a
        type) or UsageSPUtils.unannotTy (removing all annotations from a
        type).  A function returning usage-annotated types for primops has
        been added to PrimOp.
      
        A new kind of Note, (TermUsg UsageAnn), has been added to annotate
        Terms.  This note is *not* printed in interface files, and for the
        present does not escape the internals of the usage inference engine.
      d133b73a
  21. 20 Apr, 1999 1 commit
  22. 22 Mar, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-03-22 10:39:59 by simonpj] · 375c33b1
      simonpj authored
      Fix the HsForAll case in TcMonoType.tc_type_kind so that it
      permits types like
      
      	f :: forall a. Num a => (# a->a, a->a #)
      
      Previously it insisted that the body of a for-all was a boxed
      type, but 'f' makes perfect sense, and indeed occurs in interface
      files as a result of CPR analysis.
      375c33b1
  23. 15 Mar, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-03-15 15:11:03 by simonpj] · 42a51e93
      simonpj authored
      Make clear in HsType whether a for-all is explicit
      in the source program or not.  Implicit for-alls now
      look like 
      	HsForAllTy Nothing ctxt ty
      while explicit ones look like
      	HsForAllTy (Just tvs) ctxt ty
      
      Before this, the scope analysis stuff in RnSource was
      actually wrong (not that anyone had noticed), but Alex Ferguson
      did notice a bogus (sort-of-duplicate) error message on types
      like
      	f :: Eq a => Int -> Int
      which led me to spot the deeper problem.  Anyway, it's all 
      cool now.
      42a51e93
  24. 05 Feb, 1999 1 commit
    • sof's avatar
      [project @ 1999-02-05 16:37:13 by sof] · 88ca0162
      sof authored
      -fwarn-type-defaults is your friend; misc changes to avoid H98's
      'default default' of Integer to kick when what we really want is Int.
      88ca0162
  25. 27 Jan, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-01-27 14:51:14 by simonpj] · 18976e61
      simonpj authored
      Finally!  This commits the ongoing saga of Simon's hygiene sweep
      
      FUNCTIONALITY
      ~~~~~~~~~~~~~
      a) The 'unused variable' warnings from the renamer work.  
      b) Better error messages here and there, esp type checker
      c) Fixities for Haskell 98 (maybe I'd done that before)
      d) Lazy reporting of name clashes for Haskell 98 (ditto)
      
      HYGIENE
      ~~~~~~~
      a) type OccName has its own module.  OccNames are represented
         by a single FastString, not three as in the last round.  This
         string is held in Z-encoded form; a decoding function decodes
         for printing in user error messages.  There's a nice tight
         encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
      
      b) type Module is a proper ADT, in module OccName
      
      c) type RdrName is a proper ADT, in its own module
      
      d) type Name has a new, somwhat tidier, representation
      
      e) much grunting in the renamer to get Provenances right.
         This makes error messages look better (no spurious qualifiers)
      18976e61
  26. 18 Dec, 1998 1 commit
    • simonpj's avatar
      [project @ 1998-12-18 17:40:31 by simonpj] · 7e602b0a
      simonpj authored
      Another big commit from Simon.  Actually, the last one
      didn't all go into the main trunk; because of a CVS glitch it
      ended up in the wrong branch.
      
      So this commit includes:
      
      * Scoped type variables
      * Warnings for unused variables should work now (they didn't before)
      * Simplifier improvements:
      	- Much better treatment of strict arguments
      	- Better treatment of bottoming Ids
      	- No need for w/w split for fns that are merely strict
      	- Fewer iterations needed, I hope
      * Less gratuitous renaming in interface files and abs C
      * OccName is a separate module, and is an abstract data type
      
      I think the whole Prelude and Exts libraries compile correctly.
      Something isn't quite right about typechecking existentials though.
      7e602b0a
  27. 02 Dec, 1998 1 commit
  28. 04 May, 1998 1 commit
  29. 10 Feb, 1998 1 commit
  30. 03 Feb, 1998 1 commit
    • simonm's avatar
      [project @ 1998-02-03 17:11:28 by simonm] · c29022c4
      simonm authored
      - Fixes for bootstrapping with 3.01.
      - Use 'official' extension interfaces rather than internal prelude
        modules (such as ArrBase) where possible.
      - Remove some cruft.
      - Delete some unused imports found by '-fwarn-unused-imports'.
      c29022c4
  31. 08 Jan, 1998 1 commit
    • simonm's avatar
      [project @ 1998-01-08 18:03:08 by simonm] · 9dd6e1c2
      simonm authored
      The Great Multi-Parameter Type Classes Merge.
      
      Notes from Simon (abridged):
      
      * Multi-parameter type classes are fully implemented.
      * Error messages from the type checker should be noticeably improved
      * Warnings for unused bindings (-fwarn-unused-names)
      * many other minor bug fixes.
      
      Internally there are the following changes
      
      * Removal of Haskell 1.2 compatibility.
      * Dramatic clean-up of the PprStyle stuff.
      * The type Type has been substantially changed.
      * The dictionary for each class is represented by a new
        data type for that purpose, rather than by a tuple.
      9dd6e1c2
  32. 15 Oct, 1997 1 commit
    • simonm's avatar
      [project @ 1997-10-15 14:17:30 by simonm] · f379bcfe
      simonm authored
      Simon's fix for type synonym arities.  The arity of a synonym must by
      less than or eqaul to the number of arguments supplied (test
      typecheck/should_compile/tc093.hs).
      f379bcfe
  33. 20 Jun, 1997 1 commit
  34. 26 May, 1997 1 commit
  35. 18 May, 1997 1 commit
  36. 14 Mar, 1997 1 commit
  37. 17 Jan, 1997 1 commit
  38. 19 Dec, 1996 1 commit
  39. 19 Jul, 1996 1 commit