From 2325bd4e0fad0e5872556c5a78d1a6a1873e7201 Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Sat, 21 Nov 2015 15:57:09 +0100 Subject: Create a deterministic version of tyVarsOfType I've run into situations where I need deterministic `tyVarsOfType` and this implementation achieves that and also brings an algorithmic improvement. Union of two `VarSet`s takes linear time the size of the sets and in the worst case we can have `n` unions of sets of sizes `(n-1, 1), (n-2, 1)...` making it quadratic. One reason why we need deterministic `tyVarsOfType` is in `abstractVars` in `SetLevels`. When we abstract type variables when floating we want them to be abstracted in deterministic order. Test Plan: harbormaster Reviewers: simonpj, goldfire, austin, hvr, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1468 GHC Trac Issues: #4012 --- testsuite/tests/polykinds/T9222.stderr | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'testsuite/tests/polykinds') diff --git a/testsuite/tests/polykinds/T9222.stderr b/testsuite/tests/polykinds/T9222.stderr index 1d1a1df779..a5b35ee2b1 100644 --- a/testsuite/tests/polykinds/T9222.stderr +++ b/testsuite/tests/polykinds/T9222.stderr @@ -1,24 +1,24 @@ - -T9222.hs:13:3: error: - Couldn't match type ‘b0’ with ‘b’ - ‘b0’ is untouchable - inside the constraints: a ~ '(b0, c0) - bound by the type of the constructor ‘Want’: - (a ~ '(b0, c0)) => Proxy b0 - at T9222.hs:13:3 - ‘b’ is a rigid type variable bound by - the type of the constructor ‘Want’: - ((a ~ '(b, c)) => Proxy b) -> Want a - at T9222.hs:13:3 - Expected type: '(b, c) - Actual type: a - In the ambiguity check for the type of the constructor ‘Want’: - Want :: forall (k :: BOX) - (k1 :: BOX) - (a :: (,) k k1) - (b :: k) - (c :: k1). - ((a ~ '(b, c)) => Proxy b) -> Want a - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the definition of data constructor ‘Want’ - In the data type declaration for ‘Want’ + +T9222.hs:13:3: error: + Couldn't match type ‘b0’ with ‘b’ + ‘b0’ is untouchable + inside the constraints: a ~ '(b0, c0) + bound by the type of the constructor ‘Want’: + (a ~ '(b0, c0)) => Proxy b0 + at T9222.hs:13:3 + ‘b’ is a rigid type variable bound by + the type of the constructor ‘Want’: + ((a ~ '(b, c)) => Proxy b) -> Want a + at T9222.hs:13:3 + Expected type: '(b, c) + Actual type: a + In the ambiguity check for the type of the constructor ‘Want’: + Want :: forall (k :: BOX) + (k1 :: BOX) + (a :: (,) k k1) + (b :: k) + (c :: k1). + ((a ~ '(b, c)) => Proxy b) -> Want a + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + In the definition of data constructor ‘Want’ + In the data type declaration for ‘Want’ -- cgit v1.2.1