summaryrefslogtreecommitdiff
path: root/compiler/utils/UniqSet.hs
Commit message (Collapse)AuthorAgeFilesLines
* Modern type signature style in UniqSetBartosz Nitka2017-05-291-76/+71
|
* Add an Eq instance for UniqSetDavid Feuer2017-05-041-0/+6
| | | | | | | | | | | | | I left that out by mistake, and it apparently breaks at least one existing plugin. Reviewers: christiaanb, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3518
* Upgrade UniqSet to a newtypeDavid Feuer2017-03-011-25/+103
| | | | | | | | | | | | | | | | | | | | | The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet` has a key invariant `UniqFM` does not. For example, `fmap` over `UniqSet` will generally produce nonsense. * Upgrade `UniqSet` from a type synonym to a newtype. * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`. * Use cached unique in `tyConsOfType` by replacing `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`. Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3146
* UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldrBen Gamari2017-01-241-4/+4
| | | | | | | | | | | | | | | | | | | | foldr generally isn't a good choice for folds where the result can't be consumed incrementally. This gives a very modest improvement in compiler allocations, ``` -1 s.d. ----- -0.182% +1 s.d. ----- -0.050% Average ----- -0.116% ``` This is clearly semantics-preserving since we are constructing a set. Test Plan: Validate Reviewers: austin Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2965
* Remove uniqSetToListBartosz Nitka2016-07-011-3/+0
| | | | | | | This documents nondeterminism in code generation and removes the nondeterministic ufmToList function. In the future someone will have to use nonDetEltsUFM (with proper explanation) or pprUFM.
* Kill foldUniqSetBartosz Nitka2016-06-061-3/+1
| | | | | | | | | | | | | | | I planned to just say that we don't care about this part. Turns out I was able to document away the uses in the codegenerator. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2307 GHC Trac Issues: #4012
* Kill mapUniqSetBartosz Nitka2016-04-281-3/+9
| | | | | | | | | | | | | | Note [Unsound mapUniqSet] explains why it got removed. Test Plan: build ghc Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2152
* Add uniqSetAny and uniqSetAll and use themBartosz Nitka2016-04-281-1/+7
| | | | | | | | | | | | | | | | | | There are couple of places where we do `foldUniqSet` just to compute `any` or `all`. `foldUniqSet` is non-deterministic in the general case and `any` and `all` also read nicer. Test Plan: ./validate Reviewers: simonmar, goldfire, simonpj, bgamari, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2156 GHC Trac Issues: #4012
* Add kind equalities to GHC.Richard Eisenberg2015-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the ideas originally put forward in "System FC with Explicit Kind Equality" (ICFP'13). There are several noteworthy changes with this patch: * We now have casts in types. These change the kind of a type. See new constructor `CastTy`. * All types and all constructors can be promoted. This includes GADT constructors. GADT pattern matches take place in type family equations. In Core, types can now be applied to coercions via the `CoercionTy` constructor. * Coercions can now be heterogeneous, relating types of different kinds. A coercion proving `t1 :: k1 ~ t2 :: k2` proves both that `t1` and `t2` are the same and also that `k1` and `k2` are the same. * The `Coercion` type has been significantly enhanced. The documentation in `docs/core-spec/core-spec.pdf` reflects the new reality. * The type of `*` is now `*`. No more `BOX`. * Users can write explicit kind variables in their code, anywhere they can write type variables. For backward compatibility, automatic inference of kind-variable binding is still permitted. * The new extension `TypeInType` turns on the new user-facing features. * Type families and synonyms are now promoted to kinds. This causes trouble with parsing `*`, leading to the somewhat awkward new `HsAppsTy` constructor for `HsType`. This is dispatched with in the renamer, where the kind `*` can be told apart from a type-level multiplication operator. Without `-XTypeInType` the old behavior persists. With `-XTypeInType`, you need to import `Data.Kind` to get `*`, also known as `Type`. * The kind-checking algorithms in TcHsType have been significantly rewritten to allow for enhanced kinds. * The new features are still quite experimental and may be in flux. * TODO: Several open tickets: #11195, #11196, #11197, #11198, #11203. * TODO: Update user manual. Tickets addressed: #9017, #9173, #7961, #10524, #8566, #11142. Updates Haddock submodule.
* Remove redundant constraints in the compiler itself, found by ↵Simon Peyton Jones2015-01-061-1/+1
| | | | -fwarn-redundant-constraints
* compiler: de-lhs utils/Austin Seipp2014-12-031-0/+115
Signed-off-by: Austin Seipp <austin@well-typed.com>