diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-05-13 19:53:04 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-05-13 19:53:04 +0100 |
commit | 58dccedb6a9c522907e9009616df2eff74ddf4c9 (patch) | |
tree | 4cbc845c84763ce028c89794cdf21d155d2de029 /compiler | |
parent | 7e723a1c70bee46a42d2cafb9ebd7399c3c054f0 (diff) | |
download | haskell-58dccedb6a9c522907e9009616df2eff74ddf4c9.tar.gz |
Use NatM_State record fields, rather than matching/constructing the whole type
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/nativeGen/NCGMonad.hs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/nativeGen/NCGMonad.hs b/compiler/nativeGen/NCGMonad.hs index 619bf9a5fc..dd7eccb594 100644 --- a/compiler/nativeGen/NCGMonad.hs +++ b/compiler/nativeGen/NCGMonad.hs @@ -89,30 +89,25 @@ mapAccumLNat f b (x:xs) return (b__3, x__2:xs__2) getUniqueNat :: NatM Unique -getUniqueNat = NatM $ \ (NatM_State us delta imports pic dflags) -> - case takeUniqFromSupply us of - (uniq, us') -> (uniq, (NatM_State us' delta imports pic dflags)) +getUniqueNat = NatM $ \ st -> + case takeUniqFromSupply $ natm_us st of + (uniq, us') -> (uniq, st {natm_us = us'}) instance HasDynFlags NatM where - getDynFlags = NatM $ \ (NatM_State us delta imports pic dflags) -> - (dflags, (NatM_State us delta imports pic dflags)) + getDynFlags = NatM $ \ st -> (natm_dflags st, st) getDeltaNat :: NatM Int -getDeltaNat - = NatM $ \ st -> (natm_delta st, st) +getDeltaNat = NatM $ \ st -> (natm_delta st, st) setDeltaNat :: Int -> NatM () -setDeltaNat delta - = NatM $ \ (NatM_State us _ imports pic dflags) -> - ((), NatM_State us delta imports pic dflags) +setDeltaNat delta = NatM $ \ st -> ((), st {natm_delta = delta}) addImportNat :: CLabel -> NatM () addImportNat imp - = NatM $ \ (NatM_State us delta imports pic dflags) -> - ((), NatM_State us delta (imp:imports) pic dflags) + = NatM $ \ st -> ((), st {natm_imports = imp : natm_imports st}) getBlockIdNat :: NatM BlockId |