On Sun, 24 Nov 2002 22:50:43 +0100, Nick Name <[EMAIL PROTECTED]> wrote:
>On Sun, 24 Nov 2002 20:42:31 +
>Glynn Clements <[EMAIL PROTECTED]> wrote:
>
>> Even if Haskell were strict, you still wouldn't be able to treat I/O
>> operations as functions without discarding referential transparency.
--- Lu Mudong <[EMAIL PROTECTED]> wrote:
> Thanks a lot for you guys' help.
>
> I am very new to haskell and tried some methods you
> guys advised, doesn't
> seem to work, i think i didn't do it properly,
> here's my code and result,
> hope you can point out what's wrong. thanks!
>
Lots of theo
On Sun, 24 Nov 2002 20:42:31 +
Glynn Clements <[EMAIL PROTECTED]> wrote:
> Even if Haskell were strict, you still wouldn't be able to treat I/O
> operations as functions without discarding referential transparency.
Yes, but if haskell were strict, it wouldn't really need referential
transpar
Nick Name wrote:
> This approach is called "monads" and is needed because haskell is a lazy
> language, so order of evaluation is unspecified, while input/output
> usually needs a precise order of evaluation.
It is needed because Haskell is a functional language, where functions
are referentiall
Lu Mudong wrote:
> hi, all, I'm having problem convert IO String to string,
That's because you can't convert IO String to String.
> I read a file, and it's an IO String,
No.
Calling readFile doesn't read the file, and the value which readFile
returns isn't the result of reading the file. The
Hello,
several mails spoke about converting an IO String to a String. I have to point
out that such a conversion is not what happens when you use monadic I/O. In
fact, such a conversion is just not possible in Haskell 98.
Since Haskell is a pure language, evaluating a String expression mustn't
On Sun, 24 Nov 2002 09:05:17 -0900
"Lu Mudong" <[EMAIL PROTECTED]> wrote:
> Thanks a lot for you guys' help.
>
> I am very new to haskell and tried some methods you guys advised,
> doesn't seem to work, i think i didn't do it properly, here's my code
> and result, hope you can point out what's wr
IO ()
*** Does not match : String
From: Ashley Yakeley <[EMAIL PROTECTED]>
To: "Ahn Ki-yung" <[EMAIL PROTECTED]>,"Haskell List" <[EMAIL PROTECTED]>
Subject: Re: how to convert IO String to string
Date: Fri, 22 Nov 2002 15:09:34 -0800
At 2002-11-22 14:4
At 2002-11-22 14:49, Ahn Ki-yung wrote:
>'do' is a syntactic sugar of monadic operations.
>The original form can be written as
>
>main = myReadFile >>= \s -> putStrLn s
That's correct. In this case, the 's' has type String. So the IO String
has been 'converted' into a String, but only within the
Ashley Yakeley wrote:
At 2002-11-22 08:12, Lu Mudong wrote:
what i need is a string,
You can do the conversion with "<-", but only inside a "do" block. For
instance:
myReadFile :: IO String
myReadFile = ...
main = do
s <- myReadFile
putStrLn s
Here, s has type String.
'd
At 2002-11-22 08:12, Lu Mudong wrote:
>hi, all, I'm having problem convert IO String to string, I read a file, and
>it's an IO String,
Right,
> what i need is a string,
You can do the conversion with "<-", but only inside a "do" block. For
instance:
myReadFile :: IO String
myReadFile = .
hi, all, I'm having problem convert IO String to string, I read a file, and
it's an IO String, what i need is a string, but couldn't figure out how to
do the convertion. there are couple posts talked about this topic, but
didn't work for me
please help me out, thanks a lot
Ron
___
12 matches
Mail list logo