Running ghci on an individual haskell file

111 views
Skip to first unread message

John Pybus

unread,
Jul 10, 2016, 8:27:14 PM7/10/16
to haskell-stack
Hi,

I use Haskell quite a lot for small scripts and one-off data processing tasks, and as a new user of stack, I'm really liking the "script interpreter" functionality, but I'm stuck trying to do something similar for ghci.

In many cases I end up throwing together a few functions in a haskell file  then running it in ghci where I can load in files with data, maybe tinker with it a bit then run the functions defined to process it.  I don't know if I'm just doing something wrong, but so far I've failed to find any way to get this to work along with the useful "put the command line options in a first line comment" feature of stack.

"stack ghci" seems intent on working with a project, but I can work on an individual mybits.hs file using "stack exec --package some-package ghci mybits.hs".  However, if I put "-- stack exec --package some-package ghci" at the start of the file and use "stack mybits.hs", I get "Invalid argument `exec'".

Is there a way to get this to work?

Thanks,
John

Charles

unread,
Aug 30, 2016, 2:54:33 PM8/30/16
to haskell-stack

John Pybus

unread,
Sep 26, 2016, 12:09:41 PM9/26/16
to haskell-stack
That blog was about stack's ability to act as "stack runghc" when used as a script interpreter, what I was after was for it to act as "stack ghci".  I'm delighted to see that stack 1.2 can now do just that: https://github.com/commercialhaskell/stack/issues/2510

John
Reply all
Reply to author
Forward
0 new messages