New IHP Case Study: How AirPV is making the process of going solar easier and better value with IHP

How do I see my application specific code in ghci?

Francisco Gutierrez PRO

when I run ghci in nix-shell I can see all the IHP.Prelude code but I can't see any of the code in my current application. How do I interact with my own code in ghci? Trying things in a repl is one of the main reasons why I like Haskell, but so far I haven't been able to do it with my own code. I assume it's some nix file setting, but I can't find any straight forward information on how to do this. I usually work with stack, so I am a bit lost in IHP with nix.

Daniel Sokil PRO

You mentioned "code in my current application", could you specify what Haskell module/file you are trying to interact with?

Francisco Gutierrez PRO

In the tutorial we generate some code for a posts controller and views, I want to interact with the post objects in ghci

Zac Wood BUSINESS

You can load the file with :l <module>, so for example in GHCI:

IHP > :l Web.Controller.Posts

Or any other module in your project. No Nix needed.

If you want all your application code, run :l Main which should import everything.

Francisco Gutierrez PRO

That worked, thank you! I was trying to use import instead of :l, that's why I wasn't seeing it and thought it was a configuration issue 😆 Thanks for your quick answer!