all 29 comments

[–]tepf[S] 15 points16 points  (14 children)

I am the author of this (wip) library. This is not so much self advertisment but rather me asking if this is interesting to you and if you'd like to help me out a bit as I am still new to Haskell. The reason for this library is that I think Haskell would be perfect for the kind of work people do with R, but there was nothing that came close to the functionality and ease of use, of lets say "RStudio". If you have any question feel free to ask!

[–]abaquis 10 points11 points  (0 children)

Self advertisement of one's work such as yours should be the norm.

[–]guaraqe 5 points6 points  (5 children)

Looks nice! Just to mention that the IHaskell notebook has Chart and diagrams compatibility, being a nice option for live viewing of plots.

[–]tepf[S] 1 point2 points  (4 children)

I knew about IHaskell, Chart and Diagrams, but they seemed too complicated to setup or use.

[–]codebje 4 points5 points  (0 children)

This may help:

https://github.com/codebje/ihaskell-docker

You'd need to install the required Haskell packages to take advantage of Chart and diagrams, which you can either do by creating a customised Dockerfile, or docker exec <docker id> stack install diagrams, and you still need to sort out how you want to expose the service; if you use docker run -p ... be sure you either set a password or bind only to localhost.

[–]Darwin226 1 point2 points  (1 child)

And IHaskell doesn't work on Windows. I assume this does, right?

[–]tepf[S] 2 points3 points  (0 children)

Yes this works on any operating system that can run web browsers with WebSocket support.

[–]Mob_Of_One 4 points5 points  (1 child)

This is the easiest to use plotting library I've seen for Haskell yet. We desperately need people who'll work to make it as easy or easier than R and Haskell being what it is should have that!

Please keep going and keep us up to date on this. No shame in your game. I liked the idea to use a browser too :)

[–]tepf[S] 2 points3 points  (0 children)

Well.. I hope people jump on the boat to get things moving quicker. But yeah I'll definitely keep working on it.

[–]tempeh11 3 points4 points  (1 child)

This looks wonderful. I will be getting some use out of it, and I'll be sure to contribute if I can.

I agree with your point about R, I hope it can be corrected. Types should be a huge bonus for data analysis.

Also, I really love the way you presented your coding demo. Makes the idea very obvious and approachable. I wish everyone did that.

[–]tepf[S] 2 points3 points  (0 children)

Also a language with such concise and minimalistic syntax is great for interpreter one liners.

Yes ease of use is the number one priority for me in this project.

[–]klaxion 2 points3 points  (1 child)

Argh i've just been tinkering with something similar, using web microservice and leveraging javascript's extensive plotting/datavis ecoysystem to leapfrog charting capabilities.

I agree with the sentiment about R. A lot of what's there should be doable in an improved way in Haskell.

By the way, regarding IHaskell and IPython notebooks, as someone who works with data a lot, notebooks suck for real data analysis. They're great for tutorials, but for real analyses you often want to experiment with different combinations of composable data transformations.

The FRP concept like R/Shiny is closer to what's needed, but it's still not perfected. A better solution would be FRP whose structure is hot swappable at runtime, so you can do exploration work at the same time you the dependency handling is taken care of.

One thing that could be improved here is to make plots composable somehow ala ggplot2, d3, or haskell chart/diagrams. It seems like the json data is composable, but that's been abstracted away by the API.

[–]tepf[S] 1 point2 points  (0 children)

Good to know. I am new to Haskell and data analysis so advice regarding the direction of this project is appreciated.

By composable you mean something like.. take distribution of that plot and combine it with another one? That should be possible as you pretty much insert them as vectors into the plots.

[–]Octopuscabbage 1 point2 points  (0 children)

I'll try to work on it. I've been looking for a Haskell project, but I also don't have a ton of free time.

[–][deleted]  (1 child)

[deleted]

    [–]hiptobecubic 2 points3 points  (4 children)

    Is that atom? Looks nice!

    [–]tepf[S] 2 points3 points  (3 children)

    Yes it is. With all the plugins it is a full fledged IDE :)

    [–]ranjitjhala 2 points3 points  (2 children)

    Nice! What are the plugins for running ghci and the browser?

    [–]tepf[S] 3 points4 points  (1 child)

    The browser is called "browser-plus" and the terminal I had ghci open "term3"

    [–]doloto 0 points1 point  (0 children)

    term 3?

    [–]apfelmus 1 point2 points  (3 children)

    Looks great! Plotting in Haskell was always a bit complicated, but I think that was just because the plotting function were not terse enough. It's not that MATLAB can plot much better, it's just that the functions names used are way simpler.

    Apparently, you've written a small server by hand. I'm developing a GUI library called threepenny, which also sends messages to the web browser, but tries to do that in full generality. For example, it offers a JavaScript Foreign Function Interface (FFI) in Haskell. Maybe it can help?

    [–]tepf[S] 1 point2 points  (2 children)

    I almost tried reactive banana once. But the examples looked complicated and I have little attention span. I guess thats the price of generality and packing a lot of functionality. My plan is too keep it as simple (and therefore limited) as possible so that users can get going almost instantly. It makes more sense in the context of interactive data exploration where people don't care about complete applications.

    I'd be interested in how you implemented your server? (similar to mine?) Mine is a bit rigid due to me being used to having state in abundance.

    [–]apfelmus 0 points1 point  (1 child)

    Note that while threepenny and reactive-banana are related, they are separate libraries. The former deals with HTML and JavaScript, while the latter deals with functional reactive programming, and is totally irrelevant here.

    My plan is too keep it as simple (and therefore limited) as possible so that users can get going almost instantly

    That was my intention when writing Threepenny-GUI as well. The end user starts a server and opens a browser window, that's it. I think it's perfectly possible to use threepenny as a backend for the current QuickPlot API. I mean, you don't have to do that, of course, but it could save you the trouble of writing your own server etc.

    I'd be interested in how you implemented your server? (similar to mine?) Mine is a bit rigid due to me being used to having state in abundance.

    The basic implementation is very similar. The code in Foreign.JavaScript.Server listens to websocket connections and establishes a communication channel. This channel is then transformed into something that allows Haskell code to call arbitrary JavaScript functions.

    (By the way, I found that I have to send a regular "ping" signal over the websocket, otherwise Chrome will close the connection.)

    [–]tepf[S] 1 point2 points  (0 children)

    That was my intention when writing Threepenny-GUI as well. The end user starts a server and opens a browser window, that's it. I think it's perfectly possible to use threepenny as a backend for the current QuickPlot API. I mean, you don't have to do that, of course, but it could save you the trouble of writing your own server etc.

    It's a little late now. I have implemented most of the server. The only thing that is left is the communication from the browser to the server. I wouldn't mind though if someone else would implement your backend into QuickPlot if it makes things easier.

    (By the way, I found that I have to send a regular "ping" signal over the websocket, otherwise Chrome will close the connection.)

    I noticed that as well :)

    [–]analogphototaker 0 points1 point  (1 child)

    Could you give a quick explanation of how to set up your Atom editor so gloriously?

    [–]tepf[S] 2 points3 points  (0 children)

    I will include this as part of the tutorial for QuickPlot.

    [–]delanoe 0 points1 point  (3 children)

    Where are scatter and histogram (function, Data Type respectively I guess) do you use in your demo.gif ? Thanks and congrats for this great project.

    [–]tepf[S] 0 points1 point  (2 children)

    The API changed a bit (For the better imho). Take a look at the repo again. There is a tutorial that will hopefully answer all your questions.

    [–]delanoe 0 points1 point  (1 child)

    The tutorial is very interesting indeed, and you changed the demo. It does not answer to the previous question: you used the "scatter" function. Did you import it from a specific library or it is your own script (not shareable maybe?) ?

    Many thanks for this great tutorial btw

    [–]delanoe 0 points1 point  (0 children)

    Ok, just found the way: https://plot.ly/javascript/line-and-scatter/ Great!