Skip to content

Instantly share code, notes, and snippets.

{ haskellPackages, platform }:
with haskellPackages;
[
##############################################################################
# Add general packages here #
##############################################################################
reflex
reflex-dom
x@nixos ~/c/server$ ls ~/c/server
default.nix
x@nixos ~/c/server$ cat default.nix ~/c/server
{ mkDerivation, array, base, bytestring, containers, directory
, dlist, either, lens, mtl, optparse-applicative, parsec
, process, product-profunctors, safe, semigroups
, stdenv, template-haskell, text, text-format, time, transformers
}:
mkDerivation {
pname = "verify";
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, array, base, bytestring, containers
, directory, dlist, either, ghcjs-dom, lens, mtl
, optparse-applicative, parsec, process, product-profunctors
, safe, semigroups, stdenv, template-haskell, text
svgElAttr :: MonadWidget t m
=> String
-> Map String String
-> m a
-> m a
svgElAttr string ats child = do
(_,c) <- svgElAttr' string ats child
return c
svgElAttr' :: (MonadWidget t m, Attributes m attrs)
build/try-reflex/try-reflex --option build-use-substitutes false
If you have any trouble with this script, please submit an issue at https://github.com/ryantrinkle/try-reflex/issues
Entering the reflex sandbox...
download-from-binary-cache.pl: still waiting for ‘https://ryantrinkle.com:5443/rx89bv9rywv6kghkbjvyx2692nbfyf9r.narinfo’ after 5 seconds...
x@nixos ~$ build/try-reflex/try-reflex ~
If you have any trouble with this script, please submit an issue at https://github.com/ryantrinkle/try-reflex/issues
Entering the reflex sandbox...
download-from-binary-cache.pl: still waiting for ‘https://ryantrinkle.com:5443/rx89bv9rywv6kghkbjvyx2692nbfyf9r.narinfo’ after 5 seconds...
download-from-binary-cache.pl: could not download ‘https://ryantrinkle.com:5443/rx89bv9rywv6kghkbjvyx2692nbfyf9r.narinfo’ (Curl error 7)
download-from-binary-cache.pl: still waiting for ‘https://ryantrinkle.com:5443/rx89bv9rywv6kghkbjvyx2692nbfyf9r.narinfo’ after 5 seconds...
download-from-binary-cache.pl: could not download ‘https://ryantrinkle.com:5443/rx89bv9rywv6kghkbjvyx2692nbfyf9r.narinfo’ (Curl error 7)
building path(s) ‘/nix/store/rx89bv9rywv6kghkbjvyx2692nbfyf9r-nixpkgs-00a52d4’
exporting git://github.com/ryantrinkle/nixpkgs (rev 00a52d4cc5158611de0a73abcb15fa2d
a :: Event t a
b = fmap f a :: Event t b
internal representation of a:
* for push events, when 'a' is updated,
everything that depends on 'a' needs to be updated
* therefore, there needs to be *SOME TYPE* of reference from a to b
now, when nothing else depends on 'b'
'b' should really "unsubscribe" from a
Facts:
Suppose I have a JS FFI, where I have the following two operations:
data Location = Location Double Double -- x y
data Foo = some abstract type
addMarker :: Location -> IO Foo
addMarker (Location x y) = adds a marker at point (x,y), returns some "identifier" Foo, not necessairly a DOM element
Question 1: Why is the following a loop?
do rec {
sample (current d);
d <- hold "foo" never
}
Question 2: Is this also a loop?
do rec {
d <- hold "foo" never
sample (current d);
-- reflex code
listWithKey :: forall t k v m a. (Ord k, MonadWidget t m) => Dynamic t (Map k v) -> (k -> Dynamic t v -> m a) -> m (Dynamic t (Map k a))
listWithKey vals mkChild = do
postBuild <- getPostBuild
rec sentVals :: Dynamic t (Map k v) <- foldDyn (flip applyMap) Map.empty changeVals
let changeVals :: Event t (Map k (Maybe v))
changeVals = attachWith diffMapNoEq (current sentVals) $ leftmost
[ updated vals
, tag (current vals) postBuild