How to load a script to ghci?
haskell
Solution
cube x = x*x*x
main = do
print $ cube 1
print $ cube 2
print $ cube (cube 3)
$ ghci cube.hs
...
ghci> main
See the GHCI user guide.
I also highly recommend checking out the QuickCheck library.
You'll be amazed at how awesome testing can be with it.
Problem
I'm just starting learning Haskell, and having a hard time understanding the 'flow' of a Haskell program. For example in Python, I can write a script, load it to the interpreter and see the results: ``` def cube(x): return x*x*x print cube(1) print cube(2) print cube(cube(5)) # etc... ``` In Haskell I can do this: ``` cube x = x*x*x main = print (cube 5) ``` Load it with `runhaskell` and it will print `125`. Or I could use `ghci` and manually type all functions I want to test But what I want is to use my text editor , write a couple of functions , a few tests , and have Haskell print back some results: ``` -- Compile this part cube x = x*x*x -- evaluate this part: cube 1 cube 2 cube (cube 3) --etc.. ``` Is something like this possible?