Skip to content

Commit

Permalink
more hlint cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aviaviavi committed Nov 23, 2018
1 parent 16a26bf commit 4d591b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ghc-options:
dependencies:
- base >= 4.0 && < 5

# TODO(avi) dependencies need to be relaxed and
# TODO (avi|p=3|#dependencies) - dependencies need to be relaxed and
# fixed to include other ghc versions
library:
source-dirs: src
Expand Down
20 changes: 10 additions & 10 deletions src/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ renderTodo t =
else fromJust $ multiLineOpenCommentForExtension ext
detail =
renderFlag (flag t) <> " (" <>
(T.pack $
T.pack (
Data.String.Utils.join
"|"
(map T.unpack $
Expand All @@ -150,10 +150,10 @@ renderTodo t =
commented = map commentFn fullNoComments
in mapLast
(\line ->
if (entryHeadClosed t)
if entryHeadClosed t
then line <> " " <> getMultiClosingForFileType ext
else line) .
mapHead (\l -> if (entryHeadOpened t) then (leadingText t <> getMultiOpeningForFileType ext <> " " <> l) else leadingText t <> l) .
mapHead (\l -> if entryHeadOpened t then leadingText t <> getMultiOpeningForFileType ext <> " " <> l else leadingText t <> l) .
mapInit
(\l -> foldl (<>) "" [" " | _ <- [1 .. (T.length $ leadingText t)]] <> l) $
commented
Expand All @@ -177,10 +177,10 @@ updateTodoLinesInFile f todo = do
fileLines <- liftIO $ lines <$> SIO.readFile (sourceFile todo)
let updatedLines =
slice 0 (fromIntegral $ startIndex - 1) fileLines ++ newLines ++
(slice
slice
(fromIntegral startIndex + length (body todo))
(length fileLines - 1)
fileLines)
fileLines
liftIO $ writeFile (sourceFile todo) $ unlines updatedLines

where
Expand All @@ -193,7 +193,7 @@ deleteTodos (ToodlesState ref _) req = do
let toDelete = filter (\t -> entryId t `elem` ids req) r
liftIO $ doUntilNull removeAndAdjust toDelete
let remainingResults = filter (\t -> entryId t `notElem` map entryId toDelete) r
updatedResults <- return $ foldl (flip adjustLinesAfterDeletionOf) remainingResults toDelete
let updatedResults = foldl (flip adjustLinesAfterDeletionOf) remainingResults toDelete
let remainingResultsRef = refVal { todos = updatedResults }
_ <- liftIO $ atomicModifyIORef' ref (const (remainingResultsRef, remainingResultsRef))
return "{}"
Expand Down Expand Up @@ -225,9 +225,9 @@ deleteTodos (ToodlesState ref _) req = do
where
removeTodoFromCode :: MonadIO m => TodoEntry -> m ()
removeTodoFromCode t =
let opening = if (entryHeadOpened t) then [getMultiOpeningForFileType $ getExtension (sourceFile t)] else []
closing = if (entryHeadClosed t) then [getMultiClosingForFileType $ getExtension (sourceFile t)] else []
finalList = if (length opening /= length closing) then (opening ++ closing) else [] in
let opening = [getMultiOpeningForFileType $ getExtension (sourceFile t) | entryHeadOpened t]
closing = [getMultiClosingForFileType $ getExtension (sourceFile t) | entryHeadClosed t]
finalList = if length opening /= length closing then opening ++ closing else [] in
updateTodoLinesInFile (const finalList) t

setAbsolutePath :: ToodlesArgs -> IO ToodlesArgs
Expand Down Expand Up @@ -312,7 +312,7 @@ mapHead f (x:xs) = f x : xs
mapHead _ xs = xs

mapInit :: (a -> a) -> [a] -> [a]
mapInit f (x:xs) = [x] ++ map f xs
mapInit f (x:xs) = x : map f xs
mapInit _ x = x

mapLast :: (a -> a) -> [a] -> [a]
Expand Down

0 comments on commit 4d591b7

Please sign in to comment.