flaw-ui/Flaw/UI/ListBox.hs

Summary

Maintainability
Test Coverage

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

Use guards
Open

      (visibleItems, firstVisibleItemOrderedIndex) =
        if topOrderedIndex <= 0 then (items, 0)
        else if topOrderedIndex >= S.size items then (S.empty, 0)
        else let
          ListBoxItem firstVisibleItemIndex firstVisibleItemKeyFunc firstVisibleItemValue = S.elemAt topOrderedIndex items
Severity: Minor
Found in flaw-ui/Flaw/UI/ListBox.hs by hlint

Found

(visibleItems, firstVisibleItemOrderedIndex)
  = if topOrderedIndex <= 0 then (items, 0) else
      if topOrderedIndex >= S.size items then (S.empty, 0) else
        let ListBoxItem firstVisibleItemIndex firstVisibleItemKeyFunc
              firstVisibleItemValue
              = S.elemAt topOrderedIndex items
          in
          (snd $
             S.split
               (ListBoxItem (firstVisibleItemIndex - 1) firstVisibleItemKeyFunc
                  firstVisibleItemValue)
               items,
           topOrderedIndex)

Perhaps

(visibleItems, firstVisibleItemOrderedIndex)
  | topOrderedIndex <= 0 = (items, 0)
  | topOrderedIndex >= S.size items = (S.empty, 0)
  | otherwise =
    let ListBoxItem firstVisibleItemIndex firstVisibleItemKeyFunc
          firstVisibleItemValue
          = S.elemAt topOrderedIndex items
      in
      (snd $
         S.split
           (ListBoxItem (firstVisibleItemIndex - 1) firstVisibleItemKeyFunc
              firstVisibleItemValue)
           items,
       topOrderedIndex)

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

There are no issues that match your filters.

Category
Status