Showing 292 of 292 total issues

Unused LANGUAGE pragma
Open

{-# LANGUAGE DeriveGeneric, FlexibleContexts, FunctionalDependencies, MultiParamTypeClasses, RankNTypes, TypeFamilies #-}
Severity: Minor
Found in flaw-graphics/Flaw/Graphics.hs by hlint

Found

{-# LANGUAGE DeriveGeneric, FlexibleContexts,
  FunctionalDependencies, MultiParamTypeClasses, RankNTypes,
  TypeFamilies #-}

Perhaps

{-# LANGUAGE DeriveGeneric, FlexibleContexts,
  FunctionalDependencies, RankNTypes, TypeFamilies #-}

Applying this change:

  • Extension MultiParamTypeClasses is implied by FunctionalDependencies

Eta reduce
Open

max_ a b = MaxNode (nodeValueType a) a b

Found

max_ a b = MaxNode (nodeValueType a) a b

Perhaps

max_ a = MaxNode (nodeValueType a) a

Use when
Open

  if stage /= VertexStage then fail $ show ("wrong stage to add pixel program", stage)
  else return ()

Found

if stage /= VertexStage then
  fail $ show ("wrong stage to add pixel program", stage) else
  return ()

Perhaps

Control.Monad.when (stage /= VertexStage) $
  fail $ show ("wrong stage to add pixel program", stage)

Eta reduce
Open

glBufferData_null target size usage = glBufferData target size nullPtr usage
Severity: Minor
Found in flaw-gl/Flaw/Graphics/OpenGL/FFI.hs by hlint

Found

glBufferData_null target size usage
  = glBufferData target size nullPtr usage

Perhaps

glBufferData_null target size = glBufferData target size nullPtr

Eta reduce
Open

clamp a b c = ClampNode (nodeValueType a) a b c

Found

clamp a b c = ClampNode (nodeValueType a) a b c

Perhaps

clamp a = ClampNode (nodeValueType a) a

Use when
Open

                else if (flags .&. RI_MOUSE_MIDDLE_BUTTON_UP) > 0 then
                  addMouseEvent $ MouseUpEvent MiddleMouseButton
                else return ()
Severity: Minor
Found in flaw-input/Flaw/Input/Win32.hs by hlint

Found

if (flags .&. RI_MOUSE_MIDDLE_BUTTON_UP) > 0 then
  addMouseEvent $ MouseUpEvent MiddleMouseButton else return ()

Perhaps

when ((flags .&. RI_MOUSE_MIDDLE_BUTTON_UP) > 0) $
  addMouseEvent $ MouseUpEvent MiddleMouseButton

Redundant do
Open

  }) i value = do
  withForeignPtr bytes $ \ptr -> do
    pokeElemOff (ptr `plusPtr` offset) i value

Found

do withForeignPtr bytes $
     \ ptr -> do pokeElemOff (ptr `plusPtr` offset) i value

Perhaps

withForeignPtr bytes $
  \ ptr -> do pokeElemOff (ptr `plusPtr` offset) i value

Eta reduce
Open

min_ a b = MinNode (nodeValueType a) a b

Found

min_ a b = MinNode (nodeValueType a) a b

Perhaps

min_ a = MinNode (nodeValueType a) a

Redundant do
Open

      followingInstsCodes <- forM followingInstsIds $ \followingInstId -> do
        -- for instruction with one referrer (this one), emit stmts inline
        if instructionsRefCounts VU.! followingInstId == 1 then getInstructionCode $ instructions V.! followingInstId
        -- otherwise use name
        else return $ \LuaCodeState
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

do if instructionsRefCounts VU.! followingInstId == 1 then
     getInstructionCode $ instructions V.! followingInstId else
     return $
       \ LuaCodeState{luaCodeStateTop = top} ->
         do when (top >= 0) $
              reportError
                "flaw-lua: instruction reference cannot send dynamic values"
            return [noBindS $ varE $ instructionsNames V.! followingInstId]

Perhaps

if instructionsRefCounts VU.! followingInstId == 1 then
  getInstructionCode $ instructions V.! followingInstId else
  return $
    \ LuaCodeState{luaCodeStateTop = top} ->
      do when (top >= 0) $
           reportError
             "flaw-lua: instruction reference cannot send dynamic values"
         return [noBindS $ varE $ instructionsNames V.! followingInstId]

Redundant do
Open

    } (Vec2 x y) = do
    if x < 0 || y < 0 || y >= columnHeaderHeight then return False
    else (x <) <$> readTVar widthVar
Severity: Minor
Found in flaw-ui/Flaw/UI/ListBox.hs by hlint

Found

do if x < 0 || y < 0 || y >= columnHeaderHeight then return False
     else (x <) <$> readTVar widthVar

Perhaps

if x < 0 || y < 0 || y >= columnHeaderHeight then return False else
  (x <) <$> readTVar widthVar

Unused LANGUAGE pragma
Open

{-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving, OverloadedStrings, ViewPatterns #-}
Severity: Minor
Found in flaw-itch-webapi/Flaw/Itch/WebApi.hs by hlint

Found

{-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving,
  OverloadedStrings, ViewPatterns #-}

Perhaps

{-# LANGUAGE DeriveGeneric, GeneralizedNewtypeDeriving,
  OverloadedStrings #-}

Applying this change:

  • Extension ViewPatterns is not used

Use forM_
Open

          accountForPair a b = case M.lookup (PairKey a b) pairHeapIndexByKey of
            Just h -> VGM.unsafeModify pairTriangleCounts (+ 1) h
            Nothing -> return ()

Found

case M.lookup (PairKey a b) pairHeapIndexByKey of
    Just h -> VGM.unsafeModify pairTriangleCounts (+ 1) h
    Nothing -> return ()

Perhaps

Data.Foldable.forM_ (M.lookup (PairKey a b) pairHeapIndexByKey)
  (VGM.unsafeModify pairTriangleCounts (+ 1))

Use gets
Open

  unit <- (csUnit . ccSettings) <$> get
Severity: Minor
Found in flaw-collada/Flaw/Asset/Collada.hs by hlint

Found

(csUnit . ccSettings) <$> get

Perhaps

gets (csUnit . ccSettings)

Use forM_
Open

  case HM.lookup userId sessionsByUserId of
    Just session -> deleteSession sessionManager session
    Nothing -> return ()
Severity: Minor
Found in flaw-network/Flaw/Network/Session.hs by hlint

Found

case HM.lookup userId sessionsByUserId of
    Just session -> deleteSession sessionManager session
    Nothing -> return ()

Perhaps

Data.Foldable.forM_ (HM.lookup userId sessionsByUserId)
  (deleteSession sessionManager)

Redundant do
Open

itchWebApiDownloadKeys httpManager apiKey (ItchGameId gameId) (ItchUserId userId) = do
  A.parseMaybe parseResponse <$> itchWebApiRequest httpManager apiKey ("/game/" <> fromString (show gameId) <> "/download_keys")
    [ ("user_id", Just $ fromString $ show userId)
    ]
Severity: Minor
Found in flaw-itch-webapi/Flaw/Itch/WebApi.hs by hlint

Found

do A.parseMaybe parseResponse <$>
     itchWebApiRequest httpManager apiKey
       ("/game/" <> fromString (show gameId) <> "/download_keys")
       [("user_id", Just $ fromString $ show userId)]

Perhaps

A.parseMaybe parseResponse <$>
  itchWebApiRequest httpManager apiKey
    ("/game/" <> fromString (show gameId) <> "/download_keys")
    [("user_id", Just $ fromString $ show userId)]

Use when
Open

      else if pair_cost rp < pair_cost p && pair_cost rp <= pair_cost lp then swap r rp
      else return ()

Found

if pair_cost rp < pair_cost p && pair_cost rp <= pair_cost lp then
  swap r rp else return ()

Perhaps

when (pair_cost rp < pair_cost p && pair_cost rp <= pair_cost lp) $
  swap r rp

Use gets
Open

  getParsedArrays = ccNameArrays <$> get
Severity: Minor
Found in flaw-collada/Flaw/Asset/Collada.hs by hlint

Found

ccNameArrays <$> get

Perhaps

gets ccNameArrays

Use gets
Open

    } <- fmap ccSettings get
Severity: Minor
Found in flaw-collada/Flaw/Asset/Collada.hs by hlint

Found

fmap ccSettings get

Perhaps

gets ccSettings

Use gets
Open

  getParsedArrays = ccWord32Arrays <$> get
Severity: Minor
Found in flaw-collada/Flaw/Asset/Collada.hs by hlint

Found

ccWord32Arrays <$> get

Perhaps

gets ccWord32Arrays

Use gets
Open

    } <- fmap ccSettings get
Severity: Minor
Found in flaw-collada/Flaw/Asset/Collada.hs by hlint

Found

fmap ccSettings get

Perhaps

gets ccSettings
Severity
Category
Status
Source
Language