Update value in meta map

This commit is contained in:
Chris Done 2017-10-14 17:51:13 +01:00
parent be81af0aad
commit 83dda2d479

View File

@ -351,28 +351,21 @@ newEditor (Editor printer parser renderer) input@(Input value focus) initialValu
currentValuesEv <- currentValuesEv <-
switchPromptly never (fmapMaybe (pure . outputValue) streamsEv) switchPromptly never (fmapMaybe (pure . outputValue) streamsEv)
metas <- holdDyn (constDyn mempty) (fmapMaybe (pure . outputMeta) streamsEv) metas <- holdDyn (constDyn mempty) (fmapMaybe (pure . outputMeta) streamsEv)
let outputValueEvent =
fmapMaybe
(either (const Nothing) Just)
(leftmost
[updated parseResultDyn, fmapMaybe (pure . Right) currentValuesEv])
currentValueDyn <- holdDyn initialValue outputValueEvent
let makeMeta v =
Meta
{ metaNode = cons v
, metaParent = Nothing
, metaChildren = mempty
}
metaDyn <- metaDyn <-
mapDyn combineDyn (M.insert uuid . makeMeta) currentValueDyn (joinDyn metas)
(M.insert pure (Output {outputValue = outputValueEvent, outputMeta = metaDyn}, uuid)
uuid
(Meta
{ metaNode = cons initialValue
, metaParent = Nothing
, metaChildren = mempty
}))
(joinDyn metas)
pure
( Output
{ outputValue =
fmapMaybe
(either (const Nothing) Just)
(leftmost
[ updated parseResultDyn
, fmapMaybe (pure . Right) currentValuesEv
])
, outputMeta = metaDyn
}
, uuid)
where where
visibilityToggler f = visibilityToggler f =
mapDyn mapDyn