summaryrefslogtreecommitdiff
path: root/compiler/specialise/Rules.hs
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-05-24 02:56:59 -0700
committerBartosz Nitka <niteria@gmail.com>2016-05-24 04:33:21 -0700
commit4c6e69d58a300d6ef440d326a3fd29b58b284fa1 (patch)
tree6653f56c150c3aa988a96c50359d53f27f2edb01 /compiler/specialise/Rules.hs
parent8f7d01632cd79957fe42ea37103ca9b91a1c54f5 (diff)
downloadhaskell-4c6e69d58a300d6ef440d326a3fd29b58b284fa1.tar.gz
Document some benign nondeterminism
I've changed the functions to their nonDet equivalents and explained why they're OK there. This allowed me to remove foldNameSet, foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly. Test Plan: ./validate, there should be no change in behavior Reviewers: simonpj, simonmar, austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2244 GHC Trac Issues: #4012
Diffstat (limited to 'compiler/specialise/Rules.hs')
-rw-r--r--compiler/specialise/Rules.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs
index aebfbc744e..e11de97902 100644
--- a/compiler/specialise/Rules.hs
+++ b/compiler/specialise/Rules.hs
@@ -568,7 +568,9 @@ matchN (in_scope, id_unf) rule_name tmpl_vars tmpl_es target_es
kind = Type.substTy (mkTCvSubst in_scope (tv_subst, cv_subst))
(tyVarKind tmpl_var)
- to_co_env env = foldVarEnv_Directly to_co emptyVarEnv env
+ to_co_env env = nonDetFoldUFM_Directly to_co emptyVarEnv env
+ -- It's OK to use nonDetFoldUFM_Directly because we forget the
+ -- order immediately by creating a new env
to_co uniq expr env
| Just co <- exprToCoercion_maybe expr
= extendVarEnv_Directly env uniq co