Don't bother with asks if you're just immediately binding the result anyway
This commit is contained in:
parent
ca41440a67
commit
0cc5ed4563
|
@ -354,8 +354,8 @@ getClosestCommand tree t =
|
||||||
|
|
||||||
-- Like above, if koala_man knew Haskell when starting this project.
|
-- Like above, if koala_man knew Haskell when starting this project.
|
||||||
getClosestCommandM t = do
|
getClosestCommandM t = do
|
||||||
tree <- asks parentMap
|
params <- ask
|
||||||
return $ getClosestCommand tree t
|
return $ getClosestCommand (parentMap params) t
|
||||||
|
|
||||||
-- Is the token used as a command name (the first word in a T_SimpleCommand)?
|
-- Is the token used as a command name (the first word in a T_SimpleCommand)?
|
||||||
usedAsCommandName tree token = go (getId token) (tail $ getPath tree token)
|
usedAsCommandName tree token = go (getId token) (tail $ getPath tree token)
|
||||||
|
@ -377,8 +377,8 @@ getPath tree t = t :
|
||||||
-- Version of the above taking the map from the current context
|
-- Version of the above taking the map from the current context
|
||||||
-- Todo: give this the name "getPath"
|
-- Todo: give this the name "getPath"
|
||||||
getPathM t = do
|
getPathM t = do
|
||||||
map <- asks parentMap
|
params <- ask
|
||||||
return $ getPath map t
|
return $ getPath (parentMap params) t
|
||||||
|
|
||||||
isParentOf tree parent child =
|
isParentOf tree parent child =
|
||||||
elem (getId parent) . map getId $ getPath tree child
|
elem (getId parent) . map getId $ getPath tree child
|
||||||
|
@ -866,8 +866,8 @@ headOrDefault def _ = def
|
||||||
|
|
||||||
-- Run a command if the shell is in the given list
|
-- Run a command if the shell is in the given list
|
||||||
whenShell l c = do
|
whenShell l c = do
|
||||||
shell <- asks shellType
|
params <- ask
|
||||||
when (shell `elem` l ) c
|
when (shellType params `elem` l ) c
|
||||||
|
|
||||||
|
|
||||||
filterByAnnotation asSpec params =
|
filterByAnnotation asSpec params =
|
||||||
|
|
Loading…
Reference in New Issue