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
> 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 ->
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 Peebl
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
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 `[()]'
Will Ness wrote:
Luke Palmer gmail.com> writes:
Or you could use the "subtract" function.
>>> map (subtract 2) [3,4,5]
[1,2,3]
I don't want to.
I don't think syntax sugar is worth it in this case.
I do. Operators are great because they make our intent visible, immediately
apparent.
Before anything else, I want to point out that I have no intention to confront
your community, or denigrate Haskell. A few days ago I answered an email from a
Clean programmer on something related to Clean. He was worried that Clean team
could give up its good work, and Clean could disappear; th
Luke Palmer gmail.com> writes:
>
> Or you could use the "subtract" function.
>
> >>> map (subtract 2) [3,4,5]
> [1,2,3]
I don't want to.
>
> I don't think syntax sugar is worth it in this case.
I do. Operators are great because they make our intent visible, immediately
apparent. Long
(Sorry, accidently took off cafe.)
On Mon, Oct 19, 2009 at 12:44 AM, Henning Thielemann <
lemm...@henning-thielemann.de> wrote:
>
> On Mon, 19 Oct 2009, Michael Snoyman wrote:
>
> Does the explicit-exception package provide what you need?
>>
>> http://hackage.haskell.org/package/explicit-excepti
On Sun, Oct 18, 2009 at 4:47 PM, Will Ness wrote:
> Gregory Propf yahoo.com> writes:
>
>>
>>
>> I actually meant it as sort of a joke but maybe it's not after all.
>
> Seriously though, using anything non-ASCII in source code is a bad idea,
> because there are lots of fonts and editors in the wor
Gregory Propf yahoo.com> writes:
>
>
> I actually meant it as sort of a joke but maybe it's not after all.
Seriously though, using anything non-ASCII in source code is a bad idea,
because there are lots of fonts and editors in the world.
It seems natural to me to have (`-`2) stand for (fli
On Sun, 18 Oct 2009, Michael Snoyman wrote:
While working on the next release of data-object, I wanted to represent some
operations
that might fail. The typical candidates were:
1) Maybe
2) Either
3) Monad
Monad is always iffy because of the often times poorly defined fail. Maybe
doesn't
pr
While working on the next release of data-object, I wanted to represent some
operations that might fail. The typical candidates were:
1) Maybe
2) Either
3) Monad
Monad is always iffy because of the often times poorly defined fail. Maybe
doesn't provide any means of reporting what the problem was.
$83 and "3-4 weeks" for a 300 page book? Oy vey.
Warren
On Fri, Oct 16, 2009 at 7:24 AM, S. Doaitse Swierstra
wrote:
> I am happy to announce that the rworked lecture notes for the 6th Advance
> Functional programming summer school have become available.
_
On Sun, 2009-10-18 at 19:53 +0400, Alexey Khudyakov wrote:
> > Yes. We decided that having the Get monad as a lazy state monad just
> > doesn't make sense. It makes this one use case work, but causes more
> > problems generally. Certainly we need to be able to do lazy binary
> > deserialisation too
Hi,
I have tried qualified imports, synonyms and newtypes but still I could
not implement the merging task (previously posted). This is probably
because I have little knowledge of Haskell *or* the task is not really
suited to Haskell (more of a specification task than a programming task).
My main
On 10/17/09, Andrew Coppin wrote:
> Derek Elkins wrote:
>> See vacuum: http://hackage.haskell.org/package/vacuum
>>
> Could be useful... Thanks!
>
As Derek mentioned, vacuum would be perfect for this:
-
import Data.Wo
> Yes. We decided that having the Get monad as a lazy state monad just
> doesn't make sense. It makes this one use case work, but causes more
> problems generally. Certainly we need to be able to do lazy binary
> deserialisation too, but our feeling is that it should be more explicit
> and integrat
Hi John,
On Sun, Oct 11, 2009 at 14:58, John Lato wrote:
> For anyone writing introductions to generic programming, take this as
> a plea from Haskellers everywhere. If one of the RWH authors can't
> understand how to make use of these techniques, what hope do the rest
> of us have?
>
I would l
On Sat, 2009-09-19 at 00:36 +0400, Khudyakov Alexey wrote:
> Hello
>
> I run into problems with new binary package. Following function reads a list
> of elements one by one until end of stream. List is very long (won't fit into
> memory).
Sorry for the late reply.
> In binary-0.5.0.1 and earli
> I am happy to announce that the rworked lecture notes for the 6th Advance
> Functional programming summer school have become available.
>
Thanks, Doaitse.
>• Johan Jeuring (Utrecht University, NL): Libraries for Generic
> Programming in Haskell
An extended version of this article is
On Sat, Oct 10, 2009 at 15:13, Duncan Coutts wrote:
> From what Gregory and Anton have said, it sounds like the SockAddr6,
> HostAddress6 constructors should always be available, but that using
> them with the socket functions should fail at runtime on platforms with
> no IPv6 support, or when IPv
Hi, first of all this post is literate haskell
I'm trying to implement a binomial heaps from okaski's book [1]
but as most it's possible to be statically checked for correctness of
definition.
Remark that binomial heap is list of binomial trees in increasing order of rank
and binomial heap of rank
23 matches
Mail list logo