elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.53k stars 663 forks source link

On Ubuntu 12.04 (32-bit) on AWS EC2 (after fresh install of haskell-platform and yesod-platform): "cabal install elm-yesod" gives error at Language/Elm/Yesod.hs:(65,1)-(73,46) #109

Closed DonaldScott closed 11 years ago

DonaldScott commented 11 years ago

Hello -

As noted in the Issue I posted a few hours ago, I was unable to run 'compile.bat' or 'cabal install elm-yesod' on Windows 7 (64-bit), on Haskell Platform 2012.4.0.0.

Now doing run 'cabal install elm-yesod' produced a different error:

    Could not deduce (ToJavascript String)
      arising from a use of `toJavascript'
    from the context (Yesod master)
      bound by the type signature for
                 mkElmWidget :: Yesod master =>
                                ElmUrl (Route master)
                                -> RenderFn (Route master)
                                -> ScriptLoadPosition master
                                -> GWidget sub master ()
      at Language/Elm/Yesod.hs:(65,1)-(73,46)

Thank you for any help resolving this Issue.

evancz commented 11 years ago

The elm-yesod package is actually written and maintained by someone else, so I do not know a lot about how it or Yesod works.

That package lives here and I think it has fallen behind the latest versions of the compiler. It does not seem right that that would cause these errors, but it may be possible to fork that package and see what is going wrong.

DonaldScott commented 11 years ago

Thank you Evan.

I am very impressed with Elm and I've been working on another email to you to share some of my (highly positive!) initial impressions regarding the language, in particular involving some possibly related work in some other interesting languages. (Maybe I should just post that email here on Elm's GitHub page, so that others could also share it.)

I think what you're doing with Elm represents a major step forward in terms of bringing together the academic/theoretical world of functional programming and the practical world of web programming - both because of the solid foundation of Elm, plus because of your very clear, user-friendly writing style as shown on the elm-lang.org site and in your thesis, as well as your decision to make an online "zero install" compiler available for experimentation.

Elm has serious chances of going on to become a very important language because (a) it has a very solid theoretical foundation and (b) it provides an elegant solution to a major problem: writing web apps.

I have also tried for many years to wrap my head around the various "web application frameworks" in order to do some actual useful work. Recently I have been looking at Yesod, UrWeb (plus a bit of Opa), and also learning about Fay as a possible way of generating JavaScript (as this seems to be the direction where Michael Snoyman, the developer of Yesod, is currently heading - possibly in combination with a JavaScript framework such as AngularJS).

I hadn't really looked at Elm until a few days ago because all I had heard about it was that "it's a whole 'nother language, it's not like Fay which is (a subset of) Haskell". (I mention this because it could be interesting to you from a communications or perceptions standpoint: as an example of what one potential Elm programmer heard early on just by searching on the web.)

But now that I see that Elm can apparently use QuasiQuoting in order to be embedded directly within Yesod, it seems that while Elm may not be written in Haskell, it certianly does seem to be able to compile to Haskell, so I am encouraged about the possibility of use Elm with Yesod, as this should be much cleaner than using any JavaScript or Ajax library.

Since Elm generates HTML, CSS and JavaScript (including Ajax style programming), it seems that Elm might actually subsume all three of the "Shakespearean" languages used with Yesod (Hamlet for HTML, Cassius and Lucius for CSS, and Julius for JavaScript).

I'm not sure what the performance of the webserver supplied with Elm is like (it probably is just intended for development, not deployment).

Meanwhile, there is some encouraging data here about the performance of the server supplied with Yesod, Warp:

http://www.yesodweb.com/blog/2011/03/preliminary-warp-cross-language-benchmarks

http://www.yesodweb.com/blog/2012/11/warp-posa

If the graph in the first link means what I think it does, then it looks like using Yesod's Warp webserver is an excellent high-performance choice for production.

Meanwhile, I don't know how UrWeb's webserver compares performance-wise, as I have not seen benchmarks for it.

I do know that UrWeb generates incredibly tiny web apps - taking up just a few megs of RAM! Apparently UrWeb generates its webserver app based on the programmer's UrWeb project, in a lengthy multi-stage compilation process to ML using some higher-order type constructors from Coq, so I am concerned that while this may be expressive and convenient allowing the programming to work at a "high level of abstraction", I am unsure what this might translate to in terms of UrWeb's webserver performance.

So:

https://www.youtube.com/watch?v=hlyQjK1qjw8

Now that I see the succinct syntax and the solid semantics of Elm (plus the fact that it can apparently be embedded in a Yesod program using QuasiQuoting) I have stopped looking at UrWeb and have spent the last couple of days trying to get more up to speed on Elm, in particular in tandem with Yesod, as it seems like Elm + Yesod might have all the ingredients for doing some real web programming work eventually deploying to a production site.

Again would like I congratulate you on what I feel is really a landmark achievement, bridging the gap between the theoretical/functional world and the practical world of "web app framworks". I think Elm could someday be seen as a landmark or milestone in the history of web programming.

Between the solid theoretical foundations as set forth in your thesis, the excellent practical advantages of being able to do web programming in a functional style, plus your evident efforts to make the whole thing "user-friendly" to newcomers (many of whom may be coming from less formal, non-functional frameworks based on languages such as Ruby, Python, PHP or Perl) via the clarity of your writing style and via nice facilities such as the "zero install" online compiler... it seems that Elm is a very important project and which hopefully will gain momentum as more programmers adopt it.

I will check with that other repository you mentoined on GitHub - and also try to make some sense of Haskell's error messages, which do after all pinpoint some areas in the code which may need to be updated.

evancz commented 11 years ago

Sorry for the delay! Working on a response :) I tend to be slower to reply on github than on the elm-discuss google group (where most of the community discussions happen). I'll try to get my response in order by tomorrow!

For now, thank you so much for your support! The internet is not always so nice, so it really means a lot :)

evancz commented 11 years ago

I'm going to close this for now. I don't know the status of elm-yesod at the moment, but it's outside the scope of the Elm compiler.

Sorry I never gave a proper response to this thread :/ Please move to the email list for more discussion-y type stuff!