- 23 May, 2014 2 commits
-
-
Gabor Greif authored
-
Simon Peyton Jones authored
-
- 15 May, 2014 1 commit
-
-
Herbert Valerio Riedel authored
In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
-
- 06 May, 2014 1 commit
-
-
Simon Peyton Jones authored
See TypeRep.pprUserForAll. This just makes forall-printing a bit more consistent. In particular, I wasn't seeing the kind foralls when displaying a CoAxiom or CoAxBranch The output on T7939 is just possible a bit too verbose now, but even if so that's an error in the right direction.
-
- 17 Mar, 2014 1 commit
-
-
Simon Peyton Jones authored
-
- 01 Feb, 2014 1 commit
-
-
Gabor Greif authored
-
- 27 Nov, 2013 2 commits
-
-
Joachim Breitner authored
and use EvCoercion to describe the evidence for Coercible instances.
-
Joachim Breitner authored
Previously, TcCoercion were only used to represent boxed Nominal coercions. In order to also talk about boxed Representational coercions in the type checker, we add Roles to TcCoercion. Again, we closely mirror Coercion. The roles are verified by a few assertions, and at the latest after conversion to Coercion. I have put my trust in the comprehensiveness of the testsuite here, but any role error after desugaring popping up now might be caused by this refactoring.
-
- 22 Nov, 2013 2 commits
-
-
Simon Peyton Jones authored
We were re-using the super-magical "state token" type (which has VoidRep and is zero bits wide) for situations in which we simply want to lambda-abstract over a zero-bit argument. For example, join points: case (case x of { True -> e1; False -> e2 }) of Red -> f1 Blue -> True ==> let $j1 = \voidArg::Void# -> f1 in case x of True -> case e1 of Red -> $j1 void Blue -> True False -> case e2 of Red -> $j1 void Blue -> True This patch introduces * The new primitive type GHC.Prim.Void#, with PrimRep = VoidRep * A new global Id GHC.Prim.voidPrimId :: Void#. This has no binding because the code generator drops it, but is used as an argument (eg in the call of $j1) * A new local Id, MkId.voidArgId, which can be lambda-bound when you need to lambda-abstract over it. and uses them throughout. Now the State# thing is used only when we need state!
-
Simon Peyton Jones authored
For horrible reasons (Note [Comparison with OpenTypeKind] in Type), the function Type.eqType currently equates OOpenKind with *. This may or may not be a good idea (it's certainly a revolting one) but it DOES NOT WORK in the type checker, which *does* need to distinguish OpenKind and *. Rather than solve the underlying problem (I have some ideas) I just introduced a new, and very short, simple, straightforward function TcType.tcEqType to do the job.
-
- 20 Nov, 2013 1 commit
-
-
Joachim Breitner authored
otherwise we get a panic.
-
- 12 Oct, 2013 1 commit
-
-
Krzysztof Gogolewski authored
-
- 01 Oct, 2013 1 commit
-
-
Simon Marlow authored
-
- 20 Sep, 2013 1 commit
-
-
Simon Peyton Jones authored
-
- 13 Sep, 2013 1 commit
-
-
Joachim Breitner authored
and add related function tyConsOfTyCon.
-
- 08 Sep, 2013 1 commit
-
-
nfrisby authored
also added -fdmd-tx-dict-sel, on by default
-
- 02 Sep, 2013 1 commit
-
-
Simon Peyton Jones authored
This is a lingering bug from the introduction of polymorphic kinds. In the specialiser we were specialising over a type, but failing to specialise over the kinds it mentions. The fix is simple: add a call to closeOverKinds. Most of the patch is to add closeOverKinds, and to use it in a few other places where we are doing essentially the same thing.
-
- 02 Aug, 2013 1 commit
-
-
eir@cis.upenn.edu authored
Roles are a solution to the GeneralizedNewtypeDeriving type-safety problem. Roles were first described in the "Generative type abstraction" paper, by Stephanie Weirich, Dimitrios Vytiniotis, Simon PJ, and Steve Zdancewic. The implementation is a little different than that paper. For a quick primer, check out Note [Roles] in Coercion. Also see http://ghc.haskell.org/trac/ghc/wiki/Roles and http://ghc.haskell.org/trac/ghc/wiki/RolesImplementation For a more formal treatment, check out docs/core-spec/core-spec.pdf. This fixes Trac #1496, #4846, #7148.
-
- 11 Jun, 2013 1 commit
-
-
Simon Peyton Jones authored
I reverted it to try something else and forgot to put it back! Fixes Trac #7272 (again!).
-
- 10 Jun, 2013 1 commit
-
-
Simon Peyton Jones authored
Reported in Trac #7272. "tv1" should be "tv2"! However, things weren't as simple as they sound, because treating (x:Open) as different from (x:*) gave rise to new failures; see Note [Comparison with OpenTypeKind] in Type. My hacky solution is to treat OpenKind as equal to * and #, at least in Core etc. Hence the faff in Type.cmpTc. I do not like this. But it seems like another messy consequence of including sub-kinding. Sigh.
-
- 06 Jun, 2013 1 commit
-
-
Simon Peyton Jones authored
This just formalises an abstraction we've been using anyway, namely to expand "recursive" TyCons until we see them twice. We weren't doing this in typeArity, and that inconsistency was leading to a subsequent ASSERT failure, when compiling Stream.hs, which has a newtype like this newtype Stream m a b = Stream (m (Either b (a, Stream m a b)))
-
- 30 May, 2013 1 commit
-
-
Simon Peyton Jones authored
Finally (I hope) fixes Trac #7903. See Note [Zonking inside the knot] in TcHsSyn
-
- 03 May, 2013 1 commit
-
-
Simon Peyton Jones authored
The pretty-printer uses isPredTy to decide whether to use "=>" or "->", and typeKind crashes on ill-kinded types. But it's really unhelpful for the pretty-printer to crash on an ill-kinded type, because then you can't see it!
-
- 06 Apr, 2013 1 commit
-
-
ian@well-typed.com authored
-
- 15 Feb, 2013 1 commit
-
-
Iavor S. Diatchki authored
This is needed to make things like this work: type N = 9 myValue = fromSing (sing :: Sing N) If we don't look trough the synonym, we get an error that `SingI N` can't be solved.
-
- 28 Jan, 2013 1 commit
-
-
Simon Peyton Jones authored
* Move tidyType and friends from TcType to TypeRep (It was always wrong to have it in TcType.) * Move mkCoAxBranch and friends from FamInst to Coercion * Move pprCoAxBranch and friends from FamInstEnv to Coercion No change in functionality, though there might be a little wibble in error message output, because I combined two different functions both called pprCoAxBranch!
-
- 25 Jan, 2013 1 commit
-
-
Simon Peyton Jones authored
-
- 24 Jan, 2013 1 commit
-
-
Simon Peyton Jones authored
The main payload of this patch is to extend CPR so that it detects when a function always returns a result constructed with the *same* constructor, even if the constructor comes from a sum type. This doesn't matter very often, but it does improve some things (results below). Binary sizes increase a little bit, I think because there are more wrappers. This with -split-objs. Without split-ojbs binary sizes increased by 6% even for HelloWorld.hs. It's hard to see exactly why, but I think it was because System.Posix.Types.o got included in the linked binary, whereas it didn't before. Program Size Allocs Runtime Elapsed TotalMem fluid +1.8% -0.3% 0.01 0.01 +0.0% tak +2.2% -0.2% 0.02 0.02 +0.0% ansi +1.7% -0.3% 0.00 0.00 +0.0% cacheprof +1.6% -0.3% +0.6% +0.5% +1.4% parstof +1.4% -4.4% 0.00 0.00 +0.0% reptile +2.0% +0.3% 0.02 0.02 +0.0% ---------------------------------------------------------------------- Min +1.1% -4.4% -4.7% -4.7% -15.0% Max +2.3% +0.3% +8.3% +9.4% +50.0% Geometric Mean +1.9% -0.1% +0.6% +0.7% +0.3% Other things in this commit ~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Got rid of the Lattice class in Demand * Refactored the way that products and newtypes are decomposed (no change in functionality)
-
- 22 Dec, 2012 1 commit
-
-
eir@cis.upenn.edu authored
An ordered, overlapping type family instance is introduced by 'type instance where', followed by equations. See the new section in the user manual (7.7.2.2) for details. The canonical example is Boolean equality at the type level: type family Equals (a :: k) (b :: k) :: Bool type instance where Equals a a = True Equals a b = False A branched family instance, such as this one, checks its equations in order and applies only the first the matches. As explained in the note [Instance checking within groups] in FamInstEnv.lhs, we must be careful not to simplify, say, (Equals Int b) to False, because b might later unify with Int. This commit includes all of the commits on the overlapping-tyfams branch. SPJ requested that I combine all my commits over the past several months into one monolithic commit. The following GHC repos are affected: ghc, testsuite, utils/haddock, libraries/template-haskell, and libraries/dph. Here are some details for the interested: - The definition of CoAxiom has been moved from TyCon.lhs to a new file CoAxiom.lhs. I made this decision because of the number of definitions necessary to support BranchList. - BranchList is a GADT whose type tracks whether it is a singleton list or not-necessarily-a-singleton-list. The reason I introduced this type is to increase static checking of places where GHC code assumes that a FamInst or CoAxiom is indeed a singleton. This assumption takes place roughly 10 times throughout the code. I was worried that a future change to GHC would invalidate the assumption, and GHC might subtly fail to do the right thing. By explicitly labeling CoAxioms and FamInsts as being Unbranched (singleton) or Branched (not-necessarily-singleton), we make this assumption explicit and checkable. Furthermore, to enforce the accuracy of this label, the list of branches of a CoAxiom or FamInst is stored using a BranchList, whose constructors constrain its type index appropriately. I think that the decision to use BranchList is probably the most controversial decision I made from a code design point of view. Although I provide conversions to/from ordinary lists, it is more efficient to use the brList... functions provided in CoAxiom than always to convert. The use of these functions does not wander far from the core CoAxiom/FamInst logic. BranchLists are motivated and explained in the note [Branched axioms] in CoAxiom.lhs. - The CoAxiom type has changed significantly. You can see the new type in CoAxiom.lhs. It uses a CoAxBranch type to track branches of the CoAxiom. Correspondingly various functions producing and consuming CoAxioms had to change, including the binary layout of interface files. - To get branched axioms to work correctly, it is important to have a notion of type "apartness": two types are apart if they cannot unify, and no substitution of variables can ever get them to unify, even after type family simplification. (This is different than the normal failure to unify because of the type family bit.) This notion in encoded in tcApartTys, in Unify.lhs. Because apartness is finer-grained than unification, the tcUnifyTys now calls tcApartTys. - CoreLinting axioms has been updated, both to reflect the new form of CoAxiom and to enforce the apartness rules of branch application. The formalization of the new rules is in docs/core-spec/core-spec.pdf. - The FamInst type (in types/FamInstEnv.lhs) has changed significantly, paralleling the changes to CoAxiom. Of course, this forced minor changes in many files. - There are several new Notes in FamInstEnv.lhs, including one discussing confluent overlap and why we're not doing it. - lookupFamInstEnv, lookupFamInstEnvConflicts, and lookup_fam_inst_env' (the function that actually does the work) have all been more-or-less completely rewritten. There is a Note [lookup_fam_inst_env' implementation] describing the implementation. One of the changes that affects other files is to change the type of matches from a pair of (FamInst, [Type]) to a new datatype (which now includes the index of the matching branch). This seemed a better design. - The TySynInstD constructor in Template Haskell was updated to use the new datatype TySynEqn. I also bumped the TH version number, requiring changes to DPH cabal files. (That's why the DPH repo has an overlapping-tyfams branch.) - As SPJ requested, I refactored some of the code in HsDecls: * splitting up TyDecl into SynDecl and DataDecl, correspondingly changing HsTyDefn to HsDataDefn (with only one constructor) * splitting FamInstD into TyFamInstD and DataFamInstD and splitting FamInstDecl into DataFamInstDecl and TyFamInstDecl * making the ClsInstD take a ClsInstDecl, for parallelism with InstDecl's other constructors * changing constructor TyFamily into FamDecl * creating a FamilyDecl type that stores the details for a family declaration; this is useful because FamilyDecls can appear in classes but other decls cannot * restricting the associated types and associated type defaults for a * class to be the new, more restrictive types * splitting cid_fam_insts into cid_tyfam_insts and cid_datafam_insts, according to the new types * perhaps one or two more that I'm overlooking None of these changes has far-reaching implications. - The user manual, section 7.7.2.2, is updated to describe the new type family instances.
-
- 19 Dec, 2012 2 commits
-
-
Simon Peyton Jones authored
-
Simon Peyton Jones authored
They properly belong in TysWiredIn, since they are defined in Haskell in GHC.TypeLits. Moveover, make them WiredIn (again as they should be) and use checkWiredInTyCon when encountering them in TcHsType.tc_hs_type, so that the interface file is loaded. This fixes Trac #7502.
-
- 01 Dec, 2012 2 commits
-
-
Simon Peyton Jones authored
-
eir@cis.upenn.edu authored
As per a request from Simon PJ, I wrote up a formalism of the core language in GHC, System FC. The writeup lives in docs/core-spec. I also added comments to a number of files dealing with the core language reminding authors to update the formalism when updating the code. In the next commit will be a README file in docs/core-spec with more details of how to do this.
-
- 26 Nov, 2012 1 commit
-
-
Simon Peyton Jones authored
Fixes Trac #7451. See Note [Kind Constraint and kind *] in Kind.lhs.
-
- 02 Oct, 2012 1 commit
-
-
Simon Peyton Jones authored
This is just a bug that's been around since we introduced polymorphic kinds. The roots are in Type.cmpTypeX, but there was a variant in TcRnDriver.checkBootTyCon, which is where it came up. Fixes Trac #7272
-
- 17 Sep, 2012 1 commit
-
-
Simon Peyton Jones authored
This single commit combines a lot of work done by Thijs Alkemade <thijsalkemade@gmail.com>, 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").
-
- 15 Sep, 2012 1 commit
-
-
Simon Peyton Jones authored
When converting from Core to STG, we swith pattern matching on on a *nullary* unboxed tuple into matching using a PrimAlt on RealWorld# case e (RealWorld#) of { DEFAULT -> ... } This semms messy to me, but it works. There was a bug in that we were changing to PrimAlt, but not using a DEFAULT AltCon.
-
- 29 Aug, 2012 1 commit
-
-
Simon Peyton Jones authored
-
- 20 Jul, 2012 1 commit
-
-
Simon Peyton Jones authored
-
- 15 Jul, 2012 1 commit
-
-
Ian Lynagh authored
-