flaw-graphics/Flaw/Graphics/Program.hs

Summary

Maintainability
Test Coverage

Redundant do
Open

  withForeignPtr bytes $ \ptr -> do
    pokeByteOff ptr offset value

Found

do pokeByteOff ptr offset value

Perhaps

pokeByteOff ptr offset value

Eta reduce
Open

lerp a b c = LerpNode (nodeValueType a) a b c

Found

lerp a b c = LerpNode (nodeValueType a) a b c

Perhaps

lerp a = LerpNode (nodeValueType a) a

Use when
Open

  if stage /= PixelStage then fail "depthTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "depthTarget can be used only in pixel program" else return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "depthTarget can be used only in pixel program"

Use when
Open

  if stage /= VertexStage then fail "attribute can only be defined in vertex program"
  else return ()

Found

if stage /= VertexStage then
  fail "attribute can only be defined in vertex program" else
  return ()

Perhaps

Control.Monad.when (stage /= VertexStage) $
  fail "attribute can only be defined in vertex program"

Eta reduce
Open

equal_ a b = EqualNode (nodeValueType a) a b

Found

equal_ a b = EqualNode (nodeValueType a) a b

Perhaps

equal_ a = EqualNode (nodeValueType a) a

Eta reduce
Open

lessEqual_ a b = LessEqualNode (nodeValueType a) a b

Found

lessEqual_ a b = LessEqualNode (nodeValueType a) a b

Perhaps

lessEqual_ a = LessEqualNode (nodeValueType a) a

Redundant do
Open

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

Found

do pokeElemOff (ptr `plusPtr` offset) i value

Perhaps

pokeElemOff (ptr `plusPtr` offset) i value

Use when
Open

  if stage /= PixelStage then fail "colorTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "colorTarget can be used only in pixel program" else return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "colorTarget can be used only in pixel program"

Redundant do
Open

  }) value = do
  withForeignPtr bytes $ \ptr -> do
    pokeByteOff ptr offset value

Found

do withForeignPtr bytes $ \ ptr -> do pokeByteOff ptr offset value

Perhaps

withForeignPtr bytes $ \ ptr -> do pokeByteOff ptr offset value

Use when
Open

  if stage /= PixelStage then fail "dualColorTarget can be used only in pixel program"
  else return ()

Found

if stage /= PixelStage then
  fail "dualColorTarget can be used only in pixel program" else
  return ()

Perhaps

Control.Monad.when (stage /= PixelStage) $
  fail "dualColorTarget can be used only in pixel program"

Eta reduce
Open

less_ a b = LessNode (nodeValueType a) a b

Found

less_ a b = LessNode (nodeValueType a) a b

Perhaps

less_ a = LessNode (nodeValueType a) a

Use when
Open

  if stage == EndStage then fail "failed to add temp after end of the program"
  else return ()

Found

if stage == EndStage then
  fail "failed to add temp after end of the program" else return ()

Perhaps

Control.Monad.when (stage == EndStage) $
  fail "failed to add temp after end of the program"

Eta reduce
Open

if_ c a b = IfNode (nodeValueType a) c a b

Found

if_ c a b = IfNode (nodeValueType a) c a b

Perhaps

if_ c a = IfNode (nodeValueType a) c a

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

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

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 bracket
Open

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

Found

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

Perhaps

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

Redundant bracket
Open

    | n <= s || s >= (sizeOf (undefined :: Float4)) = s

Found

s >= (sizeOf (undefined :: Float4))

Perhaps

s >= sizeOf (undefined :: Float4)

Redundant bracket
Open

    writeIORef sizeRef $ alignedBufferSize + (sizeOf u) * size

Found

(sizeOf u) * size

Perhaps

sizeOf u * size

Fuse foldr/map
Open

      foldr (\a b -> [t| $a -> $b |]) [t| Node $(vecType $ sum cs) |] $ map argType cs

Found

foldr (\ a b -> [t| $a -> $b |]) [t| Node $( vecType $ sum cs ) |]
  $ map argType cs

Perhaps

foldr ((\ a b -> [t| $a -> $b |]) . argType)
  [t| Node $( vecType $ sum cs ) |]
  cs

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

Reduce duplication
Open

  bufferSize <- readIORef sizeRef

Found

bufferSize <- readIORef sizeRef
let align = shaderAlignment u
let alignedBufferSize
      = ((bufferSize + align - 1) `quot` align) * align

Perhaps

Combine with flaw-graphics/Flaw/Graphics/Program.hs:199:5

There are no issues that match your filters.

Category
Status