[commit: ghc] master: Tabs -> spaces (and some other formatting) (4c93c8b)
Manuel Chakravarty
chak at cse.unsw.edu.au
Wed Feb 6 04:16:53 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4c93c8bac5a9ceccc53423811d5a1f8a09d55b13
>---------------------------------------------------------------
commit 4c93c8bac5a9ceccc53423811d5a1f8a09d55b13
Author: Manuel M T Chakravarty <chak at cse.unsw.edu.au>
Date: Fri Aug 17 12:02:40 2012 +1000
Tabs -> spaces (and some other formatting)
>---------------------------------------------------------------
compiler/vectorise/Vectorise/Monad/Local.hs | 111 +++++++++++++--------------
1 files changed, 53 insertions(+), 58 deletions(-)
diff --git a/compiler/vectorise/Vectorise/Monad/Local.hs b/compiler/vectorise/Vectorise/Monad/Local.hs
index 4ead2f4..8b3c1dc 100644
--- a/compiler/vectorise/Vectorise/Monad/Local.hs
+++ b/compiler/vectorise/Vectorise/Monad/Local.hs
@@ -1,24 +1,18 @@
+module Vectorise.Monad.Local
+ ( readLEnv
+ , setLEnv
+ , updLEnv
+ , localV
+ , closedV
+ , getBindName
+ , inBind
+ , lookupTyVarPA
+ , defLocalTyVar
+ , defLocalTyVarWithPA
+ , localTyVars
+ )
+where
-{-# OPTIONS -fno-warn-tabs #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and
--- detab the module (please do the detabbing in a separate patch). See
--- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
--- for details
-
-module Vectorise.Monad.Local (
- readLEnv,
- setLEnv,
- updLEnv,
- localV,
- closedV,
- getBindName,
- inBind,
- lookupTyVarPA,
- defLocalTyVar,
- defLocalTyVarWithPA,
- localTyVars
-) where
import Vectorise.Monad.Base
import Vectorise.Env
@@ -29,77 +23,78 @@ import Var
import FastString
-- Local Environment ----------------------------------------------------------
--- | Project something from the local environment.
-readLEnv :: (LocalEnv -> a) -> VM a
-readLEnv f = VM $ \_ genv lenv -> return (Yes genv lenv (f lenv))
+-- |Project something from the local environment.
+--
+readLEnv :: (LocalEnv -> a) -> VM a
+readLEnv f = VM $ \_ genv lenv -> return (Yes genv lenv (f lenv))
--- | Set the local environment.
+-- |Set the local environment.
+--
setLEnv :: LocalEnv -> VM ()
-setLEnv lenv = VM $ \_ genv _ -> return (Yes genv lenv ())
-
+setLEnv lenv = VM $ \_ genv _ -> return (Yes genv lenv ())
--- | Update the enviroment using the provided function.
+-- |Update the enviroment using the provided function.
+--
updLEnv :: (LocalEnv -> LocalEnv) -> VM ()
-updLEnv f = VM $ \_ genv lenv -> return (Yes genv (f lenv) ())
+updLEnv f = VM $ \_ genv lenv -> return (Yes genv (f lenv) ())
-
--- | Perform a computation in its own local environment.
--- This does not alter the environment of the current state.
+-- |Perform a computation in its own local environment.
+-- This does not alter the environment of the current state.
+--
localV :: VM a -> VM a
localV p
- = do env <- readLEnv id
- x <- p
- setLEnv env
- return x
-
+ = do env <- readLEnv id
+ x <- p
+ setLEnv env
+ return x
--- | Perform a computation in an empty local environment.
+-- |Perform a computation in an empty local environment.
+--
closedV :: VM a -> VM a
closedV p
- = do env <- readLEnv id
- setLEnv (emptyLocalEnv { local_bind_name = local_bind_name env })
- x <- p
- setLEnv env
- return x
-
-
--- | Get the name of the local binding currently being vectorised.
+ = do env <- readLEnv id
+ setLEnv (emptyLocalEnv { local_bind_name = local_bind_name env })
+ x <- p
+ setLEnv env
+ return x
+
+-- |Get the name of the local binding currently being vectorised.
+--
getBindName :: VM FastString
getBindName = readLEnv local_bind_name
-
--- | Run a vectorisation computation in a local environment,
--- with this id set as the current binding.
+-- |Run a vectorisation computation in a local environment,
+-- with this id set as the current binding.
+--
inBind :: Id -> VM a -> VM a
inBind id p
= do updLEnv $ \env -> env { local_bind_name = occNameFS (getOccName id) }
p
-
--- | Lookup a PA tyvars from the local environment.
+-- |Lookup a PA tyvars from the local environment.
+--
lookupTyVarPA :: Var -> VM (Maybe CoreExpr)
lookupTyVarPA tv
- = readLEnv $ \env -> lookupVarEnv (local_tyvar_pa env) tv
-
+ = readLEnv $ \env -> lookupVarEnv (local_tyvar_pa env) tv
--- | Add a tyvar to the local environment.
+-- |Add a tyvar to the local environment.
+--
defLocalTyVar :: TyVar -> VM ()
defLocalTyVar tv = updLEnv $ \env ->
env { local_tyvars = tv : local_tyvars env
, local_tyvar_pa = local_tyvar_pa env `delVarEnv` tv
}
--- | Add mapping between a tyvar and pa dictionary to the local environment.
+-- |Add mapping between a tyvar and pa dictionary to the local environment.
+--
defLocalTyVarWithPA :: TyVar -> CoreExpr -> VM ()
defLocalTyVarWithPA tv pa = updLEnv $ \env ->
env { local_tyvars = tv : local_tyvars env
, local_tyvar_pa = extendVarEnv (local_tyvar_pa env) tv pa
}
-
--- | Get the set of tyvars from the local environment.
+-- |Get the set of tyvars from the local environment.
+--
localTyVars :: VM [TyVar]
localTyVars = readLEnv (reverse . local_tyvars)
-
-
More information about the ghc-commits
mailing list