projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
62c2f62
)
Monadify iface/IfaceEnv: use do, return and standard monad functions
author
Twan van Laarhoven
<twanvl@gmail.com>
Thu, 17 Jan 2008 21:40:41 +0000
(21:40 +0000)
committer
Twan van Laarhoven
<twanvl@gmail.com>
Thu, 17 Jan 2008 21:40:41 +0000
(21:40 +0000)
compiler/iface/IfaceEnv.lhs
patch
|
blob
|
history
diff --git
a/compiler/iface/IfaceEnv.lhs
b/compiler/iface/IfaceEnv.lhs
index
4d7c611
..
ce90c8c
100644
(file)
--- a/
compiler/iface/IfaceEnv.lhs
+++ b/
compiler/iface/IfaceEnv.lhs
@@
-139,7
+139,7
@@
lookupAvail mod (AvailTC p_occ occs) = do
p_name <- lookupOrig mod p_occ
let lookup_sub occ | occ == p_occ = return p_name
| otherwise = lookupOrig mod occ
p_name <- lookupOrig mod p_occ
let lookup_sub occ | occ == p_occ = return p_name
| otherwise = lookupOrig mod occ
- subs <- mappM lookup_sub occs
+ subs <- mapM lookup_sub occs
return (AvailTC p_name subs)
-- Remember that 'occs' is all the exported things, including
-- the parent. It's possible to export just class ops without
return (AvailTC p_name subs)
-- Remember that 'occs' is all the exported things, including
-- the parent. It's possible to export just class ops without
@@
-159,7
+159,7
@@
lookupOrig mod occ
; name_cache <- getNameCache
; case lookupOrigNameCache (nsNames name_cache) mod occ of {
; name_cache <- getNameCache
; case lookupOrigNameCache (nsNames name_cache) mod occ of {
- Just name -> returnM name;
+ Just name -> return name;
Nothing ->
let
us = nsUniqs name_cache
Nothing ->
let
us = nsUniqs name_cache
@@
-173,15
+173,14
@@
lookupOrig mod occ
}}}
newIPName :: IPName OccName -> TcRnIf m n (IPName Name)
}}}
newIPName :: IPName OccName -> TcRnIf m n (IPName Name)
-newIPName occ_name_ip
- = getNameCache `thenM` \ name_supply ->
+newIPName occ_name_ip = do
+ name_supply <- getNameCache
let
ipcache = nsIPs name_supply
let
ipcache = nsIPs name_supply
- in
case lookupFM ipcache key of
case lookupFM ipcache key of
- Just name_ip -> returnM name_ip
- Nothing -> setNameCache new_ns `thenM_`
- returnM name_ip
+ Just name_ip -> return name_ip
+ Nothing -> do setNameCache new_ns
+ return name_ip
where
(us', us1) = splitUniqSupply (nsUniqs name_supply)
uniq = uniqFromSupply us1
where
(us', us1) = splitUniqSupply (nsUniqs name_supply)
uniq = uniqFromSupply us1