Ok, here's function 'doeiets' defined in a source file and the same
function defined interactively:
source ===============
doiets = do
let f x = x + 1
print $ f 2
======================
Used in ghci:
*Main> doiets
3
note: 'let' is used in a source file
Start a new ghci session. Define the same interactively:
Prelude> :{
Prelude| let { doiets = do
Prelude| let f x = x + 1
Prelude| print $ f 2
Prelude| }
Prelude| :}
(0.02 secs, 3837824 bytes)
Prelude> doiets
3
It's just an example showing you the use of 'let' in both situations.
FYI: most people use ghci mainly for interactively developing Haskell
programs.
On 22-06-12 14:57, Raul Miller wrote:
> On Fri, Jun 22, 2012 at 5:10 AM, Aai <[email protected]> wrote:
>>> Note also the word "Compiling" here.
>> ... and the phrase '.... interpreted' after that. Compiled here is
>> 'compiled to byte code'.
> That was a hint, not definitive.
>
>> Using 'let' is not a matter of being confronted with a different
>> language, but a matter of defining a function interactively. But ok, I
>> advice you to read about 'ghci' being part of the package GHC
>> (containing the compiler ghc and the interpreter ghci):
> The issue I am trying to raise is that you cannot use the same
> language for compiled programs that you can use for interactive
> programs. I am not sure if you are trying to claim that these
> languages are equivalent, or if you simply are not aware that that is
> what I am saying or if something else is going on.
>
> They do have a sub-language in common, but that common sub-language
> only admits single line statements which are not declarations.
>
> Meanwhile, sharing an implementation does not make languages
> equivalent. Otherwise C and C++ would be the same language.
>
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm