Re: Using the GHC API to write an interpreter

2016-06-28 Thread Evan Laforge
On Tue, Jun 28, 2016 at 12:15 PM, Christopher Done wrote: > Thanks! It's strange to think there was once no GHCi. This is an interesting > piece of Haskell implementation history! =) It was really exciting when ghci showed up. No need to separately load everything into

Re: Using the GHC API to write an interpreter

2016-06-27 Thread Simon Marlow
On 27 June 2016 at 13:31, Christopher Done wrote: > On 27 June 2016 at 10:01, Simon Marlow wrote: > > On 26 June 2016 at 11:28, Christopher Done wrote: > >> > >> I've been pondering how feasible it would be to: > >> > >> * Compile

Re: Using the GHC API to write an interpreter

2016-06-27 Thread Christopher Done
On 27 June 2016 at 10:01, Simon Marlow wrote: > On 26 June 2016 at 11:28, Christopher Done wrote: >> >> I've been pondering how feasible it would be to: >> >> * Compile in stages a module with the byte code linker >> * Keep hold of the Core source >> *

Re: Using the GHC API to write an interpreter

2016-06-27 Thread Christopher Done
On 27 June 2016 at 04:11, Edward Z. Yang wrote: > I don't understand what the bytecode format has to do here. Since > your suggestion is to just store Core you can just compile to object > code. True, I could compile to either as long as I can link it dynamically. > > Any input

Re: Using the GHC API to write an interpreter

2016-06-27 Thread Simon Marlow
On 26 June 2016 at 11:28, Christopher Done wrote: > I've been pondering how feasible it would be to: > > * Compile in stages a module with the byte code linker > * Keep hold of the Core source > * Interpret the Core AST within Haskell > Interestingly, the first

Re: Using the GHC API to write an interpreter

2016-06-26 Thread Edward Z. Yang
I am not sure I entirely understand your proposal, but a good way of finding out if it works is giving it a try. Excerpts from Christopher Done's message of 2016-06-26 06:28:55 -0400: > I've been pondering how feasible it would be to: > > * Compile in stages a module with the byte code linker >

Using the GHC API to write an interpreter

2016-06-26 Thread Christopher Done
I've been pondering how feasible it would be to: * Compile in stages a module with the byte code linker * Keep hold of the Core source * Interpret the Core AST within Haskell * When encountering built-in/primitives (or things from other libraries), we compile that Core term and link it as an