Repository navigation
Description
https://futureofcoding.org/log#prototype-4
The future work section of my paper talks about visual metaphors for FRP. While I do think this is quite important in order to "democratize visual intuition" (Penrose), I wonder if it's necessary. What if we take normal FRP haskell-ish notation as a starting place and simply augment it with LIVE-ness, such as an interpreted environment, showing data, and evaluating as far as possible even when there are holes (Cyrus Omar's work). Geoff Litt and Paul Chiusano suggested that expressions with holes are just functions with those holes as parameters, and we could put a slider or examples values in there. Always concretions, never pure abstractions.
Here's another idea I've been toying with: Jason's Brennan's notion of a programming environment on an endless canvas, like in Sketch or Photoshop. One thing this could enable is a structure-less structured editor - in that you could put together pieces of expressions in various places and combine them later. I guess this would be similar to Scratch or Blockly... which I don't love... One possibility is to use the layer metaphor from Photoshop as a programmatic abstraction, but I don't know what that would mean exactly yet.
My first thought was to build this as a FP thing first and build my way up to FRP. It could be the data slice-and-dice ninja thing, starting with JSON/CSV slice, dicing, and joining -- this is related to datafun.
But then I went ahead and did a drawings for it as an FRP platform:




Activity
stevekrouse commentedon Nov 14, 2018
The goal is to submit this work to <Programming> in Feb and a good title for the PX workshop (says JE) is "FRP eXperience".
There are a few different levels here:
Infinite canvas drawings
Other tools for inspiration
Worst parts of Reflex/Haskell
But then I thought: let's focus on the really key issue here. What's the highest-leverage improvement to be made? What's the worst part of using Reflex/Haskell now? In the shower note on the right below, it says:
p4 prioritized features
Implementation
JE send me an email:
My response: The only implementation of the FRP I argue for in my paper is Reflex/ghcjs. It doesn't exist in PureScript, Elm, F#, etc. Turns out laziness makes it a lot easier to implement. My next experiment is to try to do it in JS with CycleJS. I've tried this in the past. It's not easy -- it's not built for this use case -- but it seems possible, even cycles. More to follow...
Some other ideas for building this:
## Mid Nov 2018 Many Thoughts
stevekrouse commentedon Dec 3, 2018
making frp easier by having sequential semantics and we abstract to frp - like how joyJS can go from derivative iterative to continuous. logo and Nicky cases language and derivative thinking from inside vs implicit matjmstcal thinking from outside. two sides of same coin?
stevekrouse commentedon Dec 3, 2018
https://futureofcoding.org/log#p4-thinking-for-je-meeting
p4 thinking for JE meeting
{: toc }
Theme of my work
A fun question on Twitter yesterday encouraged me to think a bit broader as to an underlying theme to my work that would encompass this project, as well as other outside of "improving programming" (namely, LogicHub). I'm proud of what I came up with:
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>Some responses about fluid Haskell
Sean McDirmid suggested Haskell for Mac, which is very cool and close to what I want so I installed it, but I wasn't able to see an easy way to get Reflex to work with it...
Luke Iannini apparently worked on a live recompiler for Haskell.
The monadfix people shocked me when they said:
My new thesis is that this fluid Haskell doesn't really exist - at least for most Haskell developers.
Artyom from monadfix was also very kind and commented on my issue about installing intero. Too bad they can't help here!
Biggest experience problems with Haskell/Reflex
I made a full day's effort of trying to steelman Haskell/Reflex and make the experience as good as possible before trying to improve it - yet I just have such distaste for installing and debugging shit in the terminal (as well as using the existing Reflex setup I have) that I wonder if I can simply pull on my memory for the key issues...
1. Speed of feedback loop
The main thing was that speed of feedback on all fronts (syntax, types, output) was so slow and required so many keystrokes. In particular there were times that I could point to places in my code where I just wanted to know the type of something but did not know how to ask Haskell for that information.
2. API Discoverability
In other words, "I have some things. I want some other things. What blocks can I use to go from what I have to what I want?" In Scratch, all the "legos are on the floor" to help with this. I find that the lodash JS library also does a superb job of this. I found the Reflex documentation and the Haskell autocomplete tooling to feel like I'm basically guess and checking.
3. Plumbing code
Such as converting
IntorStringtoTextand back, or worst of all, collapsing higher-order streams. I was very excited to find this extremely helpful video, Real World Reflex last night which has a really wonderful slide to help with this:4. Visualize streams
This includes seeing the "shape" of streams and how streams make up other streams as in rxmarbles.com, as well as watching the live data flow through streams.
5. Direct manipulation
This whole thing won't feel natural without direct or bi-directional manipulation of the output because why not?
Next step ideas
1. Stay in Haskell
Continue working towards a fluid experience in Haskell/Reflex.
2. Build/use JS library/framework
3. Build/use JS Haskell interpreter
4. Build a higher-level system that compiles to JS
I'm going to spend the next ~30 min doing the sketching discussed above in preparation for my meeting in a few hours with JE.
stevekrouse commentedon Dec 3, 2018
https://futureofcoding.org/notes/jonathan-edwards/11-21-18
stevekrouse commentedon Dec 3, 2018
https://futureofcoding.org/log#fluidity-vs-structure
Fluidity vs structure
I need to spend some time defining fluidity and structure, but this graph feels provocative:
I think fluidity has to do with live-ness, feedback loop speed, incremental actions causing incremental result, etc. And structure has to do with possible / impossible states, types, schemas. I'm stuck on where AST editors fit in this layout: they enable greater feedback loop speed knowledge of errors and prevent error states, yet they are not as fluid as using text but text doesn't give you as much info as fast.
One interesting note is that Airtable is particularly noteworth as having high structure and also high fluidity.
Conal -> Turbine
Just as I decided (in the last meeting with JE) to build or find a JS lib for DCTP, I popped onto Twitter to find this:
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>Which led me back to Turbine, which I had found a few months back and mistakenly disregarded as the "wrong kind of FRP" as mistakenly interpreted their Now monad thing. I'm now quite excited about this library! I already sent two long emails to the creator, Simon, and hope he responds soon. Here's what I wrote I'd like to collaborate on:
And after we/I work on these more pressing issues, the next step will be building a layer on top of that Turbine that would make the development experience much better. That is, building a GUI that "compiles" to Turbine, for example, kind of in the spirit of Conal's Tangible Functional Programming. Here I am referring to more radical ideas than improving the documentation or a simple devtool, such a projectional editor in the spirit of Lamdu, Luna, Isomorf, Dark, Unison, and Hazel.
stevekrouse commentedon Dec 3, 2018
https://futureofcoding.org/log#p4-thoughts-12318
p4 thoughts 12/3/18
Start with non UI motivating problems
A way to simplify this problem is to build an FP playground to solve normal FP problems with cyclical streams first and work our way up to UI:
The issue with this approach is that we may create a FP playground that won't scale up to cyclical UI problems...
Fluidity is not the initial focus
I realize that part of why structured editors haven't been able to compete with text-based coding is:
It's simply not a fair comparison to expect a new interface to be as fluid as text from Day 1. Of course fluidity is important and of course making it work with people's existing hardware and skills will help with adoption, but they aren't the first things to worry about. Maybe the ultimate interface will require new input hardware and/or a lot of practice to get the hang of. Hopefully we can get away with the keyboard and mouse and make the onboarding simple, but we don't want to pigeonhole ourselves over it.
The initial focus should be on the comprehensibility of the code and the liveness of the experience. Liveness means that an incremental action should result in an incremental result. This is possible without fluidity, which means that "taking the incremental action" may not be ergonomic for some reason.
(However, I will note that fluidity is SUPER important to me. I would love to build an interface that's only optionally dependent on the mouse.)
All Literals are GUIs...
If we throw out text-based coding and agree to a structured editor of some kind, you may realize that we can automatically represent colors as a color picker instead of (or in addition to) a hex value or rgb value. Cyrus Omar has work where he embed's a regex playground right into the IDE. (As Tudor Girba says, whenever you leave the IDE, the "I" has failed.)
If you follow this line of thinking, you realize that ALL literals are GUIs! Numbers can be scrubbable or many other interactive representations, booleans are a checkbox thing... We can even nest GUIs! You could have a string as a widget which is basically a text box but you can add other arbitrary expressions inside - no more escaping characters necessary! Lists can be a specialized GUI where you can add and remove expressions or do comprehensions.
We can continue this idea for all kinds of expressions: if-expressions, pattern-matching, lambdas, function application... Can we build nestable custom GUIs for every part of System F/Haskell?! I think so!
The key here is the nestability. Normally a color picker or other GUI is a top-level thing. But why? I don't see any reason why it can't be as expression-like as coding.
When you define a function it will default to a basic representation but it should allow you to add a more specific GUI to represent your function!
These thoughts were inspired mostly by Tudor Girba, but also are related to Niko Autio's Microeditor ideas.
I am curious how to combine this idea with the ideas of Hazel and Josh's principle of radical visibility of preview evaluation with test data. Same with the hashing stuff. There are so many cool PX ideas to combine together!
Drawing this out will be interesting. And if I can show how we can do any pattern from Haskell, completeness is guaranteed!
In terms of implantation, not sure if HTML or canvas is the way to go. Would be fun to play with Turbine on this project...
## Dec 13, 2018
stevekrouse commentedon Dec 13, 2018
https://futureofcoding.org/log#one-prototype-at-a-time
Now that I'm settled on Turbine (modulus the 15 issues I created, and many more to come), I'm beginning to think about what I hope to build with Turbine: p4.
I was getting a bit overwhelmed with all my ideas for p4. I made a big list and asked JE for help figuring out what's essential and what I can do without for this prototype:
He helped me realize that most of these ideas represent entirely different prototypes! I can't just combine them all like this. Prototypes explore one new idea at a time. So what's the idea for p4?
JE hit the nail on the head: p4 is an IDE for Turbine. This is particularly funny because p1 was an IDE for JQuery and p2 was an IDE for VueJS! Those both used blockly but that wouldn't help with p4 because blocks solve a different problem than what p4 is trying to solve: improve the PX of DCTP, most directly by showing live streams as the user interacts with the output.
On my run a few hours ago, I was thinking about what my data model would be for p4. Then it hit me: Turbine is the data model. (Along with hareactive, io, and jabz.) Those stream data structures are the thing the p4 user is creating.
I could start p4 by building a projectional editor for Turbine/hareactive/io/jabz and all of JS. But can I get away with less?
One way to get away with less is to build a UI for the turbine/hareactive/io/jabz functions/combinators and then have users type regular text js where we need functional expressions (similar to aprt.us and pane).
The other way to do even less is to allow text to be the interaction model for Turbine and simply start with a devtools that shows the streams. If my main conviction is that seeing the streams will help, let's just do that. What's great about this idea is that a stream visualizer is a pre-req for any other p4 end-product anyways, so I might as well just publish it as it's own thing, and then move on afterwards.
In summary, p4 is now the Turbine devtools project, in the spirit of the CycleJS devtools.
Wait... because this feels reachable (I can imagine myself achieving it in early 2019 and it existing), it makes me wonder more about next steps...
All valid answers. The thing is, whatever I do, I need a UI library I love, and that library needs a stream visualizer, so build that first. And then we'll talk.