flaw-graphics/Flaw/Graphics/Program/Internal.hs

Summary

Maintainability
Test Coverage

Use when
Open

  if stage /= EndStage then fail "wrong program: stage should be end"
  else return ()

Found

if stage /= EndStage then fail "wrong program: stage should be end"
  else return ()

Perhaps

when (stage /= EndStage) $
  fail "wrong program: stage should be end"

Redundant do
Open

    funDecl variant = do
      funD (mkName $ variant ++ "__") [clause [] (normalB [| SwizzleNode (valueType (undefined :: $(varT v))) (valueType (undefined :: $(conT resultTypeName) $(varT v))) $(litE $ stringL variant) |]) []]

Found

do funD (mkName $ variant ++ "__")
     [clause []
        (normalB
           [|
             SwizzleNode (valueType (undefined :: $( varT v )))
               (valueType (undefined :: $( conT resultTypeName ) $( varT v )))
               $( litE $ stringL variant )
             |])
        []]

Perhaps

funD (mkName $ variant ++ "__")
  [clause []
     (normalB
        [|
          SwizzleNode (valueType (undefined :: $( varT v )))
            (valueType (undefined :: $( conT resultTypeName ) $( varT v )))
            $( litE $ stringL variant )
          |])
     []]

Use infix
Open

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

Found

elem c components

Perhaps

c `elem` components

Redundant $
Open

    [ funD (mkName $ [c, '_']) [clause [] (normalB [| ComponentNode (valueType (undefined :: $(varT v))) (valueType (undefined :: VecElement $(varT v))) $(litE $ charL c) |]) []]

Found

mkName $ [c, '_']

Perhaps

mkName [c, '_']

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)

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

Redundant $
Open

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

Found

conT $ mkName

Perhaps

conT mkName

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

There are no issues that match your filters.

Category
Status