It seems pretty neat, certainly a cool senior thesis! One suggestion if you take this further is to add a "dictionary" or "hash table" type. For practical programming problems, that is pretty necessary. But a really neat project - it's cool to see a functional programming take on the CoffeeScript-style compiling-to-javascript.
Elm: a functional reactive programming language that compiles to JavaScript
11–20 of 51 posts
Re: Elm: a functional reactive programming language that compiles to JavaScript
#12Re: Elm: a functional reactive programming language that compiles to JavaScript
#13One note on the title of this post: Elm compiles to HTML, CSS, and JS. Not just JS! I think this actually an extremely important distinction! It differentiates the project from templating libraries which still ultimately have you think and write in HTML. It also distinguishes it from scripting languages (like CoffeeScript) which also only address part of the problem. With Elm, you shouldn't need the mental model imposed by HTML and CSS which I think will be a really great thing.
Re: Elm: a functional reactive programming language that compiles to JavaScript
#14(Not a criticism -- sing your own praises!)
Re: Elm: a functional reactive programming language that compiles to JavaScript
#15I dig that reactive programming paradigm
Re: Elm: a functional reactive programming language that compiles to JavaScript
#16Hey, this is my project! :) I am surprised it got posted here, but I am also glad to see people are interested. One note on the title of this post: Elm compiles to HTML, CSS, and JS. Not just JS! I think this actually an extremely important distinction! It differentiates the project from templating libraries which still ultimately have you think and write in HTML. It also distinguishes it from scripting languages (li…
Re: Elm: a functional reactive programming language that compiles to JavaScript
#17This surprised me: link has type (String -> String -> String), taking URL and label as arguments, and returning HTML code as a string (instead of as an Element). Then you need to use the text function (String -> Element) to make that link appear properly on the screen. This means that the text function (intentionally?) does not HTML-escape strings, even though examples suggest that it is the recommended way to put so…
- Why is text necessary? Elements are all rectangles that have a uniform set of functions that can be applied to them. Strings are definitely not rectangles, and I think it is important that the type of String and Element are not conflated. In that case what does (++) do when given an Element? It just wouldn't work out.
- Why is text unescaped? That's pretty much an implementation oversight from when I was first starting the project. Strings should be exactly what you intend to display. I have been meaning to go back through and fix up the underlying string representation, but I just don't have time right now. I have been focusing on the theoretical aspects of reactive programming for my thesis which is my main priority at the moment. Nonetheless, this will be fixed eventually!
- Why (link :: String -> String -> String)? My thought when I designed it this way was that part of what it means to be a string includes styling (bold, italic, etc.). Following this idea, this would have to be true of characters as well, so (head (link "/" "Elm")) would give you a character that is a link. I honestly think that's a little weird. I,ve gotten questions about this before, and I'm not exactly sure what the right answer is. The other option is to include an intermediate type of strings that does include style information, but then you need to lift normal strings up to this type to do concatenation (unpleasant). Doing this right is going to be really hard, and I haven't given it the time to really figure it out. I'll probably include ways to use markdown (or HTML) which will alleviate some of these issues. If you have suggestions on this topic I'd be interested to hear. It's harder than it looks :P
Also, let me stress that this project is VERY young, so there are still many kinks to be worked out. There is no download available now. With upcoming thesis deadlines, I probably won't have one up until spring of next year at the earliest. Thank you for your interest! I'm working as fast as I can!
Re: Elm: a functional reactive programming language that compiles to JavaScript
#18This looks lovely. Is the Elm-to-JS compiler posted up anywhere public?
Re: Elm: a functional reactive programming language that compiles to JavaScript
#19Re: Elm: a functional reactive programming language that compiles to JavaScript
#20Contrived, I know, but it looks like in Firefox 8 that happens at around 39k.