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
35
web/IDE.hs
35
web/IDE.hs
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user