zaxis schrieb:
winSSQ count noRed noBlue = do {
yesRed - [1..33] \\ noRed;
yesBlue - [1..16] \\ noBlue;
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1);
return ()
You might prefer 'withFile' or even better and if possible, write
thanks for your quick answer. But
winSSQ count noRed noBlue = do {
let yesRed = [1..33] \\ noRed;
let yesBlue = [1..16] \\ noBlue;
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1);
}
will report: parse error on input `let'
Daniel Peebles
thanks for your quick answer. But
I think he actually answered your question. I.e. try it with this
extra 'do' statement:
winSSQ count noRed noBlue = do { do
let yesRed = [1..33] \\ noRed;
let yesBlue = [1..16] \\ noBlue;
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 -
The original code is:
winSSQ count noRed noBlue = do
let yesRed = [1..33] \\ noRed
let yesBlue = [1..16] \\ noBlue
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1)
It works very well. However, as i am used to C style so i want convert it
zaxis z_a...@163.com writes:
winSSQ count noRed noBlue = do
let yesRed = [1..33] \\ noRed
let yesBlue = [1..16] \\ noBlue
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1)
It works very well. However, as i am used to C style so i want
On Mon, Oct 19, 2009 at 9:18 AM, Ketil Malde ke...@malde.org wrote:
zaxis z_a...@163.com writes:
winSSQ count noRed noBlue = do
let yesRed = [1..33] \\ noRed
let yesBlue = [1..16] \\ noBlue
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue
Ketil Malde wrote:
winSSQ count noRed noBlue = do {
let yesRed = [1..33] \\ noRed;
^^^ ^
Didn't you just comment out your semicolons?
That was my initial reaction. Until I remembered that Haskell has a
different comment style.
Ketil Malde ke...@malde.org writes:
Didn't you just ...
Oh, dear. Sorry about that.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
oh! thanks! But why ?
Heinrich Apfelmus wrote:
zaxis wrote:
It works very well. However, as i am used to C style so i want convert it
into
winSSQ count noRed noBlue = do {
let yesRed = [1..33] \\ noRed;
let yesBlue = [1..16] \\ noBlue;
bracket (openFile ssqNum.txt
On Mon, Oct 19, 2009 at 1:44 PM, zaxis z_a...@163.com wrote:
oh! thanks! But why ?
A let can introduce multiple declarations.
So this
foo = do
let x = 3
let y = 4
return $ x+ y
can also be written like
foo = do
let x = 3
y = 4 -- no let
return $ x + y
With explicit blocks:
On Mon, Oct 19, 2009 at 6:10 AM, Roel van Dijk vandijk.r...@gmail.com wrote:
On Mon, Oct 19, 2009 at 1:44 PM, zaxis z_a...@163.com wrote:
oh! thanks! But why ?
A let can introduce multiple declarations.
So this
foo = do
let x = 3
let y = 4
return $ x+ y
can also be written like
On Sun, Oct 18, 2009 at 11:50 PM, zaxis z_a...@163.com wrote:
The original code is:
winSSQ count noRed noBlue = do
let yesRed = [1..33] \\ noRed
let yesBlue = [1..16] \\ noBlue
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1)
It works
winSSQ count noRed noBlue = do {
yesRed - [1..33] \\ noRed;
yesBlue - [1..16] \\ noBlue;
bracket (openFile ssqNum.txt WriteMode) (hClose) (\hd1 - pickSSQ
count yesRed yesBlue hd1);
return ()
}
will report:
Couldn't match expected type `IO ()' against inferred type `[()]'
In a
They're in different Monads. The first one does x - [...], which
means that you're operating in the list Monad instance, and bracket
operates in the IO Monad. The second one uses let x = [...] which
doesn't have any effect on what Monad you're in, so the whole thing
can be in IO.
Note that when
14 matches
Mail list logo