Open clinuxrulz opened 6 years ago
You have also done some really nice work here: https://gist.github.com/paf31/5c1279796d66fe04a177e34b0d674ac6
That would restore HOAS for IncF
definition above. Just would require the end-user to use the lam
function when he is making a lambda.
First of all Congratulations on your purescript-incremental-functions / purescript-purview. You've managed to completely eliminate the need for virtual dom diffing. However it seems like the entire dom model is still calculated each time, and the final real dom is then updated incrementally. This is still good because in frameworks like React you still do calculate the entire virtual dom, then a diffing algorithm is executed to modify only a part of the real dom. So you've still saved on diffing the dom.
There might be a way to update each intermediate state incrementally a long a chain of incremental functions.
Currently you have
data Jet a = Jet a (Change a)
. Giving a incremental function froma
tob
the following form(a,Δa) -> (b,Δb)
. Say your composing some functions together E.g.Each time a new
Δa
fires down the chain of functions,b
is recalculated,c
is recalculated andd
is recalculated. The functions need some way of maintaining the lasta
,b
,c
for reuse on the next iteration.Now if we change the definition to something like:
Then we will lose HOAS, leading to the end-user having to use point-free notation.
Something else can be done:
data Jet a = Jet (Cell a) (Stream (Change a))
Cell
andStream
are from a FRP library of your choice. You can now compose incremental functions, have access to past values ofa
,b
andc
. And also you get to keep HOAS.The FRP library you choose would have to support forward references, and I'd recommend the ability to handle simultaneous stream events (i.e. can bust
Stream (a,b)
intoStream a
, andStream b
, and combined those back intoStream (a,b)
that works exactly the same as the original.)I'd recommend a purescript wrapper arround the typescript version of sodium. And not the
purescript-sodium
I wrote years ago, its operational semantics are not correct.