You mix up things. You'll have to learn how to use GHCi.

I have
////////////////////////
f x = x + 1

main = print $ f 2
////////////////////////

in a file gedoe.hs

I can load this in GHCi

Prelude> :l ./zandbak/gedoe
[1 of 1] Compiling Main             ( zandbak/gedoe.hs, interpreted )
Ok, modules loaded: Main.

and use it in GHCi

*Main> main
3
(0.00 secs, 0 bytes)

or

*Main> f 2
3


But also in GHCi as I showed you before (use another function name )


*Main> let g x = x + 1
(0.00 secs, 0 bytes)
*Main> g 2
3

Compiling file gedoe.hs and running

*Main> :! ghc --make ./zandbak/gedoe.hs
[1 of 1] Compiling Main             ( zandbak/gedoe.hs, zandbak/gedoe.o )
Linking zandbak/gedoe ...

*Main> :! ./zandbak/gedoe
3


note: with :! I can execute shell commands from within GHCi.


Hope this helps.





On 21-06-12 19:46, Raul Miller wrote:
> But this statement is not legal in compiled haskell -- so even if I
> could pretend that the original statement was not in haskell, this new
> example would still suggest to me that interpreted haskell and
> compiled haskell are different languages.
>
> What this 'let' example brings to the table is that neither is a
> subset of the other.
>

-- 
Met vriendelijke groet,
@@i = Arie Groeneveld



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to