 21 Jan, 2019 1 commit


Sylvain Henry authored

 18 Jan, 2019 1 commit


Herbert Valerio Riedel authored

 18 Sep, 2018 1 commit


Shayne Fletcher authored
PR: https://github.com/ghc/ghc/pull/184

 14 Jun, 2018 1 commit


Vladislav Zavialov authored
Summary: Implement the "Embrace Type :: Type" GHC proposal, .../ghcproposals/blob/master/proposals/0020notypeintype.rst GHC 8.0 included a major change to GHC's type system: the Type :: Type axiom. Though casual users were protected from this by hiding its features behind the XTypeInType extension, all programs written in GHC 8+ have the axiom behind the scenes. In order to preserve backward compatibility, various legacy features were left unchanged. For example, with XDataKinds but not XTypeInType, GADTs could not be used in types. Now these restrictions are lifted and XTypeInType becomes a redundant flag that will be eventually deprecated. * Incorporate the features currently in XTypeInType into the XPolyKinds and XDataKinds extensions. * Introduce a new extension XStarIsType to control how to parse * in code and whether to print it in error messages. Test Plan: Validate Reviewers: goldfire, hvr, bgamari, alanz, simonpj Reviewed By: goldfire, simonpj Subscribers: rwbarton, thomie, mpickering, carter GHC Trac Issues: #15195 Differential Revision: https://phabricator.haskell.org/D4748

 05 Jun, 2018 1 commit


Ryan Scott authored
This implements the `DerivingVia` proposal put forth in https://github.com/ghcproposals/ghcproposals/pull/120. This introduces the `DerivingVia` deriving strategy. This is a generalization of `GeneralizedNewtypeDeriving` that permits the user to specify the type to `coerce` from. The major change in this patch is the introduction of the `ViaStrategy` constructor to `DerivStrategy`, which takes a type as a field. As a result, `DerivStrategy` is no longer a simple enumeration type, but rather something that must be renamed and typechecked. The process by which this is done is explained more thoroughly in section 3 of this paper ( https://www.kosmikus.org/DerivingVia/derivingviapaper.pdf ), although I have inlined the relevant parts into Notes where possible. There are some knockon changes as well. I took the opportunity to do some refactoring of code in `TcDeriv`, especially the `mkNewTypeEqn` function, since it was bundling all of the logic for (1) deriving instances for newtypes and (2) `GeneralizedNewtypeDeriving` into one huge broth. `DerivingVia` reuses much of part (2), so that was factored out as much as possible. Bumps the Haddock submodule. Test Plan: ./validate Reviewers: simonpj, bgamari, goldfire, alanz Subscribers: alanz, goldfire, rwbarton, thomie, mpickering, carter GHC Trac Issues: #15178 Differential Revision: https://phabricator.haskell.org/D4684

 04 Jun, 2018 1 commit


Simon Peyton Jones authored
We have wanted quantified constraints for ages and, as I hoped, they proved remarkably simple to implement. All the machinery was already in place. The main ticket is Trac #2893, but also relevant are #5927 #8516 #9123 (especially! higher kinded roles) #14070 #14317 The wiki page is https://ghc.haskell.org/trac/ghc/wiki/QuantifiedConstraints which in turn contains a link to the GHC Proposal where the change is specified. Here is the relevant Note: Note [Quantified constraints] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The XQuantifiedConstraints extension allows typeclass contexts like this: data Rose f x = Rose x (f (Rose f x)) instance (Eq a, forall b. Eq b => Eq (f b)) => Eq (Rose f a) where (Rose x1 rs1) == (Rose x2 rs2) = x1==x2 && rs1 >= rs2 Note the (forall b. Eq b => Eq (f b)) in the instance contexts. This quantified constraint is needed to solve the [W] (Eq (f (Rose f x))) constraint which arises form the (==) definition. Here are the moving parts * Language extension {# LANGUAGE QuantifiedConstraints #} and add it to ghcbootth:GHC.LanguageExtensions.Type.Extension * A new form of evidence, EvDFun, that is used to discharge such wanted constraints * checkValidType gets some changes to accept forallconstraints only in the right places. * Type.PredTree gets a new constructor ForAllPred, and and classifyPredType analyses a PredType to decompose the new forallconstraints * Define a type TcRnTypes.QCInst, which holds a given quantified constraint in the inert set * TcSMonad.InertCans gets an extra field, inert_insts :: [QCInst], which holds all the Given forallconstraints. In effect, such Given constraints are like local instance decls. * When trying to solve a class constraint, via TcInteract.matchInstEnv, use the InstEnv from inert_insts so that we include the local Given forallconstraints in the lookup. (See TcSMonad.getInstEnvs.) * topReactionsStage calls doTopReactOther for CIrredCan and CTyEqCan, so they can try to react with any given quantified constraints (TcInteract.matchLocalInst) * TcCanonical.canForAll deals with solving a forallconstraint. See Note [Solving a Wanted forallconstraint] Note [Solving a Wanted forallconstraint] * We augment the kickout code to kick out an inert forall constraint if it can be rewritten by a new type equality; see TcSMonad.kick_out_rewritable Some other related refactoring ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Move SCC on evidence bindings to postdesugaring, which fixed #14735, and is generally nicer anyway because we can use existing CoreSyn freevar functions. (Quantified constraints made the freevars of an evterm a bit more complicated.) * In LookupInstResult, replace GenInst with OneInst and NotSure, using the latter for multiple matches and/or one or more unifiers

 19 Apr, 2018 1 commit


Ryan Scott authored
Summary: Bumps several submodules. Test Plan: ./validate Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: thomie, carter GHC Trac Issues: #15018 Differential Revision: https://phabricator.haskell.org/D4609

 25 Mar, 2018 1 commit


Alec Theriault authored
The user facing TH interface changes are: * 'addForeignFile' is renamed to 'addForeignSource' * 'qAddForeignFile'/'addForeignFile' now expect 'FilePath's * 'RawObject' is now a constructor for 'ForeignSrcLang' * 'qAddTempFile'/'addTempFile' let you request a temporary file from the compiler. Test Plan: unsure about this, added a TH test Reviewers: goldfire, bgamari, angerman Reviewed By: bgamari, angerman Subscribers: hsyl20, mboes, carter, simonmar, bitonic, ljli, rwbarton, thomie GHC Trac Issues: #14298 Differential Revision: https://phabricator.haskell.org/D4217

 01 Feb, 2018 1 commit


takanoakio authored
This patch implements the BlockArguments extension, as proposed at https://github.com/ghcproposals/ghcproposals/pull/90. It also fixes #10855 as a sideeffect. This patch adds a large number of shiftreduce conflicts to the parser. All of them concern the ambiguity as to where constructs like `if` and `let` end. Fortunately they are resolved correctly by preferring shift. The patch is based on @gibiansky's ArgumentDo implementation (D1219). Test Plan: ./validate Reviewers: goldfire, bgamari, alanz, mpickering Reviewed By: bgamari, mpickering Subscribers: Wizek, dfeuer, gibiansky, rwbarton, thomie, mpickering, carter GHC Trac Issues: #10843, #10855 Differential Revision: https://phabricator.haskell.org/D4260

 21 Jan, 2018 1 commit


Takenobu Tani authored
Implement the proposal of underscores in numeric literals. Underscores in numeric literals are simply ignored. The specification of the feature is available here: https://github.com/ghcproposals/ghcproposals/blob/master/proposals/000 9numericunderscores.rst For a discussion of the various choices: https://github.com/ghcproposals/ghcproposals/pull/76 Implementation detail: * Added dynamic flag * `NumericUnderscores` extension flag is added for this feature. * Alex "Regular expression macros" in Lexer.x * Add `@numspc` (numeric spacer) macro to represent multiple underscores. * Modify `@decimal`, `@decimal`, `@binary`, `@octal`, `@hexadecimal`, `@exponent`, and `@bin_exponent` macros to include `@numspc`. * Alex "Rules" in Lexer.x * To be simpler, we have only the definitions with underscores. And then we have a separate function (`tok_integral` and `tok_frac`) that validates the literals. * Validation functions in Lexer.x * `tok_integral` and `tok_frac` functions validate whether contain underscores or not. If `NumericUnderscores` extensions are not enabled, check that there are no underscores. * `tok_frac` function is created by merging `strtoken` and `init_strtoken`. * `init_strtoken` is deleted. Because it is no longer used. * Remove underscores from target literal string * `parseUnsignedInteger`, `readRational__`, and `readHexRational} use the customized `span'` function to remove underscores. * Added Testcase * testcase for NumericUnderscores enabled. NumericUnderscores0.hs and NumericUnderscores1.hs * testcase for NumericUnderscores disabled. NoNumericUnderscores0.hs and NoNumericUnderscores1.hs * testcase to invalid pattern for NumericUnderscores enabled. NumericUnderscoresFail0.hs and NumericUnderscoresFail1.hs Test Plan: `validate` including the above testcase Reviewers: goldfire, bgamari Reviewed By: bgamari Subscribers: carter, rwbarton, thomie GHC Trac Issues: #14473 Differential Revision: https://phabricator.haskell.org/D4235

 02 Nov, 2017 2 commits


Iavor S. Diatchki authored
Implement hexadecmial floating point literals. The digits of the mantissa are hexadecimal. The exponent is written in base 10, and the base for the exponentiation is 2. Hexadecimal literals look a lot like ordinary decimal literals, except that they use hexadecmial digits, and the exponent is written using `p` rather than `e`. The specification of the feature is available here: https://github.com/ghcproposals/ghcproposals/blob/master/proposals/0004hexFloats.rst For a discussion of the various choices: https://github.com/ghcproposals/ghcproposals/pull/37 Reviewers: mpickering, goldfire, austin, bgamari, hvr Reviewed By: bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D3066

Ryan Scott authored
This implements the `EmptyDataDeriving` proposal put forth in https://github.com/ghcproposals/ghcproposals/blob/dbf51608/proposals/0006derivingempty.rst. This has two major changes: * The introduction of an `EmptyDataDeriving` extension, which permits directly deriving `Eq`, `Ord`, `Read`, and `Show` instances for empty data types. * An overhaul in the code that is emitted in derived instances for empty data types. To see an overview of the changes brought forth, refer to the changes to the 8.4.1 release notes. Test Plan: ./validate Reviewers: bgamari, dfeuer, austin, hvr, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #7401, #10577, #13117 Differential Revision: https://phabricator.haskell.org/D4047

 21 Sep, 2017 1 commit


Ben Gamari authored
Bumps numerous submodules. Reviewers: austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3974

 09 Mar, 2017 1 commit


bitonic authored
The main goal is to easily allow the inlinec project (and similar projects such as inlinejava) to emit C/C++ files to be compiled and linked with the current module. Moreover, `addCStub` is removed, since it's quite fragile. Most notably, the C stubs end up in the file generated by `CodeOutput.outputForeignStubs`, which is tuned towards generating a file for stubs coming from `capi` and HaskelltoC exports. Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes Differential Revision: https://phabricator.haskell.org/D3280

 15 Dec, 2016 1 commit


Ben Gamari authored
Updates a number of submodules.

 01 Oct, 2016 1 commit


Ryan Scott authored
Allows users to explicitly request which approach to `deriving` to use via keywords, e.g., ``` newtype Foo = Foo Bar deriving Eq deriving stock Ord deriving newtype Show ``` Fixes #10598. Updates haddock submodule. Test Plan: ./validate Reviewers: hvr, kosmikus, goldfire, alanz, bgamari, simonpj, austin, erikd, simonmar Reviewed By: alanz, bgamari, simonpj Subscribers: thomie, mpickering, oerjan Differential Revision: https://phabricator.haskell.org/D2280 GHC Trac Issues: #10598

 01 Sep, 2016 3 commits


Malo Jaffré authored
startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghcbootth for reducing duplication. This patch fixes templatehaskell pretty printer, which is used by ddumpminimalimports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239

Ben Gamari authored
This reverts commit 8d35e18d. arc butchered the authorship on this.

Ben Gamari authored
startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghcbootth for reducing duplication. This patch fixes templatehaskell pretty printer, which is used by ddumpminimalimports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239

 21 Jul, 2016 1 commit


Ömer Sinan Ağacan authored
Summary: This patch implements primitive unboxed sum types, as described in https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes. Main changes are:  Add new syntax for unboxed sums types, terms and patterns. Hidden behind `XUnboxedSums`.  Add unlifted unboxed sum type constructors and data constructors, extend type and pattern checkers and desugarer.  Add new RuntimeRep for unboxed sums.  Extend unarise pass to translate unboxed sums to unboxed tuples right before code generation.  Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better code generation when sum values are involved.  Add user manual section for unboxed sums. Some other changes:  Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to `MultiValAlt` to be able to use those with both sums and tuples.  Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really wrong, given an `Any` `TyCon`, there's no way to tell what its kind is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.  Fix some bugs on the way: #12375. Not included in this patch:  Update Haddock for new the new unboxed sum syntax.  `TemplateHaskell` support is left as future work. For reviewers:  Frontend code is mostly trivial and adapted from unboxed tuple code for type checking, pattern checking, renaming, desugaring etc.  Main translation routines are in `RepType` and `UnariseStg`. Documentation in `UnariseStg` should be enough for understanding what's going on. Credits:  Johan Tibell wrote the initial frontend and interface file extensions.  Simon Peyton Jones reviewed this patch many times, wrote some code, and helped with debugging. Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin, simonmar, hvr, erikd Reviewed By: simonpj Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2259

 16 May, 2016 1 commit


Ben Gamari authored
This creates a new package, `ghcbootth`, to contain the `Extension` type, which now lives in `GHC.LanguageExtension.Type`. This ensures that the transitive dependency set of the `templatehaskell` package remains minimal. The `GHC.LanguageExtensions.Type` module is also reexported by `ghcboot`, which provides an orphan `binary` instance as well. Test Plan: Validate Reviewers: goldfire, thomie, hvr, austin Reviewed By: thomie Subscribers: RyanGlScott, thomie, erikd, ezyang Differential Revision: https://phabricator.haskell.org/D2224
