Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  very detailed monad tutorials (Michael Vanier)
   2.  Man/dir/help pages for haskell?  (Kevin Burke)
   3. Re:  Man/dir/help pages for haskell? (Magnus Therning)
   4.  hClose: illegal operation (handle is finalized)  and/or
      <<loop>> (Travis Erdman)
   5. Re:  hClose: illegal operation (handle is finalized) and/or
      <<loop>> (Yitzchak Gale)
   6. Re:  Man/dir/help pages for haskell? (Daniel Fischer)
   7.  2 Questions: mutable data and copying results (C Gosch)
   8. Re:  2 Questions: mutable data and copying results (Johan Tibell)


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

Message: 1
Date: Mon, 16 Aug 2010 20:46:04 -0700
From: Michael Vanier <mvanie...@gmail.com>
Subject: [Haskell-beginners] very detailed monad tutorials
To: beginners@haskell.org
Message-ID: <4c6a05fc.9080...@cs.caltech.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

  Hi everyone,

I've been writing a bunch of in-depth monad tutorials that I thought 
some of you might find useful.  So far there are six, with at least 
three more planned.  Here are the links:

Part 1 (Basics): http://mvanier.livejournal.com/3917.html

Part 2 (>>= and return): http://mvanier.livejournal.com/4305.html

Part 3 (The monad laws): http://mvanier.livejournal.com/4586.html

Part 4 (The Maybe and list monads): http://mvanier.livejournal.com/4647.html

Part 5 (Error-handling monads, part 1): 
http://mvanier.livejournal.com/5103.html

Part 6 (Error-handling monads, part 2): 
http://mvanier.livejournal.com/5343.html

The next ones will deal with state monads.  I would love to get some 
feedback on these.

Cheers,

Mike




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

Message: 2
Date: Mon, 16 Aug 2010 21:01:19 -0700
From: Kevin Burke <k...@inburke.com>
Subject: [Haskell-beginners] Man/dir/help pages for haskell? 
To: beginners@haskell.org
Message-ID: <2ca5b88a-fc51-41c9-8d3b-304e5e194...@inburke.com>
Content-Type: text/plain; charset="us-ascii"

Hello,
   I've been learning Haskell by working through the O'Reilly book, but a lot 
of the coding I do is offline. One thing that's been really helpful in other 
languages are the terminal instructions and detail for functions. Is there 
something similar for Haskell? I know I can type :help at the prompt but that 
only gives you info on the broad commands. 

Thanks for your help,
Kevin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100816/16d7e249/attachment-0001.html

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

Message: 3
Date: Tue, 17 Aug 2010 06:39:15 +0100
From: Magnus Therning <mag...@therning.org>
Subject: Re: [Haskell-beginners] Man/dir/help pages for haskell?
To: beginners@haskell.org
Message-ID: <4c6a2083.7000...@therning.org>
Content-Type: text/plain; charset="utf-8"

On 17/08/10 05:01, Kevin Burke wrote:
> Hello,
> I've been learning Haskell by working through the O'Reilly book, but a lot
> of the coding I do is offline. One thing that's been really helpful in other
> languages are the terminal instructions and detail for functions. Is there
> something similar for Haskell? I know I can type :help at the prompt but
> that only gives you info on the broad commands.

I would suggest installing the haddock documentation for all
packages/modules
you use.  Depending on your system that may already be the case (e.g. Arch),
or you may have to install separate document packages (e.g. Debian).  If you
install manually, using 'cabal', then there really ought to be some way of
also compiling the docs and installing them.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org           Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : 
http://www.haskell.org/pipermail/beginners/attachments/20100817/5c0720b0/signature-0001.bin

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

Message: 4
Date: Tue, 17 Aug 2010 01:58:12 -0700 (PDT)
From: Travis Erdman <traviserd...@yahoo.com>
Subject: [Haskell-beginners] hClose: illegal operation (handle is
        finalized)      and/or <<loop>>
To: beginners@haskell.org
Message-ID: <406331.5783...@web114708.mail.gq1.yahoo.com>
Content-Type: text/plain; charset=us-ascii

I read in some data from a file (via decodeFile), process it, and write the 
result back to a file.  My last line of code is ....

encodeFile (filename++".sol") (gametype,gstree,newiterlist,newstamplist,result)

and it is all of the sudden now causing this run-time error:

mincfr: kclv5.sol: hClose: illegal operation (handle is finalized)

It has been working fine for quite a while, but now quite mysteriously gives 
this error.  (But obviously I have been heavily tinkering with the processing 
part of the program).

If I remove the encodeFile line and instead ...

putStrLn $ show result

I get this run-time error:

<<loop>>


Help?

thanks,

Travis



      


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

Message: 5
Date: Tue, 17 Aug 2010 13:09:50 +0300
From: Yitzchak Gale <g...@sefer.org>
Subject: Re: [Haskell-beginners] hClose: illegal operation (handle is
        finalized) and/or <<loop>>
To: Travis Erdman <traviserd...@yahoo.com>
Cc: beginners@haskell.org
Message-ID:
        <aanlktik+_pxpt__=3hj_w3gvdc=4dp+i_pj3wfqgy...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Travis Erdman wrote:
> encodeFile (filename++".sol") 
> (gametype,gstree,newiterlist,newstamplist,result)
>
> mincfr: kclv5.sol: hClose: illegal operation (handle is finalized)

That is a confusing error message caused by a bug in GHC
that was just reported a few days ago. The GHC team is
fixing it.

> putStrLn $ show result
>
> <<loop>>

That is the *real* error message.

It means that where you define result, you refer to result
also on the right-hand side in a way that is an endless
loop instead of well-behaved recursion.

We would have to see more of your code to be able to
say much more.

Regards,
Yitz


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

Message: 6
Date: Tue, 17 Aug 2010 12:40:38 +0200
From: Daniel Fischer <daniel.is.fisc...@web.de>
Subject: Re: [Haskell-beginners] Man/dir/help pages for haskell?
To: beginners@haskell.org
Message-ID: <201008171240.39002.daniel.is.fisc...@web.de>
Content-Type: text/plain;  charset="utf-8"

On Tuesday 17 August 2010 07:39:15, Magnus Therning wrote:
> On 17/08/10 05:01, Kevin Burke wrote:
> > Hello,
> > I've been learning Haskell by working through the O'Reilly book, but a
> > lot of the coding I do is offline. One thing that's been really
> > helpful in other languages are the terminal instructions and detail
> > for functions. Is there something similar for Haskell? I know I can
> > type :help at the prompt but that only gives you info on the broad
> > commands.
>
> I would suggest installing the haddock documentation for all
> packages/modules
> you use.  Depending on your system that may already be the case (e.g.
> Arch), or you may have to install separate document packages (e.g.
> Debian).  If you install manually, using 'cabal', then there really
> ought to be some way of also compiling the docs and installing them.

Set

documentation: True

in ~/.cabal/config

to automatically build local docs for each installed package.
Also it might be a good idea to set

library-profiling: True

there.



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

Message: 7
Date: Tue, 17 Aug 2010 14:34:15 +0200
From: C Gosch <ch.go...@googlemail.com>
Subject: [Haskell-beginners] 2 Questions: mutable data and copying
        results
To: beginners@haskell.org
Message-ID:
        <aanlkti=8akd1cov9n5gmlzdpbdo-pynsyrm+fybdo...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello to all Haskell experts!
I have two more beginner questions: I ran into texts mentioning types of
"mutable" data.
Does that mean the data is actually changed in place? How would I go about
implementing such a data type,
as I expect much higher performance in some applications? Do I do that with
the Foreign module and Ptr
types?

The second question is this: say I have some functions working with a data
type, say a graph.
Some of them might want to change the graph and return a new graph as a
result.
If they change say only one graph node, it would be extremely bad for
performance if the whole graph got copied
any time such a change takes place. Is the compiler smart enough to make the
code only copy the parts
that have changed (copying lazily, so to speak)? Is that even possible?

Thank you in advance for any hint!
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100817/caef149b/attachment-0001.html

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

Message: 8
Date: Tue, 17 Aug 2010 14:58:47 +0200
From: Johan Tibell <johan.tib...@gmail.com>
Subject: Re: [Haskell-beginners] 2 Questions: mutable data and copying
        results
To: C Gosch <ch.go...@googlemail.com>
Cc: beginners@haskell.org
Message-ID:
        <aanlktikj4rppzwsr_c_qutwxqtmadfodfo6drc4mo...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi Christian!

On Tue, Aug 17, 2010 at 2:34 PM, C Gosch <ch.go...@googlemail.com> wrote:

> I have two more beginner questions: I ran into texts mentioning types of
> "mutable" data.
> Does that mean the data is actually changed in place? How would I go about
> implementing such a data type,
> as I expect much higher performance in some applications? Do I do that with
> the Foreign module and Ptr
> types?
>

Yes, by mutable data we mean data that changes in place. There are several
ways to use mutable data in Haskell: mutable variables and arrays in the ST
monad, IORefs, MVars (for concurrent access), and Ptrs (although these
should mostly be used for foreign function calls).


> The second question is this: say I have some functions working with a data
> type, say a graph.
> Some of them might want to change the graph and return a new graph as a
> result.
> If they change say only one graph node, it would be extremely bad for
> performance if the whole graph got copied
> any time such a change takes place. Is the compiler smart enough to make
> the code only copy the parts
> that have changed (copying lazily, so to speak)? Is that even possible?
>

Since the graph is immutable most of the nodes in the new graph are shared
with nodes in the old graph. This is know as path copying and is everywhere
persistent ("immutable") data structures are used. Updating a data structure
(e.g. a tree) typically requires O(log n) nodes to be copied.

-- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100817/7d59fdb3/attachment.html

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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 26, Issue 34
*****************************************

Reply via email to