JP Moresmau | 14 Jan 21:13 2014
Picon

GHC API: runStmt not taking into account reloaded module

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!
However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

Thanks a million!

--
JP Moresmau
http://jpmoresmau.blogspot.com/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Simon Peyton Jones | 15 Jan 10:19 2014
Picon

RE: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

That sounds odd.  Can you make a small reproducible test case, open a ticket, and attach the test?

 

Thanks

 

SImon

 

From: Haskell-Cafe [mailto:haskell-cafe-bounces <at> haskell.org] On Behalf Of JP Moresmau
Sent: 14 January 2014 20:14
To: Haskell Cafe
Subject: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!

However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

 

Thanks a million!

 

--
JP Moresmau
http://jpmoresmau.blogspot.com/

_______________________________________________
ghc-devs mailing list
ghc-devs@...
http://www.haskell.org/mailman/listinfo/ghc-devs
JP Moresmau | 15 Jan 10:40 2014
Picon

Re: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

Thanks Simon, I will write a simple test case and see what happens.

JP


On Wed, Jan 15, 2014 at 10:19 AM, Simon Peyton Jones <simonpj-0li6OtcxBFHby3iVrkZq2A@public.gmane.org> wrote:

That sounds odd.  Can you make a small reproducible test case, open a ticket, and attach the test?

 

Thanks

 

SImon

 

From: Haskell-Cafe [mailto:haskell-cafe-bounces-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org] On Behalf Of JP Moresmau
Sent: 14 January 2014 20:14
To: Haskell Cafe
Subject: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!

However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

 

Thanks a million!

 

--
JP Moresmau
http://jpmoresmau.blogspot.com/




--
JP Moresmau
http://jpmoresmau.blogspot.com/
_______________________________________________
ghc-devs mailing list
ghc-devs@...
http://www.haskell.org/mailman/listinfo/ghc-devs
JP Moresmau | 15 Jan 17:37 2014
Picon

Re: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

While writing a smaller test case, I managed to get a different error, which in turn allowed me to find this: http://www.haskell.org/pipermail/glasgow-haskell-users/2008-May/014841.html. It turns out I had the ghcLink session flag set to NoLink, it works fine with LinkInMemory! I knew it was something stupid!

Thanks, there is no need to open a ticket in the end.

JP


On Wed, Jan 15, 2014 at 10:40 AM, JP Moresmau <jpmoresmau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Thanks Simon, I will write a simple test case and see what happens.

JP


On Wed, Jan 15, 2014 at 10:19 AM, Simon Peyton Jones <simonpj-0li6OtcxBFHby3iVrkZq2A@public.gmane.org> wrote:

That sounds odd.  Can you make a small reproducible test case, open a ticket, and attach the test?

 

Thanks

 

SImon

 

From: Haskell-Cafe [mailto:haskell-cafe-bounces-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org] On Behalf Of JP Moresmau
Sent: 14 January 2014 20:14
To: Haskell Cafe
Subject: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!

However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

 

Thanks a million!

 

--
JP Moresmau
http://jpmoresmau.blogspot.com/




--
JP Moresmau
http://jpmoresmau.blogspot.com/



--
JP Moresmau
http://jpmoresmau.blogspot.com/
_______________________________________________
ghc-devs mailing list
ghc-devs@...
http://www.haskell.org/mailman/listinfo/ghc-devs
Simon Peyton Jones | 15 Jan 21:31 2014
Picon

RE: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

Great.

 

Any chance you could add a section to

http://www.haskell.org/haskellwiki/GHC/As_a_library

to elucidate this point.  It’s not an easy API, and we know for sure that this particular point has tripped at least one person up.

 

Simon

 

From: JP Moresmau [mailto:jpmoresmau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: 15 January 2014 16:38
To: Simon Peyton Jones
Cc: ghc-devs-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org
Subject: Re: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

While writing a smaller test case, I managed to get a different error, which in turn allowed me to find this: http://www.haskell.org/pipermail/glasgow-haskell-users/2008-May/014841.html. It turns out I had the ghcLink session flag set to NoLink, it works fine with LinkInMemory! I knew it was something stupid!

 

Thanks, there is no need to open a ticket in the end.

 

JP

 

On Wed, Jan 15, 2014 at 10:40 AM, JP Moresmau <jpmoresmau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

Thanks Simon, I will write a simple test case and see what happens.

 

JP

 

On Wed, Jan 15, 2014 at 10:19 AM, Simon Peyton Jones <simonpj-0li6OtcxBFHby3iVrkZq2A@public.gmane.org> wrote:

That sounds odd.  Can you make a small reproducible test case, open a ticket, and attach the test?

 

Thanks

 

SImon

 

From: Haskell-Cafe [mailto:haskell-cafe-bounces-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org] On Behalf Of JP Moresmau
Sent: 14 January 2014 20:14
To: Haskell Cafe
Subject: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!

However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

 

Thanks a million!

 

--
JP Moresmau
http://jpmoresmau.blogspot.com/



 

--
JP Moresmau
http://jpmoresmau.blogspot.com/



 

--
JP Moresmau
http://jpmoresmau.blogspot.com/

_______________________________________________
ghc-devs mailing list
ghc-devs@...
http://www.haskell.org/mailman/listinfo/ghc-devs
JP Moresmau | 17 Jan 12:35 2014
Picon

Re: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

Updated the wiki!

Thanks


On Wed, Jan 15, 2014 at 9:31 PM, Simon Peyton Jones <simonpj-0li6OtcxBFHby3iVrkZq2A@public.gmane.org> wrote:

Great.

 

Any chance you could add a section to

http://www.haskell.org/haskellwiki/GHC/As_a_library

to elucidate this point.  It’s not an easy API, and we know for sure that this particular point has tripped at least one person up.

 

Simon

 

From: JP Moresmau [mailto:jpmoresmau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: 15 January 2014 16:38
To: Simon Peyton Jones
Cc: ghc-devs-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org
Subject: Re: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

While writing a smaller test case, I managed to get a different error, which in turn allowed me to find this: http://www.haskell.org/pipermail/glasgow-haskell-users/2008-May/014841.html. It turns out I had the ghcLink session flag set to NoLink, it works fine with LinkInMemory! I knew it was something stupid!

 

Thanks, there is no need to open a ticket in the end.

 

JP

 

On Wed, Jan 15, 2014 at 10:40 AM, JP Moresmau <jpmoresmau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

Thanks Simon, I will write a simple test case and see what happens.

 

JP

 

On Wed, Jan 15, 2014 at 10:19 AM, Simon Peyton Jones <simonpj-0li6OtcxBFHby3iVrkZq2A@public.gmane.org> wrote:

That sounds odd.  Can you make a small reproducible test case, open a ticket, and attach the test?

 

Thanks

 

SImon

 

From: Haskell-Cafe [mailto:haskell-cafe-bounces-HC+Z4NTRIlBAfugRpC6u6w@public.gmane.org] On Behalf Of JP Moresmau
Sent: 14 January 2014 20:14
To: Haskell Cafe
Subject: [Haskell-cafe] GHC API: runStmt not taking into account reloaded module

 

It's late here and I'm probably overlooking something stupid, so I'd like if somebody could put my nose on it... I'm using the GHC API to evaluate statements. I use runStmt to get a RunResult, lookupName to get the ID for the bound names, obtainTermFromId to get the term and showTerm to display it. So I can call a function from the loaded module with some parameters and get the result. Good!

However, if I reload a module and I change the implementation of the function, runStmt still returns the old value! I know the reload worked because if I added new names, getNamesInScope returns the new names. What do I need to do to make sure the new function definitions are used? I've perused the source code of InteractiveEval and ghci but nothing stood out. I am calling setContext after load.

 

Thanks a million!

 

--
JP Moresmau
http://jpmoresmau.blogspot.com/



 

--
JP Moresmau
http://jpmoresmau.blogspot.com/



 

--
JP Moresmau
http://jpmoresmau.blogspot.com/




--
JP Moresmau
http://jpmoresmau.blogspot.com/
_______________________________________________
ghc-devs mailing list
ghc-devs@...
http://www.haskell.org/mailman/listinfo/ghc-devs

Gmane