Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Installing GHC and GHCi on a PowerPC Mac running MacOS
10.5.8 (Paul Higham)
2. Re: Installing GHC and GHCi on a PowerPC Mac running MacOS
10.5.8 (Brandon S. Allbery KF8NH)
3. Re: Installing GHC and GHCi on a PowerPC Mac running MacOS
10.5.8 (Luca Ciciriello)
4. Re: Installing GHC and GHCi on a PowerPC Mac running MacOS
10.5.8 (Christian Maeder)
5. Re: Learning about channels (Dean Herington & Elizabeth Lacey)
----------------------------------------------------------------------
Message: 1
Date: Sun, 30 May 2010 20:46:10 -0700
From: Paul Higham <[email protected]>
Subject: [Haskell-beginners] Installing GHC and GHCi on a PowerPC Mac
running MacOS 10.5.8
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
I am a complete newbie but fascinated by the Haskell language. I am
trying to install GHC and GHCi on an older Mac and it seems like the
recommended Haskell Platform is not supported on PowerPC running MacOS
10.5.8. Is this correct?
I find that following the links on the site
http://haskell.org/ghc/distribution_packages.html#macosx
just sends me in circles so I am appealing to you for some hints as to
how to proceed. I already have XCode 3.1 installed and I have just
updated my MacPorts installation but now I confess I am a bit stuck.
Can you recommend a reasonable path to follow from here?
Thanx
::paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100530/732c368e/attachment-0001.html
------------------------------
Message: 2
Date: Sun, 30 May 2010 23:55:16 -0400
From: "Brandon S. Allbery KF8NH" <[email protected]>
Subject: Re: [Haskell-beginners] Installing GHC and GHCi on a PowerPC
Mac running MacOS 10.5.8
To: Paul Higham <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
Skipped content of type multipart/alternative-------------- next part
--------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100530/f8208c7e/PGP-0001.bin
------------------------------
Message: 3
Date: Mon, 31 May 2010 09:19:53 +0200
From: Luca Ciciriello <[email protected]>
Subject: Re: [Haskell-beginners] Installing GHC and GHCi on a PowerPC
Mac running MacOS 10.5.8
To: Paul Higham <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
Hi Paul.
I think that the last PPC version of GHC supported was 6.4.1 (I've installed it
on my old iBook G4 with MacOS X 10.5.8 Xcode 3.1)
http://www.haskell.org/ghc/download_ghc_641.html
but I'm not sure.
Try to install this version.
Let me know.
Luca.
On May 31, 2010, at 5:46 AM, Paul Higham wrote:
> I am a complete newbie but fascinated by the Haskell language. I am trying
> to install GHC and GHCi on an older Mac and it seems like the recommended
> Haskell Platform is not supported on PowerPC running MacOS 10.5.8. Is this
> correct?
>
> I find that following the links on the site
>
> http://haskell.org/ghc/distribution_packages.html#macosx
>
> just sends me in circles so I am appealing to you for some hints as to how to
> proceed. I already have XCode 3.1 installed and I have just updated my
> MacPorts installation but now I confess I am a bit stuck.
>
> Can you recommend a reasonable path to follow from here?
>
> Thanx
>
> ::paul
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100601/8d04bd0e/attachment-0001.html
------------------------------
Message: 4
Date: Tue, 01 Jun 2010 17:10:51 +0200
From: Christian Maeder <[email protected]>
Subject: [Haskell-beginners] Re: Installing GHC and GHCi on a PowerPC
Mac running MacOS 10.5.8
To: Paul Higham <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
http://www.haskell.org/ghc/download_ghc_6_10_4.html#macosxppc
should work by unpacking, ./configure and "make install"
Christian
Paul Higham schrieb:
> I am a complete newbie but fascinated by the Haskell language. I am
> trying to install GHC and GHCi on an older Mac and it seems like the
> recommended Haskell Platform is not supported on PowerPC running MacOS
> 10.5.8. Is this correct?
>
> I find that following the links on the site
>
> http://haskell.org/ghc/distribution_packages.html#macosx
>
> just sends me in circles so I am appealing to you for some hints as to
> how to proceed. I already have XCode 3.1 installed and I have just
> updated my MacPorts installation but now I confess I am a bit stuck.
>
> Can you recommend a reasonable path to follow from here?
>
> Thanx
>
> ::paul
>
------------------------------
Message: 5
Date: Mon, 31 May 2010 13:33:07 -0400
From: Dean Herington & Elizabeth Lacey <[email protected]>
Subject: Re: [Haskell-beginners] Learning about channels
To: Benjamin Edwards <[email protected]>,
[email protected]
Message-ID: <a06240800c8299f989...@[192.168.1.100]>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
At 10:06 AM +0100 5/25/10, Benjamin Edwards wrote:
>NB: This was posted in fa.haskell first, I guess it was the wrong
>forum for this kind of question as it was left unanswered :)
>
>Hi,
>
>I'm having a few issues getting some toy programs to work whilst I try
>to get a better understanding of how to model processes and channels.
>I am just trying to use the real base blocks and failing miserably.
>Here is an example (yes this is utterly contrived and sill, but I lack
>imagination... sue me):
>
>I want my main thread to do the following:
>
>1. make a channel
>2. spawn a thread (producer) that will write a series of lists of
>integers to the the channel, then exit.
>3. spawn another thread that will read from the channel and sum all of
>the input. It should exit when both the channel is empty and and the
>producer thread has finished writing to it.
>4. Main thread should print the sum.
>
>My current code should uses a trick I have seen else where which is to
>have the result of "task" running in the thread put into an MVar. So
>my condition for the reading thread exiting is to check if the MVar of
>the producer thread is not empty and if the channel is empty. If those
>two things are true, exit the thread. Unfortunately if somehow seems
>able to to get to a stage where the produce thread has finished and
>the channel is empty, but is blocking on a read.
>
>I have the following code, but it always blocks indefinitely on a
>read. I am sure there is something obviously deficient with it, but I
>can't work out what it is. Any help would be greatly appreciated. Of
>course, if I'm doing it all wrong, please tell me that too :)
>
>module Main
> where
>
>import Control.Concurrent
>import Control.Concurrent.STM
>import Control.Monad (forever)
>import Data.Map as M
>
>main :: IO ()
>main = do oc <- newChan
> counter <- newTVarIO (0 :: Integer)
> p <- forkJoin $ produce oc [1..1000]
> c <- forkJoin $ loop oc p counter
> takeMVar c >>= print
>
>produce :: Chan [Integer] -> [Integer] -> IO ()
>produce ch [] = return ()
>produce ch xs = do let (hs,ts) = splitAt 100 xs
> writeChan ch hs
> produce ch ts
>
>loop :: Chan [Integer] -> MVar () -> TVar Integer -> IO Integer
>loop ch p n = do f <- isEmptyMVar p
> e <- isEmptyChan ch
> if e && (not f)
> then atomically (readTVar n)
> else do xs <- readChan ch
> atomically $ do x <- readTVar n
> writeTVar n (x + sum xs)
> loop ch p n
>
>forkJoin :: IO a -> IO (MVar a)
>forkJoin task = do mv <- newEmptyMVar
> forkIO (task >>= putMVar mv)
> return mv
By encoding end-of-data directly in the channel contents, you can
simplify the code (and make it less prone to hangs such as the one
you experienced.) I've shown one way to do this below. I've also
made the accumulating count a simple parameter to the consumer
function. (Because the count is private to the consumer until it's
passed to the main routine via the consumer's termination MVar,
there's no need for additional inter-thread synchronization.)
Dean
module Main where
import Control.Concurrent
main :: IO ()
main = do oc <- newChan
p <- forkJoin $ produce oc [1..1000]
c <- forkJoin $ consume oc 0
takeMVar c >>= print
produce :: Chan (Maybe [Integer]) -> [Integer] -> IO ()
produce ch [] = writeChan ch Nothing
produce ch xs = do let (hs,ts) = splitAt 100 xs
writeChan ch (Just hs)
produce ch ts
consume :: Chan (Maybe [Integer]) -> Integer -> IO Integer
consume ch cnt = do mbInts <- readChan ch
case mbInts of Just xs -> consume ch (cnt + sum xs)
Nothing -> return cnt
forkJoin :: IO a -> IO (MVar a)
forkJoin task = do mv <- newEmptyMVar
forkIO (task >>= putMVar mv)
return mv
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 24, Issue 1
****************************************