Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-06 Thread Greg Weber
I created a GHC patch that spits out the generated Template Haskell code to a file with -dump-to-file -ddump-splices https://ghc.haskell.org/trac/ghc/ticket/9126 On Sat, Jul 5, 2014 at 8:18 PM, adam vogt vogt.a...@gmail.com wrote: Zeroth takes the first approach. It only supports a subset of

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread Scott Turner
] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker. GHCJS has supported TH for a long time now, but so far always relied on native (host) code for it. This is the main reason that GHCJS always builds native and JavaScript code for everything (another

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread Carter Schonwald
mechanical subtasks) On Wed, Jul 2, 2014 at 12:14 PM, Luite Stegeman stege...@gmail.com wrote: hi all, I've added some code [1] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker. GHCJS has supported TH for a long time now, but so far

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread Brandon Allbery
On Sat, Jul 5, 2014 at 1:34 PM, Carter Schonwald carter.schonw...@gmail.com wrote: does JHC support template haskell? Pretty sure TH is too closely tied to ghc. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread John Meacham
Actually, I was looking into it a little, and template haskell could effectively be implemented by a pre-processor and a portable library that is compiler independent. If one could get ghc to spit out the template haskell source after it expands it then that can be fed to jhc as a quick first

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread John Meacham
The target compiler would have the TH libraries, which could be made to be portable. The external program would just extract the TH bits and turn them into a program that spits the TH expanded output to a new file to compile, and repeat the process til no TH expansions exist and finally that is

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread Luite Stegeman
/template-haskell-2.9.0.0/docs/Language-Haskell-TH-Syntax.html , the Quasi class for the required functionality). This would mean serializing all names with types modules, annotations, instances. I briefly looked into this for GHCJS but decided that just querying the compiler would be better. On Sat

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-05 Thread adam vogt
Zeroth takes the first approach. It only supports a subset of TH (DecsQ splices) however. http://hackage.haskell.org/package/zeroth https://github.com/aavogt/zeroth is a fork that works with more recent haskell-src-exts and ghc On Sat, Jul 5, 2014 at 3:59 PM, John Meacham j...@repetae.net

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-04 Thread Luite Stegeman
and making maintaining it harder, then I’m open to your proposals. I think most of the communication code could go into a separate executable that can be built by the user for the target-specific communication. The GHC API facing part of the implementation in GHCJS is under 300 lines

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-04 Thread John Meacham
on concrete mechanical subtasks) On Wed, Jul 2, 2014 at 12:14 PM, Luite Stegeman stege...@gmail.com wrote: hi all, I've added some code [1] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker. GHCJS has supported TH for a long time now, but so far

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-03 Thread CJ van den Berg
Yes! This would definitely be of great interest to users of the Android cross compilers. It should be quite feasible to drive a TH runner process on a development device or emulator. Having genuine TH support would be a huge improvement to the usefulness of GHC in a cross compiling scenario. I

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-03 Thread Luite Stegeman
I think GHC could use more or less the same communication method as GHCJS now does: Start some user-specifiied process and send messages through pipes (GHCJS uses stdin/stderr of the node process), with the difference that it would get dynamic libraries for the target rather than blobs of JS code

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-03 Thread John Meacham
] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker. GHCJS has supported TH for a long time now, but so far always relied on native (host) code for it. This is the main reason that GHCJS always builds native and JavaScript code for everything (another

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-03 Thread Dominick Samperi
tooling into 7.10, i'm all for it :) (and willing to help on concrete mechanical subtasks) On Wed, Jul 2, 2014 at 12:14 PM, Luite Stegeman stege...@gmail.com wrote: hi all, I've added some code [1] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker

GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-02 Thread Luite Stegeman
hi all, I've added some code [1] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using the GHC linker. GHCJS has supported TH for a long time now, but so far always relied on native (host) code for it. This is the main reason that GHCJS always builds native

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-02 Thread Carter Schonwald
wow, this is great work! If theres a clear path to getting the generic tooling into 7.10, i'm all for it :) (and willing to help on concrete mechanical subtasks) On Wed, Jul 2, 2014 at 12:14 PM, Luite Stegeman stege...@gmail.com wrote: hi all, I've added some code [1] [2] to GHCJS to make

Re: GHCJS now runs Template Haskell on node.js - Any interest in out of process TH for general cross compilation?

2014-07-02 Thread Carter Schonwald
the generic tooling into 7.10, i'm all for it :) (and willing to help on concrete mechanical subtasks) On Wed, Jul 2, 2014 at 12:14 PM, Luite Stegeman stege...@gmail.com wrote: hi all, I've added some code [1] [2] to GHCJS to make it run Template Haskell code on node.js, rather than using

GHCJS, JavaScript, cross-platform typechecking with the GHC API and primops

2013-01-25 Thread Luite Stegeman
hi all, I've been working on GHCJS [1] for a while and am trying to get it to work on 64 bit GHC. A quick background: GHCJS uses the GHC API to generate STG, which it then translates to JavaScript. It uses slightly patched versions of the integer-gmp, base and ghc-prim libraries and supports

Re: Compiling ghcjs

2012-07-02 Thread Simon Marlow
On 27/06/2012 13:24, Nathan Hüsken wrote: I hope this is the correct list to ask this question. I am trying to compile the ghcjs compiler. I am on ubuntu 12.04 and have ghc-7.4.1 installed (via apt-get). I am following the instruction I found here: https://github.com/ghcjs/ghcjs The first

Compiling ghcjs

2012-06-27 Thread Nathan Hüsken
Hi, I hope this is the correct list to ask this question. I am trying to compile the ghcjs compiler. I am on ubuntu 12.04 and have ghc-7.4.1 installed (via apt-get). I am following the instruction I found here: https://github.com/ghcjs/ghcjs The first trouble comes with git pull ghcjs. I get

Re: GHCJS

2011-08-05 Thread Simon Marlow
On 04/08/2011 21:02, Simon Peyton-Jones wrote: | data LiteralDesugaring m = |LiteralDesugaring | { desugarInt :: MonadThings m = Integer - m CoreExpr | , desugarWord :: MonadThings m = Integer - m CoreExpr ... I am not sure why you want to control the desugaring of literals.

Re: GHCJS

2011-08-04 Thread Victor Nazarov
to predict exactly what's needed.  Again, I suggest you try doing this and send us a patch. I think I should do it. From GHCJS perspective I need to abstract out literal desugaring and foreign exports/imports desugaring. Desugarer uses these functions from MkCore module now: mkIntExpr :: Integer

RE: GHCJS

2011-08-04 Thread Simon Peyton-Jones
| data LiteralDesugaring m = |LiteralDesugaring | { desugarInt :: MonadThings m = Integer - m CoreExpr | , desugarWord :: MonadThings m = Integer - m CoreExpr ... I am not sure why you want to control the desugaring of literals. Why literals? And why is literals enough? | But

RE: GHCJS

2011-08-04 Thread Simon Peyton-Jones
| So then parseDynamicFlags should be split into two layers, the lower | layer returning unused flags, and the upper layer generating errors. | | It's not that simple. In | ghcjs -O -someflag something -Wall | is something an argument to someflag, or a file to be compiled? It think

Re: GHCJS

2011-08-04 Thread Victor Nazarov
On Fri, Aug 5, 2011 at 12:02 AM, Simon Peyton-Jones simo...@microsoft.com wrote: |  data LiteralDesugaring m = |    LiteralDesugaring |      { desugarInt :: MonadThings m = Integer - m CoreExpr |      , desugarWord :: MonadThings m = Integer - m CoreExpr ... I am not sure why you want to

RE: GHCJS

2011-08-03 Thread Simon Peyton-Jones
that [CoreBind] into JavaScript | == Command line interface == | This works, but I'm not allowed to parse some custom flags used by | GHCJS code and not by GHC API. | ParseDynamicFlags throws UsageError if it encounters some unknown flags. So perhaps that's the problem. parseDynamicFlags could

Re: GHCJS

2011-08-03 Thread Victor Nazarov
interface == | This works, but I'm not allowed to parse some custom flags used by | GHCJS code and not by GHC API. | ParseDynamicFlags throws UsageError if it encounters some unknown flags. So perhaps that's the problem. parseDynamicFlags could perfectly well simply return any un-recognised flags

Re: GHCJS

2011-08-03 Thread Victor Nazarov
as used with C-call. * cross-compilation. GHCJS doesn't work properly on 64bit systems. Javascript lacks real integers and we need to emulate them with Javascript bit-operations. But all javascript bit-operations work with 32 bits. To make Javascript code readable and fast we need to make Haskell

Re: GHCJS

2011-08-03 Thread Simon Marlow
On 03/08/2011 11:09, Victor Nazarov wrote: On Wed, Aug 3, 2011 at 11:30 AM, Simon Peyton-Jones simo...@microsoft.com wrote: So perhaps that's the problem. parseDynamicFlags could perfectly well simply return any un-recognised flags. Indeed, I thought it did just that -- it certainly

Re: GHCJS

2011-08-03 Thread Christiaan Baaij
arguments if they are something like filenames, but it throws error if un-consumed argument starts with dash. Maybe you can wrap the GHCJS into a plugin now that plugin support is finally in GHC 7.2.* , and generate the javascript as a side-effect [1]? Then you can pass option specifically to GHCJS

Re: GHCJS

2011-08-03 Thread Brandon Allbery
On Wed, Aug 3, 2011 at 11:55, Christiaan Baaij christiaan.ba...@gmail.comwrote: So perhaps that's the problem. parseDynamicFlags could perfectly well simply return any un-recognised flags. Indeed, I thought it did just that -- it certainly returns a list of un-consumed arguments. If it

Re: GHCJS

2011-08-03 Thread Ian Lynagh
then parseDynamicFlags should be split into two layers, the lower layer returning unused flags, and the upper layer generating errors. It's not that simple. In ghcjs -O -someflag something -Wall is something an argument to someflag, or a file to be compiled? I think the best approach is to make

GHCJS

2011-08-02 Thread Victor Nazarov
Hello, I'm a maintainer and creator of GHCJS tool [1]. GHCJS currently uses GHC API to produce Javascript code from Haskell sources. There is a great interest to the project, but there have been little progress recently. I'm considering the future of it and I'd like to get some advices

Re: GHCJS

2011-08-02 Thread Edward Z. Yang
and return the rest GHC's flags untouched. Your best bet is to use '--' or something similar to demarcate GHCJS flags, and GHC flags, and then manually split them up before passing them off to your preferred command line parser. Though this vaguely sounds like something that might be nice

Re: GHCJS

2011-08-02 Thread Brandon Allbery
, but I would like to support exports and static/dynamic wrappers. GHC generates C-code to support them, and GHCJS should generate Javascript-code, but I have no idea how to use GHC API to generate custom (Javascript) stubs. Is it possible at all? That is certainly not; you'll need to patch

Re: GHCJS

2011-08-02 Thread John Lask
on javascript keyword. For now I'm using (abusing) ccall calling convention and simple imports works pretty well, but I would like to support exports and static/dynamic wrappers. GHC generates C-code to support them, and GHCJS should generate Javascript-code, but I have no idea how to use GHC API

Re: GHCJS

2011-08-02 Thread Brandon Allbery
On Wed, Aug 3, 2011 at 00:31, John Lask jvl...@hotmail.com wrote: What is really required is a pluggable back-end infrastructure - whereby various back-ends could be maintained (or not) at the discretion of their originators and separate to the official ghc back-ends. I guess I'm confused; I

Re: GHCJS

2011-08-02 Thread John Lask
On 3/08/2011 2:10 PM, Brandon Allbery wrote: On Wed, Aug 3, 2011 at 00:31, John Laskjvl...@hotmail.com wrote: What is really required is a pluggable back-end infrastructure - whereby various back-ends could be maintained (or not) at the discretion of their originators and separate to the