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. Re:  "computation", "action" (Michael Mossey)
   2. Re:  "computation", "action" (Jason Dusek)
   3.  HaL4: Haskell-Treffen in Halle/Saale, 12. Juni 2009 -
      Programm und Anmeldung (Henning Thielemann)
   4.  Catching Network Connection Error (aditya siram)
   5.  parMap on multicore computers (Miguel Pignatelli)


----------------------------------------------------------------------

Message: 1
Date: Tue, 19 May 2009 15:34:03 -0700
From: Michael Mossey <[email protected]>
Subject: Re: [Haskell-beginners] "computation", "action"
To: beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



Andrew Wagner wrote:
> 
> 
>     One words that seem to come up in Haskell are "algorithm" and
>     "procedure."
> 
> 
> I've not seen these used in Haskell. They sound distinctly imperative to 
> me, for some reason. But, until you define the words connotatively, all 
> I can say is how they sound to me.
>  
Yes, I meant to write they *don't* come up in Haskell.

Regarding how words "sound", that's a good thing to talk about, in my 
opinion. It's related to the philosophy of epistemology. Words have 
connotations. They are used in certain contexts, with certain implications.

Thanks,
Mike



------------------------------

Message: 2
Date: Tue, 19 May 2009 16:27:00 -0700
From: Jason Dusek <[email protected]>
Subject: Re: [Haskell-beginners] "computation", "action"
To: Michael P Mossey <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=UTF-8

2009/05/19 Michael P Mossey <[email protected]>:
> For example, a monad is sometimes called a "computation" or an
> "effect", but I've not seen it called an "algorithm."

  There is a difference between a monad and monadic value --
  just as there is a difference between "List" as a structure
  and a particular list as an instantiation of that structure.

> Can someone elaborate on these terms and why they are used?
> What is the difference between a computation and an algorithm?

  This is a little like saying, what is the difference between
  an algorithm and a program? The term "algorithm" denotes not
  only a sequence of instructions to perform but also a solution
  (in a well-defined sense) to a particular problem. A
  computation is probably anything whatever that warms the
  computer.

> The word "effect" has a fairly obvious meaning (like an IO
> side-effect) but I suspect there's more to it.

  I believe the usual aphorism is "Monads sequence effects.".

--
Jason Dusek


------------------------------

Message: 3
Date: Wed, 20 May 2009 15:12:14 +0200 (CEST)
From: Henning Thielemann <[email protected]>,
        [email protected]
Subject: [Haskell-beginners] HaL4: Haskell-Treffen in Halle/Saale, 12.
        Juni 2009 - Programm und Anmeldung
To: [email protected], [email protected],
        [email protected]
Message-ID:
        <alpine.deb.2.00.0905201426420.13...@anubis.informatik.uni-halle.de>
Content-Type: text/plain; charset="iso-8859-15"


Kindly excuse the German noise, please ...


Liebe Haskell-Freunde!

Das Programm fuer unser Haskell-Treffen steht jetzt so gut wie fest und 
man kann sich online anmelden.

---------------------------------------------
HaL4 : Haskell - Tutorial + Workshop + Party
am Freitag, dem 12. Juni 2009, in Halle/Saale
---------------------------------------------

Das traditionsreiche HaL-Treffen bietet eine gute Mischung
von Haskell-bezogenen Themen aus Forschung, Anwendung und Lehre
mit vielen Möglichkeiten zu Diskussion und Unterhaltung
bei der anschließenden Party. Der Workshop wird in diesem Jahr
ergänzt durch Tutorien für Haskell-Ein- und Umsteiger.
Diesmal findet das Treffen in Halle/Saale im Institut für Informatik
der Martin-Luther-Universität Halle-Wittenberg statt. Wir bieten:

   10 Uhr:
      Entwurfsmuster vom Kopf auf die Fuesse gestellt:
      data, fold und laziness statt Kompositum, Visitor, Iterator.
       Johannes Waldmann, HTWK Leipzig.
   11 Uhr:
      CAL/openquark: (openquark.org)
      Haskell + Java => CAL, eine praktische Einfuehrung
      (Eclipse als CAL-IDE, Excel lesen, typsicheres SQL = LINQ fuer Java?)
       Alf Richter, iba Consulting, Leipzig
   12 Uhr:
      Wie man das Semikolon ueberlaedt:
      Code-Strukturierung und -Wiederverwendung durch Monaden

   15 Uhr:
      Hayoo! Haskell API Search
       Timo Huebel, FH Wedel
   16 Uhr:
      Haskell als reine Spezifikationssprache
       Baltasar Trancon y Widemann, Universit Bayreuth
   17 Uhr:
      Funktional-logische Programmierung mit Curry
       Jan Christiansen, Universitaet Kiel

   19 - 22 Uhr: Grillparty

Wir freuen uns auf rege Teilnahme sowie spannende Vorträge mit heißen
Diskussionen und bitten um Anmeldung bis zum 31. Mai.
Weitere Informationen auf  http://www.iba-cg.de/hal4.html


Beste Gruesse
Henning Thielemann

------------------------------

Message: 4
Date: Fri, 22 May 2009 01:20:39 -0500
From: aditya siram <[email protected]>
Subject: [Haskell-beginners] Catching Network Connection Error
To: beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi all,
I am trying to Network.HTTP to connect to a website and catch the error if
the network is down. Here's what I have so far:

data Errors = DocumentParseError
            | WebsiteUnreachableError
            | ISBNNotFoundError

respHTML' :: ISBN -> IO (Either Errors (IO String))
respHTML' isbn =
    do
      rsp <- simpleHTTP (getRequest $ "
http://isbndb.com/api/books.xml?results=details&access_key=";
                                        ++ key
                                        ++ "&index1=isbn&value1="
                                        ++ isbn :: Request_String)
      return $ Right $ getResponseBody rsp
                  `E.catch` (\(e :: E.SomeException ) ->
                                 return $ Left $ WebsiteUnreachableError)

I get the following error when I load it into GHCI:
    Couldn't match expected type `[Char]'
           against inferred type `Either Errors b'
      Expected type: IO String
      Inferred type: IO (Either Errors b)
    In the expression: return $ Left $ WebsiteUnreachableError
    In the second argument of `E.catch', namely
        `(\ (e :: E.SomeException)
              -> return $ Left $ WebsiteUnreachableError)'
Failed, modules loaded: none.

Control.Exception.catch has the following signature :
catch :: forall a. IO a -> (IOError -> IO a) -> IO a

I would expect that the handler function needs to return an IO (Either
Errors (IO String)). Why is it trying to return an IO String?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090522/48149092/attachment-0001.html

------------------------------

Message: 5
Date: Fri, 22 May 2009 23:38:18 +0200
From: Miguel Pignatelli <[email protected]>
Subject: [Haskell-beginners] parMap on multicore computers
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Hi all,

I'm experimenting a bit with the parallelization capabilities of  
Haskell.
What I am trying to do is to process in parallel all the lines of a  
text file, calculating the edit distance of each of these lines with a  
given string.
This is my testing code:


import System.IO
import Control.Monad
import Control.Parallel
import Control.Parallel.Strategies

edist :: String -> String -> Int
-- edist calculates the edit distance of 2 strings
-- see for example 
http://www.csse.monash.edu.au/~lloyd/tildeFP/Haskell/1998/Edit01/

getLines :: FilePath -> IO [Int]
getLines = liftM ((parMap rnf (edist longString)) . lines) . readFile

main :: IO ()
main = do
        list <- getLines "input.txt"
        mapM_ ( putStrLn . show ) list

I am testing this code in a 2xQuadCore linux (Ubuntu 8.10) machine (8  
cores in total).
The code has been compiled with

ghc --make -threaded mytest.hs

I've been trying input files of different lengths, but the more cores  
I try to use, the worst performance I am getting.
Here are some examples:

# input.txt -> 10 lines (strings) of ~1200 letters each
$ time ./mytest +RTS -N1 > /dev/null

real    0m4.775s
user    0m4.700s
sys     0m0.080s

$ time ./mytest +RTS -N4 > /dev/null

real    0m6.272s
user    0m8.220s
sys     0m0.290s

$ time ./mytest +RTS -N8 > /dev/null

real    0m7.090s
user    0m10.960s
sys     0m0.400s

# input.txt -> 100 lines (strings) of ~1200 letters each
$ time ./mytest +RTS -N1 > /dev/null

real    0m49.854s
user    0m49.730s
sys     0m0.120s

$ time ./mytest +RTS -N4 > /dev/null

real    1m11.303s
user    1m36.210s
sys     0m1.070s

$ time ./mytest +RTS -N8 > /dev/null

real    1m19.488s
user    2m6.250s
sys     0m1.270s


What is going wrong in this code? Is this a problem of the "grain  
size" of the parallelization?
Any help / advice would be very welcome,

M;
                
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090522/5bd5abc8/attachment.html

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 11, Issue 15
*****************************************

Reply via email to