From 5c9c3660697f18ae9dcd95e254249d3dd908b94e Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Mon, 3 Jul 2006 15:15:17 +0000 Subject: [PATCH] The dict-bindings in an IPBinds need not be in dependency order This appears to be a long-standing bug, discovered by BlueSpec (ravi@bluespec.com), Trac bug #795 The problem was that in an IP binding group, the dict bindings aren't necessarily in dependency order; and if they aren't we get a core-lint error. Test tc203 checks this case. (Though whether it shows up at all depends a bit on accidental factors of binding ordering.) --- compiler/deSugar/DsExpr.lhs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/DsExpr.lhs b/compiler/deSugar/DsExpr.lhs index f7b232c..5fb0ec8 100644 --- a/compiler/deSugar/DsExpr.lhs +++ b/compiler/deSugar/DsExpr.lhs @@ -85,7 +85,9 @@ dsValBinds (ValBindsOut binds _) body = foldrDs ds_val_bind body binds ------------------------- dsIPBinds (IPBinds ip_binds dict_binds) body = do { prs <- dsLHsBinds dict_binds - ; let inner = foldr (\(x,r) e -> Let (NonRec x r) e) body prs + ; let inner = Let (Rec prs) body + -- The dict bindings may not be in + -- dependency order; hence Rec ; foldrDs ds_ip_bind inner ip_binds } where ds_ip_bind (L _ (IPBind n e)) body -- 1.7.10.4