Showing 292 of 292 total issues

Redundant $
Open

    , [t| OfVectorType ($(conT $ mkName $ "SwizzleVecResult" ++ nameSuffix) $(varT v)) |]

Found

conT $ mkName

Perhaps

conT mkName

Use camelCase
Open

data C_BulletRigidBody
Severity: Minor
Found in flaw-bullet/Flaw/Physics/Bullet.hs by hlint

Found

data C_BulletRigidBody

Perhaps

data CBulletRigidBody

Redundant bracket
Open

            if luaCoerceToBool loop > 0 then $(doE $ (noBindS [| writeMutVar $(r $ a + 3) newIdx |]) : jmpInstStmts)
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

(noBindS [| writeMutVar $( r $ a + 3 ) newIdx |]) : jmpInstStmts

Perhaps

noBindS [| writeMutVar $( r $ a + 3 ) newIdx |] : jmpInstStmts

Use camelCase
Open

type C_lua_Alloc = Ptr () -> Ptr () -> CSize -> CSize -> IO (Ptr ())
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/FFI.hs by hlint

Found

type C_lua_Alloc =
    Ptr () -> Ptr () -> CSize -> CSize -> IO (Ptr ())

Perhaps

type CLuaAlloc = Ptr () -> Ptr () -> CSize -> CSize -> IO (Ptr ())

Reduce duplication
Open

          pressed <- readTVar pressedVar
Severity: Minor
Found in flaw-ui/Flaw/UI/Button.hs by hlint

Found

pressed <- readTVar pressedVar
when pressed $
  do click
     writeTVar pressedVar False
return True

Perhaps

Combine with flaw-ui/Flaw/UI/Button.hs:160:9

Reduce duplication
Open

      sub <- subLayoutHandler $ Vec4 (px + labelWidth + gap) py qx qy
Severity: Minor
Found in flaw-ui/Flaw/UI/Layout.hs by hlint

Found

sub <- subLayoutHandler $ Vec4 (px + labelWidth + gap) py qx qy
let Vec4 _subpx subpy _subqx subqy = sub
return $
  Vec4 px (max (py + labelHeight + gap) subpy) qx (min qy subqy)

Perhaps

Combine with flaw-ui/Flaw/UI/Layout.hs:174:7

Use guards
Open

    argsSetDecs i =
      if i < numParams then do
        a <- newName "a"
        (restDecs, xs) <- argsSetDecs $ i + 1
        return
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

argsSetDecs i
  = if i < numParams then
      do a <- newName "a"
         (restDecs, xs) <- argsSetDecs $ i + 1
         return
           (valD [p| $( varP (paramNames V.! i) ) : $xs |]
              (normalB
                 [|
                   case $( varE a ) of
                       [] -> [LuaNil]
                       _ -> $( varE a )
                   |])
              []
              : restDecs,
            varP a)
      else
      if isVararg then
        do a <- newName "a"
           return ([valD (varP varargName) (normalB $ varE a) []], varP a)
        else return ([], wildP)

Perhaps

argsSetDecs i
  | i < numParams =
    do a <- newName "a"
       (restDecs, xs) <- argsSetDecs $ i + 1
       return
         (valD [p| $( varP (paramNames V.! i) ) : $xs |]
            (normalB
               [|
                 case $( varE a ) of
                     [] -> [LuaNil]
                     _ -> $( varE a )
                 |])
            []
            : restDecs,
          varP a)
  | isVararg =
    do a <- newName "a"
       return ([valD (varP varargName) (normalB $ varE a) []], varP a)
  | otherwise = return ([], wildP)

Use newtype instead of data
Open

data SdlException = SdlException String deriving Show
Severity: Minor
Found in flaw-sdl/Flaw/Sdl.hs by hlint

Found

data SdlException
  = SdlException String
  deriving Show

Perhaps

newtype SdlException
  = SdlException String
  deriving Show

Applying this change:

  • decreases laziness

Use camelCase
Open

glGetUniformLocation_s programName locationName = B.useAsCString (T.encodeUtf8 locationName) $ glGetUniformLocation programName
Severity: Minor
Found in flaw-gl/Flaw/Graphics/OpenGL/FFI.hs by hlint

Found

glGetUniformLocation_s programName locationName = ...

Perhaps

glGetUniformLocationS programName locationName = ...

Use camelCase
Open

glBindAttribLocation_s :: JS_WebGLProgram -> GLuint -> T.Text -> IO ()
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

glBindAttribLocation_s ::
  JS_WebGLProgram -> GLuint -> T.Text -> IO ()

Perhaps

glBindAttribLocationS ::
  JS_WebGLProgram -> GLuint -> T.Text -> IO ()

Use camelCase
Open

glGetUniformLocation_s program locationName = glGetUniformLocation_val program $ pToJSVal locationName
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

glGetUniformLocation_s program locationName = ...

Perhaps

glGetUniformLocationS program locationName = ...

Redundant bracket
Open

                else $(doE $ (noBindS [| writeMutVar $(r a) p |]) : nextInstStmts)
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/Chunk.hs by hlint

Found

(noBindS [| writeMutVar $( r a ) p |]) : nextInstStmts

Perhaps

noBindS [| writeMutVar $( r a ) p |] : nextInstStmts

Use guards
Open

          itemRender =
            if selected then do
              drawBorderedRectangle canvas
                (Vec4 (px + left) (px + left + 1) (px + right - 1) (px + right))
                (Vec4 y (y + 1) (y + itemHeight - 1) (y + itemHeight))
Severity: Minor
Found in flaw-ui/Flaw/UI/ListBox.hs by hlint

Found

itemRender
  = if selected then
      do drawBorderedRectangle canvas
           (Vec4 (px + left) (px + left + 1) (px + right - 1) (px + right))
           (Vec4 y (y + 1) (y + itemHeight - 1) (y + itemHeight))
           (styleFillColor style)
           (styleBorderColor style)
         r
      else
      if isOdd then
        do let evenColor
                 = styleFillColor selectedUnfocusedStyle * Vec4 1 1 1 5.0e-2
           drawBorderedRectangle canvas
             (Vec4 (px + left) (px + left) (px + right) (px + right))
             (Vec4 y y (y + itemHeight) (y + itemHeight))
             evenColor
             evenColor
           r
        else r

Perhaps

itemRender
  | selected =
    do drawBorderedRectangle canvas
         (Vec4 (px + left) (px + left + 1) (px + right - 1) (px + right))
         (Vec4 y (y + 1) (y + itemHeight - 1) (y + itemHeight))
         (styleFillColor style)
         (styleBorderColor style)
       r
  | isOdd =
    do let evenColor
             = styleFillColor selectedUnfocusedStyle * Vec4 1 1 1 5.0e-2
       drawBorderedRectangle canvas
         (Vec4 (px + left) (px + left) (px + right) (px + right))
         (Vec4 y y (y + itemHeight) (y + itemHeight))
         evenColor
         evenColor
       r
  | otherwise = r

Use camelCase
Open

data C_OSMesaContext

Found

data C_OSMesaContext

Perhaps

data COSMesaContext

Use camelCase
Open

newtype JS_WebGLFramebuffer = JS_WebGLFramebuffer JSVal
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

newtype JS_WebGLFramebuffer = JS_WebGLFramebuffer JSVal

Perhaps

newtype JSWebGLFramebuffer = JSWebGLFramebuffer JSVal

Use camelCase
Open

glShaderSource_s shader source = glShaderSource_val shader $ pToJSVal source
Severity: Minor
Found in flaw-gl/Flaw/Graphics/WebGL/FFI.hs by hlint

Found

glShaderSource_s shader source = ...

Perhaps

glShaderSourceS shader source = ...

Redundant bracket
Open

      (map (\a -> [| nodeValueType $(varE a) |]) ps) ++ [ [| valueType $(varE u) |] ] ++ (map varE ps)

Found

[[| valueType $( varE u ) |]] ++ (map varE ps)

Perhaps

[[| valueType $( varE u ) |]] ++ map varE ps

Avoid lambda
Open

      valueToShowList $(conP name $ map varP ps) = $(listE $ map (\p -> appE (varE 'show) $ varE p) ps)

Found

\ p -> appE (varE 'show) $ varE p

Perhaps

appE (varE 'show) . varE

Avoid lambda using infix
Open

      variantFilter variant = all (\c -> elem c components) variant && elem (last components) variant

Found

\ c -> elem c components

Perhaps

(`elem` components)

Use camelCase
Open

type C_lua_Reader = Ptr C_lua_State -> Ptr () -> Ptr CSize -> IO (Ptr CChar)
Severity: Minor
Found in flaw-lua/Flaw/Script/Lua/FFI.hs by hlint

Found

type C_lua_Reader =
    Ptr C_lua_State -> Ptr () -> Ptr CSize -> IO (Ptr CChar)

Perhaps

type CLuaReader =
    Ptr C_lua_State -> Ptr () -> Ptr CSize -> IO (Ptr CChar)
Severity
Category
Status
Source
Language