1. 11 Jan, 2013 12 commits
  2. 10 Jan, 2013 8 commits
  3. 09 Jan, 2013 7 commits
  4. 08 Jan, 2013 4 commits
    • Simon Peyton Jones's avatar
      Add missing import · 0a24be00
      Simon Peyton Jones authored
      0a24be00
    • 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
      f879703d
    • Simon Peyton Jones's avatar
      Merge remote branch 'origin/master' · 7dffc188
      Simon Peyton Jones authored
      7dffc188
    • 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
      iff
         <type> `TcUnify.isSubType` <type>
      fails to hold, where "isSubType" means "is provably more polymorphic than".
      Example:
            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.
      97db0edc
  5. 07 Jan, 2013 5 commits
  6. 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...
      
      Specifically:
      - All FamInsts have *fresh* type variables. So, no more freshness work
      in addLocalFamInst
      
      Also:
      - 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.
      5765248b
  7. 04 Jan, 2013 3 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
      (#7062).
      
      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.
      9d9d09de
    • 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.
      3d51f271
    • 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.
      49ca2a37