mirror of
https://github.com/typeable/reflex-dom-extra.git
synced 2024-09-11 18:57:48 +03:00
add joinEE
This commit is contained in:
parent
67ce72a3f8
commit
2514d9d719
@ -21,6 +21,7 @@ library
|
|||||||
, jsaddle
|
, jsaddle
|
||||||
, lens
|
, lens
|
||||||
, reflex-dom
|
, reflex-dom
|
||||||
|
, semialign
|
||||||
, text
|
, text
|
||||||
if impl(ghcjs)
|
if impl(ghcjs)
|
||||||
build-depends:
|
build-depends:
|
||||||
|
@ -3,12 +3,15 @@ module Reflex.Dom.Extra where
|
|||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad.Fix
|
import Control.Monad.Fix
|
||||||
|
import Data.Bitraversable
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.Map as M
|
import Data.Map as M
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Text as T hiding (zip, map)
|
import Data.Text as T hiding (zip, map)
|
||||||
|
import Data.Zip as Z
|
||||||
import Language.Javascript.JSaddle
|
import Language.Javascript.JSaddle
|
||||||
|
import Prelude hiding (zip, unzip, zipWith)
|
||||||
import Reflex.Dom
|
import Reflex.Dom
|
||||||
import JavaScript.Object.Internal as JS
|
import JavaScript.Object.Internal as JS
|
||||||
|
|
||||||
@ -180,12 +183,14 @@ form :: DomBuilder t m => Map Text Text -> m a -> m a
|
|||||||
form attrs = elAttr "form" attrs
|
form attrs = elAttr "form" attrs
|
||||||
|
|
||||||
-- | Join event of event into single event.
|
-- | Join event of event into single event.
|
||||||
joinE
|
joinE :: (Reflex t, MonadHold t m) => Event t (Event t a) -> m (Event t a)
|
||||||
:: (Reflex t, MonadHold t m)
|
|
||||||
=> Event t (Event t a)
|
|
||||||
-> m (Event t a)
|
|
||||||
joinE = switchHold never
|
joinE = switchHold never
|
||||||
|
|
||||||
|
joinEE
|
||||||
|
:: (Reflex t, MonadHold t m)
|
||||||
|
=> Event t (Event t a, Event t b) -> m (Event t a, Event t b)
|
||||||
|
joinEE = bitraverse joinE joinE . Z.unzip
|
||||||
|
|
||||||
-- | Separate an event to two sequences based on given predicate.
|
-- | Separate an event to two sequences based on given predicate.
|
||||||
-- The first element of resulting pair keeps events for which the predicate
|
-- The first element of resulting pair keeps events for which the predicate
|
||||||
-- holds, the second -- those for which it doesn't.
|
-- holds, the second -- those for which it doesn't.
|
||||||
|
Loading…
Reference in New Issue
Block a user