Fix warnings from hlint

This commit is contained in:
Peter Jones 2015-11-16 13:12:49 -07:00
parent 3b9c6d6ff2
commit b1360f08d0

View File

@ -158,9 +158,8 @@ dynamicProjectsLogHook = do
unless (Just name == previousProject state) $ do unless (Just name == previousProject state) $ do
XS.modify $ \s -> s {previousProject = Just name} XS.modify $ \s -> s {previousProject = Just name}
activateProject $ case Map.lookup name (projects state) of activateProject . fromMaybe (defProject name) $
Nothing -> Project name "~/" Nothing Map.lookup name (projects state)
Just p -> p
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Start-up hook for recording configured projects. -- | Start-up hook for recording configured projects.
@ -180,7 +179,9 @@ dynamicProjectsStartupHook ps = XS.modify go
-- get deleted when switching away from a workspace with no -- get deleted when switching away from a workspace with no
-- windows. -- windows.
addDefaultHook :: Project -> Project addDefaultHook :: Project -> Project
addDefaultHook p = p {projectStartHook = projectStartHook p <|> Just (return ())} addDefaultHook p = p { projectStartHook = projectStartHook p <|>
Just (return ())
}
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Find a project based on its name. -- | Find a project based on its name.
@ -194,10 +195,7 @@ currentProject :: X Project
currentProject = do currentProject = do
name <- gets (W.tag . W.workspace . W.current . windowset) name <- gets (W.tag . W.workspace . W.current . windowset)
proj <- lookupProject name proj <- lookupProject name
return $ fromMaybe (defProject name) proj
return $ case proj of
Just p -> p
Nothing -> Project name "~/" Nothing
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Switch to the given project. -- | Switch to the given project.
@ -251,9 +249,8 @@ shiftToProjectPrompt :: XPConfig -> X ()
shiftToProjectPrompt c = projectPrompt c go shiftToProjectPrompt c = projectPrompt c go
where where
go :: ProjectTable -> ProjectName -> X () go :: ProjectTable -> ProjectName -> X ()
go ps name = shiftToProject $ case Map.lookup name ps of go ps name = shiftToProject . fromMaybe (defProject name) $
Just p -> p Map.lookup name ps
Nothing -> Project name "~/" Nothing
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Prompt for a project name. -- | Prompt for a project name.
@ -287,3 +284,8 @@ activateProject p = do
expandHome home dir = case stripPrefix "~" dir of expandHome home dir = case stripPrefix "~" dir of
Nothing -> dir Nothing -> dir
Just xs -> home ++ xs Just xs -> home ++ xs
--------------------------------------------------------------------------------
-- | Default project.
defProject :: ProjectName -> Project
defProject name = Project name "~/" Nothing