mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-29 21:46:11 +03:00
Use DList to avoid repetitive Data.List.++
This commit is contained in:
parent
f779133ceb
commit
cd0e55276e
@ -81,6 +81,7 @@ library
|
|||||||
vty >= 5.12,
|
vty >= 5.12,
|
||||||
transformers,
|
transformers,
|
||||||
data-default,
|
data-default,
|
||||||
|
dlist,
|
||||||
containers,
|
containers,
|
||||||
microlens >= 0.3.0.0,
|
microlens >= 0.3.0.0,
|
||||||
microlens-th,
|
microlens-th,
|
||||||
|
@ -93,6 +93,7 @@ import Control.Monad.Trans.Class (lift)
|
|||||||
import qualified Data.Foldable as F
|
import qualified Data.Foldable as F
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.Default
|
import Data.Default
|
||||||
|
import qualified Data.DList as DL
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.Function as DF
|
import qualified Data.Function as DF
|
||||||
@ -438,14 +439,14 @@ renderBox br ws =
|
|||||||
let availPrimary = c^.(contextPrimary br)
|
let availPrimary = c^.(contextPrimary br)
|
||||||
availSecondary = c^.(contextSecondary br)
|
availSecondary = c^.(contextSecondary br)
|
||||||
|
|
||||||
renderHis _ prev [] = return prev
|
renderHis _ prev [] = return $ DL.toList prev
|
||||||
renderHis remainingPrimary prev ((i, prim):rest) = do
|
renderHis remainingPrimary prev ((i, prim):rest) = do
|
||||||
result <- render $ limitPrimary br remainingPrimary
|
result <- render $ limitPrimary br remainingPrimary
|
||||||
$ limitSecondary br availSecondary
|
$ limitSecondary br availSecondary
|
||||||
$ cropToContext prim
|
$ cropToContext prim
|
||||||
renderHis (remainingPrimary - (result^.imageL.(to $ imagePrimary br))) (prev ++ [(i, result)]) rest
|
renderHis (remainingPrimary - (result^.imageL.(to $ imagePrimary br))) (DL.snoc prev (i, result)) rest
|
||||||
|
|
||||||
renderedHis <- renderHis availPrimary [] his
|
renderedHis <- renderHis availPrimary DL.empty his
|
||||||
|
|
||||||
renderedLows <- case lows of
|
renderedLows <- case lows of
|
||||||
[] -> return []
|
[] -> return []
|
||||||
|
Loading…
Reference in New Issue
Block a user