module DynListLF(dynListLF) where
import Fudget
import CompOps((>+<))
import DynListF
import Dynforkmerge(DynMsg(..))
import Loops(loopThroughRightF)
import SerCompF(concatMapF)
import UserLayoutF
--import Geometry
import LayoutRequest
import LayoutSP(dynLayoutMgrF)
import LayoutF(LayoutDirection(..))

dynListLF :: Placer -> F (Int, DynFMsg a b) (Int, b)
dynListLF :: forall a b. Placer -> F (Int, DynFMsg a b) (Int, b)
dynListLF Placer
lter =
  forall a b c d. F (Either a b) (Either c d) -> F c a -> F b d
loopThroughRightF
    (forall {a} {b}. (a -> [b]) -> F a b
concatMapF forall {a} {a} {b} {a} {a} {b}.
Either (Either a (Either a b)) (a, DynMsg a b)
-> [Either
      (Either (Either a (a, Bool)) (Either a (a, DynMsg a b))) b]
ctrl) (Int
-> LayoutDirection
-> Placer
-> F (Either (Path, LayoutMessage) (Int, Bool)) (Path, Rect)
dynLayoutMgrF Int
0 LayoutDirection
Forward Placer
lterforall {a} {b} {c} {d}.
F a b -> F c d -> F (Either a c) (Either b d)
>+<forall a b.
F a b -> F (Either (Path, Rect) a) (Either (Path, LayoutMessage) b)
userLayoutF forall a b. F (Int, DynFMsg a b) (Int, b)
dynListF)

ctrl :: Either (Either a (Either a b)) (a, DynMsg a b)
-> [Either
      (Either (Either a (a, Bool)) (Either a (a, DynMsg a b))) b]
ctrl Either (Either a (Either a b)) (a, DynMsg a b)
msg =
  case Either (Either a (Either a b)) (a, DynMsg a b)
msg of
    Right dyn :: (a, DynMsg a b)
dyn@(a
i,DynMsg a b
dynmsg) ->
      case DynMsg a b
dynmsg of
        DynCreate b
_ -> [forall {a} {a} {b} {b}. a -> Either (Either (Either a a) b) b
toMgrDyn (a
i,Bool
True),forall {a} {a} {a} {b}. a -> Either (Either a (Either a a)) b
toDyn (a, DynMsg a b)
dyn]
	DynMsg a b
DynDestroy -> [forall {a} {a} {b} {b}. a -> Either (Either (Either a a) b) b
toMgrDyn (a
i,Bool
False),forall {a} {a} {a} {b}. a -> Either (Either a (Either a a)) b
toDyn (a, DynMsg a b)
dyn]
	DynMsg a
_ -> [forall {a} {a} {a} {b}. a -> Either (Either a (Either a a)) b
toDyn (a, DynMsg a b)
dyn]
    Left (Left a
pp) -> [forall {a} {a} {b} {b}. a -> Either (Either a (Either a b)) b
toDynL a
pp]
    Left (Right (Left a
ll)) -> [forall {a} {b} {b} {b}. a -> Either (Either (Either a b) b) b
toMgr a
ll]
    Left (Right (Right b
x)) -> [forall {b} {a}. b -> Either a b
out b
x]

toDyn :: a -> Either (Either a (Either a a)) b
toDyn=forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. b -> Either a b
Rightforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. b -> Either a b
Right
toDynL :: a -> Either (Either a (Either a b)) b
toDynL=forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. b -> Either a b
Rightforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> Either a b
Left
toMgr :: a -> Either (Either (Either a b) b) b
toMgr=forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> Either a b
Left
toMgrDyn :: a -> Either (Either (Either a a) b) b
toMgrDyn=forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> Either a b
Leftforall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. b -> Either a b
Right
out :: b -> Either a b
out=forall a b. b -> Either a b
Right