Skip to content

Instantly share code, notes, and snippets.

May 16, 2016 10:39:43 AM org.apache.fontbox.util.FontManager findTTFontname
WARNING: Font not found: TimesNewRomanPS-BoldMT
May 16, 2016 10:39:43 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <> from <AKCNGD+Cmex9> to the default font
May 16, 2016 10:39:43 AM org.apache.pdfbox.pdmodel.font.PDSimpleFont drawString
WARNING: Changing font on <> from <AKCNGD+Cmex9> to the default font
May 16, 2016 10:39:43 AM org.apache.pdfbox.pdmodel.font.PDTrueTypeFont getawtFont
INFO: Can't find the specified font Arial-Black
May 16, 2016 10:39:43 AM org.apache.fontbox.util.FontManager findTTFontname
WARNING: Font not found: Arial-Black
class (MonadPlus m) => MonadLogic m where
-- | Attempts to split the computation, giving access to the first
-- result. Satisfies the following laws:
--
-- > msplit mzero == return Nothing
-- > msplit (return a `mplus` m) == return (Just (a, m))
msplit :: m a -> m (Maybe (a, m a))
-- | Fair disjunction. It is possible for a logical computation
-- to have an infinite number of potential results, for instance:
x@nixos ~/t3/ghcjs-websockets-reflex$ cabal2nix . ~/t3/ghcjs-websockets-reflex
{ mkDerivation, base, binary, bytestring, containers
, ghcjs-websockets, lens, reflex, reflex-dom, stdenv, text
, transformers
}:
mkDerivation {
pname = "ghcjs-websockets-reflex";
version = "0.1";
src = ./.;
libraryHaskellDepends = [
@haskellwukong
haskellwukong / reflex.org
Created October 28, 2015 17:07 — forked from bennofs/reflex.org
reflex notes

Module overview

Reflex.Class: generic definition of FRP, operations on Events / Behaviors

provides functions for working with events and behaviors

should be imported by users of an FRP-based framework

does not deal with connecting to the outside world, for example creating events from external sources

Reflex.Dynamic: discrete behaviors

Provides the Dynamic data type, a combination of Behavior and Event

Behavior always contains the current value, Event is fired whenever current value changes

-> Behavior is only updated at the end of the current frame, after event propagation

Reflex.Host.Class: generic framework implementation support

[nix-shell:~/torch-pkg]$ luarocks install cwrap
Error: Your user does not have write permissions in /nix/store/vniy48rrb3ip7avdc5cwmgdhsqrqfk3y-luarocks-2.2.2
-- you may want to run as a privileged user or use your local tree with --local.
I have a mental model where:
entire FRP program = a directed graph
directed edge from node A -> node B IFF node B dependes on node A, i.e.
B = A + C -- here, we have edges (A -> B), (C -> B)
each node contains:
* current value (or "last" value)
* function to be called whenever an incoming arrow's node changes it's value
-- 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
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);
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
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