apply hlint 3.8 suggestions (#1744)

As title
This commit is contained in:
Karl Ostmo 2024-01-25 17:36:13 -08:00 committed by GitHub
parent 5f53082971
commit 669163384e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 13 deletions

View File

@ -30,7 +30,7 @@ import System.IO (hPrint, stderr)
import Text.Read (readMaybe)
gitInfo :: Maybe GitInfo
gitInfo = either (const Nothing) Just ($$tGitInfoCwdTry)
gitInfo = either (const Nothing) Just $$tGitInfoCwdTry
commitInfo :: String
commitInfo = case gitInfo of

View File

@ -202,7 +202,7 @@ truncatePath origPath entityLoc oldCache =
oldCache {cachedPath = CachedPath truncPath $ mkTailMap truncPath}
where
truncPath = prependList truncPathExcludingEntityLoc $ pure entityLoc
truncPathExcludingEntityLoc = fst $ NE.break (/= entityLoc) origPath
truncPathExcludingEntityLoc = takeWhile (== entityLoc) $ NE.toList origPath
-- | Given an event that entails the modification of some cell,
-- check whether a shortest-path previously computed for a

View File

@ -188,8 +188,9 @@ brackets = between (symbol "[") (symbol "]")
parsePolytype :: Parser Polytype
parsePolytype =
join $
quantify
<$> (fromMaybe [] <$> optional (reserved "forall" *> some identifier <* symbol "."))
( quantify . fromMaybe []
<$> optional (reserved "forall" *> some identifier <* symbol ".")
)
<*> parseType
where
quantify :: [Var] -> Type -> Parser Polytype
@ -288,8 +289,7 @@ parseTermAtom2 =
*> ( ( TRequireDevice
<$> (textLiteral <?> "device name in double quotes")
)
<|> ( TRequire
<$> (fromIntegral <$> integer)
<|> ( (TRequire . fromIntegral <$> integer)
<*> (textLiteral <?> "entity name in double quotes")
)
)

View File

@ -43,7 +43,7 @@ import Control.Lens ((%~), (&), _head, _last)
import Data.Char (isSpace)
import Data.Functor.Identity (Identity (..))
import Data.List.Split (chop)
import Data.Maybe (catMaybes)
import Data.Maybe (mapMaybe)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text)
@ -178,7 +178,7 @@ parseSyntax t = case readTerm t of
Right _ -> Right s
findCode :: Document Syntax -> [Syntax]
findCode = catMaybes . concatMap (map codeOnly . nodes) . paragraphs
findCode = concatMap (mapMaybe codeOnly . nodes) . paragraphs
where
codeOnly = \case
LeafCode s -> Just s

View File

@ -133,10 +133,8 @@ mkEntityLookup grids =
mkValues neList = AutomatonInfo participatingEnts bounds sm
where
participatingEnts =
S.fromList
. map (view entityName)
. catMaybes
$ concatMap fst tuples
(S.fromList . map (view entityName))
(concatMap (catMaybes . fst) tuples)
tuples = M.toList $ M.mapWithKey mkSmValue groupedByUniqueRow

View File

@ -237,7 +237,7 @@ instance Ord FoundStructure where
-- are not included.
genOccupiedCoords :: FoundStructure -> [Cosmic Location]
genOccupiedCoords (FoundStructure swg loc) =
catMaybes . concat . zipWith mkRow [0 ..] $ entityGrid swg
concatMap catMaybes . zipWith mkRow [0 ..] $ entityGrid swg
where
mkCol y x ent = loc `offsetBy` V2 x (negate y) <$ ent
mkRow rowIdx = zipWith (mkCol rowIdx) [0 ..]