Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : tc-untouchables
http://hackage.haskell.org/trac/ghc/changeset/8a9a7a8c42da3adb603f319a74e304af5e1b2128 >--------------------------------------------------------------- commit 8a9a7a8c42da3adb603f319a74e304af5e1b2128 Author: Simon Peyton Jones <[email protected]> Date: Mon Sep 17 13:31:14 2012 +0100 Add type "holes", enabled by -XTypeHoles, Trac #5910 This single commit combines a lot of work done by Thijs Alkemade <[email protected]>, plus a slew of subsequent refactoring by Simon PJ. The basic idea is * Add a new expression form "_", a hole, standing for a not-yet-written expression * Give a useful error message that (a) gives the type of the hole (b) gives the types of some enclosing value bindings that mention the hole Driven by this goal I did a LOT of refactoring in TcErrors, which in turn allows us to report enclosing value bindings for other errors, not just holes. (Thijs rightly did not attempt this!) The major data type change is a new form of constraint data Ct = ... | CHoleCan { cc_ev :: CtEvidence, cc_hole_ty :: TcTauType, cc_depth :: SubGoalDepth } I'm still in two minds about whether this is the best plan. Another possibility would be to have a predicate type for holes, somthing like class Hole a where holeValue :: a It works the way it is, but there are some annoying special cases for CHoleCan (just grep for "CHoleCan"). compiler/deSugar/Coverage.lhs | 1 + compiler/deSugar/DsExpr.lhs | 2 + compiler/hsSyn/HsExpr.lhs | 3 + compiler/main/DynFlags.hs | 4 +- compiler/rename/RnExpr.lhs | 9 +- compiler/typecheck/Inst.lhs | 31 ++-- compiler/typecheck/TcBinds.lhs | 90 ++++---- compiler/typecheck/TcCanonical.lhs | 9 +- compiler/typecheck/TcEnv.lhs | 21 ++- compiler/typecheck/TcErrors.lhs | 443 ++++++++++++++++++++++-------------- compiler/typecheck/TcExpr.lhs | 9 + compiler/typecheck/TcHsSyn.lhs | 3 + compiler/typecheck/TcMType.lhs | 14 +- compiler/typecheck/TcRnMonad.lhs | 35 ++- compiler/typecheck/TcRnTypes.lhs | 96 +++++--- compiler/typecheck/TcRules.lhs | 28 ++- compiler/typecheck/TcSMonad.lhs | 36 ++-- compiler/typecheck/TcSimplify.lhs | 110 ++++------ compiler/typecheck/TcUnify.lhs | 2 - compiler/types/Type.lhs | 18 +- 20 files changed, 564 insertions(+), 400 deletions(-) Diff suppressed because of size. To see it, use: git show 8a9a7a8c42da3adb603f319a74e304af5e1b2128 _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
