Date: Mon, 24 Dec 2007 01:44:16 -0500
To: "Galchin Vasili" <[EMAIL PROTECTED]>, haskell-cafe@haskell.org
From: Dean Herington <[EMAIL PROTECTED]>
Subject: Re: [Haskell-cafe] more on the "Beautiful Concurrency"
function "withdraw" application ...
Cc:
Bcc:
X-Attachments:
At 12:19 AM -0600 12/24/0
At 12:19 AM -0600 12/24/07, Galchin Vasili wrote:
module Main where
import Control.Concurrent.STM
import Control.Concurrent
import System.Random
type Account = TVar Int
transfer :: Account -> Account -> Int -> IO ()
transfer from to amount
= atomically (do {deposit to amount;
Judah,
Thanks for your reply, and your help.
> > (Although it looks like the libraries/readline/configure script
> > might recognize these, I can't get an option to pass through.)
>
> Actually, this is supposed to work. When running the top-level ghc
> configure, you should be a
module Main where
import Control.Concurrent.STM
import Control.Concurrent
import System.Random
type Account = TVar Int
transfer :: Account -> Account -> Int -> IO ()
transfer from to amount
= atomically (do {deposit to amount;
withdraw from amount})
deposit :: Accou
Hello,
My brain is a "out to lunch". I have read the paper "Beautiful
Concurrency" (as well as a bunch of "gaming" papers regarding multi cores).
I am playing with the "Account" example in the paper. In the paper, the
alias "type Account = TVar Int" is used. I want to actually apply the
func
Hi,
I'm installing Gtk2Hs on my Ubuntu 7.10. I have ghc 6.8.2 compiled
with the extra libs in my home directory with the configuration
"./configure --prefix=/home/wy/Programs" and it worked well.
Then I configured gtk2hs in the same way and it compiled and installed
with no problem. But when I tr
It seems GHC 6.8.2 fixes a couple of bugs in GHC 6.8.1.
Gtk2HS does not yet detect my GHC 6.8.2 installation, but I guess it is 100%
compatible.
Is it possible to get the Gtk2HS installer detect GHC 6.8.2? I'm on Windows.
Thanks,
Peter
__
I have defined a function on types thanks to functional dependencies.
I use it like that:
myFunction :: (TypeFunction MyComplexType f) => f -> f
f is unique for MyComplexType. Is there a way to name f ?
I would like to write:
myFunction :: SimplifiedType -> SimplifiedType
where
TypeFunction
On Sun, 23 Dec 2007 06:42:52 -0500, Neil Mitchell <[EMAIL PROTECTED]>
wrote:
Hi Brad,
> Experience has taught me to _never_ put class contexts on data
> definitions. Now you can't write something as simple as "Empty" - you
> have to give it a class context. This is just plain annoying.
With
Paulo J. Matos wrote:
> I guess the latter is the correct guess.
Good guess!
You can take advantage of the fact that the Maybe type is an instance of
the Monad typeclass to chain those computations together, getting rid of
all of the explicit case analysis.
import qualified Data.ByteString.Char
Hi
> > parseHeader $ BS.pack "hello 252 359"
> (252,359)
If this were strings, I'd start with:
map read . words
If you want to have error correction, I'd move to:
mapM readMay . words
(readMay comes from the safe package, http://www-users.cs.york.ac.uk/~ndm/safe/)
I don't know about the byte
On Dec 23, 2007, at 7:35 , Paulo J. Matos wrote:
parseHeader2 :: BS.ByteString -> (Int, Int)
parseHeader2 bs =
case (BS.readInt $ BS.dropWhile (not . isDigit) bs) of
Nothing -> error "Couldn't find first natural."
Just (x, rest) ->
case (BS.readInt
-- this should work too
parseHeader3 :: BS.ByteString -> Maybe (Int, Int)
--note accurate type signature, which helps us use Maybe failure-monad,
--although losing your separate error messages
parseHeader3 bs = do
(x, rest) <- BS.readInt $ BS.dropWhile (not . isDigit) bs
(y, _) <- BS.readInt
On Dec 23, 2007 12:32 PM, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> It is either too difficult to get two integers of a bytestring, in
> which case something should be done to ease the process or I should
> learn much more Haskell. I guess the latter is the correct guess.
>
> I hav
Hello all,
It is either too difficult to get two integers of a bytestring, in
which case something should be done to ease the process or I should
learn much more Haskell. I guess the latter is the correct guess.
I have a bytestring containing two naturals. I was to get them as
efficiently as poss
On Thu, Dec 20, 2007 at 10:58:17AM +, Malcolm Wallace wrote:
>
> Nobench does already collect code size, but does not yet display it in
> the results table. I specifically want to collect compile time as well.
> Not sure what the best way to measure allocation and peak memory use
> are?
This
Hi Brad,
> > Experience has taught me to _never_ put class contexts on data
> > definitions. Now you can't write something as simple as "Empty" - you
> > have to give it a class context. This is just plain annoying.
>
> With the class context in the BST definition, ghc gives no complaints when
> I
17 matches
Mail list logo