1. 08 Jan, 2013 4 commits
    • Simon Peyton Jones's avatar
      Add missing import · 0a24be00
      Simon Peyton Jones authored
    • Simon Peyton Jones's avatar
      Add missing file TcValidity.lhs · f879703d
      Simon Peyton Jones authored
      This should have been part of
        commit 97db0edc
        Re-engineer the ambiguity test for user type signatures
    • Simon Peyton Jones's avatar
      Merge remote branch 'origin/master' · 7dffc188
      Simon Peyton Jones authored
    • Simon Peyton Jones's avatar
      Re-engineer the ambiguity test for user type signatures · 97db0edc
      Simon Peyton Jones authored
      Two main changes. First, re-engineer the ambiguity test.  Previously
      TcMType.checkAmbiguity used a rather syntactic test to detect some
      types that are certainly ambiguous.  But a much easier test is available,
      and it is used for inferred types in TcBinds. Namely
          <type> is ambiguous
         <type> `TcUnify.isSubType` <type>
      fails to hold, where "isSubType" means "is provably more polymorphic than".
            C a => Int
      is ambiguous, because isSubType instantiates the (C a => Int)
      to (C alpha => Int) and then tries to deduce (C alpha) from (C a). This is
      Martin Sulzmann's definition of ambiguity.  (Defn 10 of "Understanding
      functional dependencies via constraint handling rules", JFP.)
      This change is neat, reduces code, and correctly rejects more programs.
      However is *is* just possible to have a useful program that would be
      rejected. For example
                class C a b
                f :: C Int b => Int -> Int
      Here 'f' would be rejected as having an ambiguous type. But it is
      just possible that, at a *call* site there might be an instance
      declaration  instance C Int b, which does not constrain 'b' at all.
      This is pretty strange -- why is 'b' overloaded at all? -- but it's
      possible, so I also added a flag -XAllowAmbiguousTypes that simply
      removes the ambiguity check.  Let's see if anyone cares.  Meanwhile
      the earlier error report will be useful for everyone else.
      A handful of regression tests had to be adjusted as a result, because
      they used ambiguous types, somewhat accidentally.
      Second, split TcMType (already too large) into two
        * TcMType: a low-level module dealing with monadic operations like
          zonking, creating new evidence variables, etc
        * TcValidity: a brand-new higher-level module dealing with
          validity checking for types: checkValidType, checkValidInstance,
          checkFamInstPats etc
      Apart from the fact that TcMType was too big, this allows TcValidity
      to import TcUnify(tcSubType) without causing a loop.
  2. 07 Jan, 2013 5 commits
  3. 05 Jan, 2013 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor invariants for FamInsts. · 5765248b
      eir@cis.upenn.edu authored
      This commit mirrors work done in the commit for ClsInsts, 5efe9b...
      - All FamInsts have *fresh* type variables. So, no more freshness work
      in addLocalFamInst
      - Some pretty-printing code around FamInsts was cleaned up a bit
      This caused location information to be added to CoAxioms and index
      information to be added to FamInstBranches.
  4. 04 Jan, 2013 10 commits
    • ian@well-typed.com's avatar
      Add a -rpath entry for the RTS library, so that it can find libffi · 9d9d09de
      ian@well-typed.com authored
      This fixes dynamic library resolution when --enable-new-dtags is used
      When --enable-new-dtags is used when linking an executable, a RUNPATH as
      well as RPATH is set. The linker then ignores RPATH, and RUNPATH is only
      used for directly (not transitively) needed libraries. As the program
      doesn't directly need libffi, it isn't found.
    • twanvl's avatar
      Added note explaining the lambdas generated by functor deriving code, and how... · 3d51f271
      twanvl authored
      Added note explaining the lambdas generated by functor deriving code, and how it compares to the old deriving code which used eta expansion.
    • twanvl's avatar
      Changed deriving of Functor, Foldable, Traversable to fix #7436. Added foldMap... · 49ca2a37
      twanvl authored
      Changed deriving of Functor, Foldable, Traversable to fix #7436. Added foldMap to derived Foldable instance.
      The derived instances will no longer eta-expand the function. I.e. instead of
          fmap f (Foo a) = Foo (fmap (\x -> f x) a)
      we now derive
          fmap f (Foo a) = Foo (fmap f a)
      Some superflous lambdas are generated as a result. For example
          data X a = X (a,a)
          fmap f (X x) = (\y -> case y of (a,b) -> (f a, f b)) x
      The optimizer should be able to simplify this code, as it is just beta reduction.
      The derived Foldable instance now includes foldMap in addition to foldr.
    • Simon Peyton Jones's avatar
    • Simon Peyton Jones's avatar
      Switch on -XEmptyCase when renaming derived declarations · 74d40186
      Simon Peyton Jones authored
      Compiler-generated code can have empty cases
    • Simon Peyton Jones's avatar
      Add an ASSERT · e52d9d46
      Simon Peyton Jones authored
    • Simon Peyton Jones's avatar
      Refactor HsExpr.MatchGroup · a8941e2a
      Simon Peyton Jones authored
       * Make MatchGroup into a record, and use the record fields
       * Split the type field into two: mg_arg_tys and mg_res_ty
         This makes life much easier for the desugarer when the
         case alterantives are empty
      A little bit of this change unavoidably ended up in the preceding
      commit about empty case alternatives
    • Simon Peyton Jones's avatar
      Allow empty case expressions (and lambda-case) with -XEmptyCase · 3671e674
      Simon Peyton Jones authored
      The main changes are:
        * Parser accepts empty case alternatives
        * Renamer checks that -XEmptyCase is on in that case
        * (Typechecker is pretty much unchanged.)
        * Desugarer desugars empty case alternatives, esp:
            - Match.matchWrapper and Match.match now accept empty eqns
            - New function matchEmpty deals with the empty case
            - See Note [Empty case alternatives] in Match
      This patch contains most of the work, but it's a bit mixed up
      with a refactoring of MatchGroup that I did at the same time
      (next commit).
    • Simon Peyton Jones's avatar
      Make CaseElim a bit less aggressive · 28d9a032
      Simon Peyton Jones authored
      See Note [Case elimination: lifted case]:
      We used to do case elimination if
              (c) the scrutinee is a variable and 'x' is used strictly
      But that changes
          case x of { _ -> error "bad" }
          --> error "bad"
      which is very puzzling if 'x' is later bound to (error "good").
      Where the order of evaluation is specified (via seq or case)
      we should respect it.
      c.f. Note [Empty case alternatives] in CoreSyn, which is how
      I came across this.
    • ian@well-typed.com's avatar
      Set DBLATEX_OPTS to -P 'filename.as.url=0' (fixes #7486) · d9674323
      ian@well-typed.com authored
      Apparently this fixes the build with dblatex 0.3.4.
  5. 03 Jan, 2013 2 commits
  6. 02 Jan, 2013 18 commits