diff options
author | defanor <defanor@uberspace.net> | 2017-12-11 17:22:00 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-11 18:18:17 +0300 |
commit | 49772469e722419764377ad9449520512626c407 (patch) | |
tree | ace08f8ec7851dc49b6e471c024e0fc5e8302de1 /Pancake/Rendering.hs | |
parent | 688c9aeb5a2077609ed5ad4be3d15061a9d2dc7a (diff) |
Improve code style in a couple of places
- `sum lens /= 0` implies `length lens /= 0`, so no need to check the
latter after the former.
- Don't use `concat` for just two elements.
Diffstat (limited to 'Pancake/Rendering.hs')
-rw-r--r-- | Pancake/Rendering.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index 6c6f4e2..6c5a873 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -436,7 +436,7 @@ renderBlock (P.Table caption aligns widths headers rows) = do ws <- if widthsAreSet then pure widths else do lens <- map sum . transpose <$> mapM (mapM (fmap (length . unstyled . concat . rLines) . renderCell 80)) rows - pure $ map (\l -> if sum lens == 0 || length lens == 0 + pure $ map (\l -> if sum lens == 0 then 0 else fromIntegral l / fromIntegral (sum lens) * 0.7 + 1 / fromIntegral (length lens) * 0.3) lens |