Skip to content

Instantly share code, notes, and snippets.

@knaman2609
Last active October 25, 2017 11:07
Show Gist options
  • Save knaman2609/e63bef78631ef82474f4f8962c842c9e to your computer and use it in GitHub Desktop.
Save knaman2609/e63bef78631ef82474f4f8962c842c9e to your computer and use it in GitHub Desktop.
exports.inp1 = function(sub) {
var count = 0;
var b = document.querySelector("body");
b.addEventListener("click", function() {
sub(count + "");
count ++ ;
});
window.SUB = sub;
}
exports.inp2 = function(sub) {
setTimeout(function(){sub("def")}, 1000)
}
import Control.Monad.Eff
import Control.Monad.Eff.Console
import Data.List
import FRP.Behavior
import FRP.Event
import FRP.Event.Time
import Prelude
foreign import inp1 :: Event String
foreign import inp2 :: Event String
inp1Beh = step "inp1" inp1
inp2Beh = step "inp2" inp2
addInp a b = a <> b
inpValidBeh = addInp <$> inp1Beh <*> inp2Beh
main = sample_ inpValidBeh inp1 `subscribe` logShow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment