mirror of
https://github.com/chrisdone-archive/duet.git
synced 2024-10-05 21:57:49 +03:00
Update value in meta map
This commit is contained in:
parent
be81af0aad
commit
83dda2d479
29
web/IDE.hs
29
web/IDE.hs
@ -351,28 +351,21 @@ newEditor (Editor printer parser renderer) input@(Input value focus) initialValu
|
||||
currentValuesEv <-
|
||||
switchPromptly never (fmapMaybe (pure . outputValue) streamsEv)
|
||||
metas <- holdDyn (constDyn mempty) (fmapMaybe (pure . outputMeta) streamsEv)
|
||||
metaDyn <-
|
||||
mapDyn
|
||||
(M.insert
|
||||
uuid
|
||||
(Meta
|
||||
{ metaNode = cons initialValue
|
||||
, metaParent = Nothing
|
||||
, metaChildren = mempty
|
||||
}))
|
||||
(joinDyn metas)
|
||||
pure
|
||||
( Output
|
||||
{ outputValue =
|
||||
let outputValueEvent =
|
||||
fmapMaybe
|
||||
(either (const Nothing) Just)
|
||||
(leftmost
|
||||
[ updated parseResultDyn
|
||||
, fmapMaybe (pure . Right) currentValuesEv
|
||||
])
|
||||
, outputMeta = metaDyn
|
||||
[updated parseResultDyn, fmapMaybe (pure . Right) currentValuesEv])
|
||||
currentValueDyn <- holdDyn initialValue outputValueEvent
|
||||
let makeMeta v =
|
||||
Meta
|
||||
{ metaNode = cons v
|
||||
, metaParent = Nothing
|
||||
, metaChildren = mempty
|
||||
}
|
||||
, uuid)
|
||||
metaDyn <-
|
||||
combineDyn (M.insert uuid . makeMeta) currentValueDyn (joinDyn metas)
|
||||
pure (Output {outputValue = outputValueEvent, outputMeta = metaDyn}, uuid)
|
||||
where
|
||||
visibilityToggler f =
|
||||
mapDyn
|
||||
|
Loading…
Reference in New Issue
Block a user