[Haskell-cafe] OT - targeting many systems

Dan Burton danburton.email at gmail.com
Mon Jan 13 21:50:38 UTC 2014


I think the closest existing thing to what you have described is Roy:

http://roy.brianmckenna.org/

Roy is a delightful "it's just JavaScript" language with some type/safety
checking and syntactic sugar. From my extremely limited experience with
Roy, it's still very alpha, and it's one of those "not quite Haskell
syntax" experiences that will bite you if you forget. Roy is strict by
default.

Eg haxe already allows me to write code like such - and then compile it
> twice: once to create a .js file, once to create server side
> js/php/neko/whatsoever.


That sounds a lot like what Fay is used for. You can share some .hs files
between server-side and client-side code. And Fay is "just [a subset of]
Haskell," which is really nice. Fay is lazy by default.

https://github.com/faylang/fay/wiki

-- Dan Burton


On Mon, Jan 13, 2014 at 1:15 PM, Marc Weber <marco-oweber at gmx.de> wrote:

> I love Haskell, and it gets many things right.
> However eg its hard to target JS in an efficient way.
> Sometimes I just need a quick and dirty (somewhat typesafe)
> program which gets the job done - sometimes its js, sometimes a tool in
> console, sometimse web/client code (also smartphone applets).
>
> haxe.org comes close, but while the language is fun to use it still has
> some shortcomings - and sometimes I hit unexpected bugs.
>
> The real question I have is:
> - Haskell is cool
> - being lazy is cool
> - having OO is cool (because you can target Java/Flash/.. easily)
> - how to get best of all worlds?
>
> So I think about creating my own language is should look like more like
> a source code generator than language which contains different sub
> universes. The idea is to code some parts - such as a parser - in a
> Haskell like dialect, then reuse it in quick and dirty OO world (Java
> like).
>
> Of course additional targets could be just plain old C, because C++ is
> known to be very complex - and there are tons of legacy code which
> should be maintained (such as Vim) - but there is no true upstream,
> because coding C takes so much more time.
> I also just don't get why it should not be possible to write code once
> (such as parsing snippets or highlighting), then reuse it for Vim,
> Emacs, Yi, ..
> There is no way, you cannot merge such editors - but eventually there is
> a way to "code once" and compile down to elisp, C, Haskell ...
> Live is too short to duplicate much work ..
>
> I'm writing to this mailinglist because the knowledge in the Haskell
> community is incredible - and I want to know
>
> * who would join such an effort (maybe write drafts, get funded by
>   kickstarter)
>
> * does such attempt already exist ?
>
> Languages like impredicative.com/ur, Haskell, lisp, Java, Haxe cleary
> also illustrate
> the power of "meta programming" or "source code generation at compile
> time", yet they all come with their own limitations, eg ur cannot create
> generate code which is useful outside of a web server and so on.
> So I feel I'm reinventing the wheel again and again - I'd like to stop
> this.
>
> So the goal would be trying to write "functors/code" which you can
> instantiate with different memeory management models, tell to target
> different backends etc.
>
> I love Haskell, its community and what it achieved, but somehow I feel
> that its only 80% of the true story getting everything done.
>
> Eg haxe already allows me to write code like such - and then compile it
> twice: once to create a .js file, once to create server side
> js/php/neko/whatsoever.
>
>   class FormComponentGeoLocation {
>    new (opts){
>     this.opts = opts;
>    }
>
>   function check(value){
>     // check with regular expression that value has lat lon numbers
>   }
>
>   #if SERVER
>     function assignValuesFromInputs(post_data, values){
>      var value = post_data[opts.name];
>      check(value);
>      values[opts.name] = post_data[opts.name];
>     }
>   #end
>
>   #if js
>     additional client code
>     eg use geo location apis to fill in lat/lon
>
>     function assignValuesFromInputs(values);
>        var value = post_data[opts.name];
>        check(value);
>        values[opts.name] = value;
>      }
>   #end
>
>   }
>
> So this is what I'd call modular code I can reuse which has all logic it
> needs.
>
> While Haskell is great I'm unsure wether it allows me to create modules
> by code (I know about template haskell, but that's only about adding
> code) - and while being lazy is a feature sometimes I'd like to be
> strict. (I know that people work on simplifying this)
>
> ideas/thougts/links/you'd like to join understanding whether such a
> goal would be reachable at all?
>
> Marc Weber
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140113/afa5d1ef/attachment.html>


More information about the Haskell-Cafe mailing list