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:  Generating Code To Embed in an Event Loop (Darrin Thompson)
   2. Re:  Need some advices about university (Brent Yorgey)
   3.  Forcing output of show (Hugo Ferreira)
   4. Re:  Forcing output of show (Daniel Fischer)
   5. Re:  Forcing output of show (Hugo Ferreira)
   6. Re:  Generating Code To Embed in an Event Loop (Stephen Tetley)


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

Message: 1
Date: Wed, 26 Oct 2011 08:11:57 -0400
From: Darrin Thompson <[email protected]>
Subject: Re: [Haskell-beginners] Generating Code To Embed in an Event
        Loop
To: Stephen Tetley <[email protected]>
Cc: [email protected]
Message-ID:
        <cabe4vzwuei6kqfqxtwvdivgu1frcruk3zpnpnrv6taykjbw...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Tue, Oct 25, 2011 at 6:08 PM, Stephen Tetley <[email protected]>wrote:

> Pragmatically, code generation works well in domains where you have a
> succint input format and many candidates to generate - parser
> generators like YACC or Haskell's Happy are prime examples. If you
> don't have many candidates for generating, writing good libraries in
> the low-level language seems a more profficient use of one's time.
>
>
Can you elaborate on why? Is it because code generation is a lot harder than
it looks? Or that it's a lot of tedious work for just one output program?

--
Darrin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111026/632f99c1/attachment-0001.htm>

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

Message: 2
Date: Wed, 26 Oct 2011 10:04:09 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] Need some advices about university
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Wed, Oct 26, 2011 at 01:56:05PM +0800, Zhi-Qiang Lei wrote:
> Hi,
> 
> I'm making a plan to gain more computer knowledge (functional
> programming and Haskell especially) and a Master's degree in a
> university. Does anybody know which university in USA has good
> resources in this domain? Thanks.

The University of Pennsylvania has a good masters' degree program and
a great programming languages group -- although they are not really
connected (you would not get to study a whole lot of FP stuff while
doing the masters' degree).  But of course you could come to the PL
group meetings.

-Brent



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

Message: 3
Date: Wed, 26 Oct 2011 15:23:20 +0100
From: Hugo Ferreira <[email protected]>
Subject: [Haskell-beginners] Forcing output of show
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hello,

Apologies for this newbie question.
I have a test function:

testLearnRules train = do
   h <- IO.openFile train IO.ReadMode
   c <- IO.hGetContents h
   let proposedRules = instRules $ words c
   let rs = take 10 $ M.assocs proposedRules
   let _ = show rs
   -- let _ = length rs
   return ()

I realize that nothing is executed due to Haskell's
lazy evaluation. How can I force show to print
something to the screen?

Appreciate any pointers,

TIA,
Hugo F.



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

Message: 4
Date: Wed, 26 Oct 2011 16:29:52 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Forcing output of show
To: [email protected]
Message-ID: <[email protected]>
Content-Type: Text/Plain;  charset="iso-8859-1"

On Wednesday 26 October 2011, 16:23:20, Hugo Ferreira wrote:
> Hello,
> 
> Apologies for this newbie question.
> I have a test function:
> 
> testLearnRules train = do
>    h <- IO.openFile train IO.ReadMode
>    c <- IO.hGetContents h
>    let proposedRules = instRules $ words c
>    let rs = take 10 $ M.assocs proposedRules
>    let _ = show rs
>    -- let _ = length rs
>    return ()
> 
> I realize that nothing is executed due to Haskell's
> lazy evaluation. How can I force show to print
> something to the screen?

You can't force show to rpint something, since show is a pure function not 
involving IO.
However, testLearnRules does involve IO, so instead of

    let _ = show rs

you could simply print it out,

    print rs

-- equivalently, putStrLn (show rs)

> 
> Appreciate any pointers,
> 
> TIA,
> Hugo F.




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

Message: 5
Date: Wed, 26 Oct 2011 15:40:36 +0100
From: Hugo Ferreira <[email protected]>
Subject: Re: [Haskell-beginners] Forcing output of show
To: Daniel Fischer <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 10/26/2011 03:29 PM, Daniel Fischer wrote:
> On Wednesday 26 October 2011, 16:23:20, Hugo Ferreira wrote:
>> Hello,
>>
>> Apologies for this newbie question.
>> I have a test function:
>>
>> testLearnRules train = do
>>     h<- IO.openFile train IO.ReadMode
>>     c<- IO.hGetContents h
>>     let proposedRules = instRules $ words c
>>     let rs = take 10 $ M.assocs proposedRules
>>     let _ = show rs
>>     -- let _ = length rs
>>     return ()
>>
>> I realize that nothing is executed due to Haskell's
>> lazy evaluation. How can I force show to print
>> something to the screen?
>
> You can't force show to rpint something, since show is a pure function not
> involving IO.
> However, testLearnRules does involve IO, so instead of
>
>      let _ = show rs
>
> you could simply print it out,
>
>      print rs
>
> -- equivalently, putStrLn (show rs)
>

Thank you,

Hugo F.

>>
>> Appreciate any pointers,
>>
>> TIA,
>> Hugo F.
>




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

Message: 6
Date: Wed, 26 Oct 2011 19:01:40 +0100
From: Stephen Tetley <[email protected]>
Subject: Re: [Haskell-beginners] Generating Code To Embed in an Event
        Loop
Cc: [email protected]
Message-ID:
        <cab2tpraq3+mnznmjbxa0ogz6ihw94zbuppcdtowsg0y3bq-...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Darrin

I'd contend code generation isn't particularly hard or even tedious,
but there are two big problems. One, its inflexible - its almost
always easier to change code in the target language than a generator.
Two, in essence a generator already contains the target program plus
the scaffolding to generate it. If you don't have many variations to
generate it is more work (often much more work) to make a generator
rather than hand code the target language program.

Best wishes

Stephen



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

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


End of Beginners Digest, Vol 40, Issue 41
*****************************************

Reply via email to