Albert Lai | 1 Sep 03:55 2006
Picon

Re: Haskell XML

Till Mossakowski <till <at> informatik.uni-bremen.de> writes:

> Could someone summarize the pros and cons of
> HXT versus HaXml versus HSX?

>From my perspective (therefore perhaps important but hardly
comprehensive), HXT vs HaXml:

HXT provides arrows.  The con is you have to learn arrows.  The pro is
the arrows provided have the same capability as monads of state and IO.

Dually, HaXml does not provide arrows or equivalent.  The provided
functions of type "Content -> [Content]" ("Content" is the node type)
are not very flexible or helpful if you want to thread a state through
a parse tree, e.g., a recent question in haskell-cafe on how to insert
random numbers as attribute values into a document using HaXml.

(I lied about the con of HXT.  You don't have to learn arrows if you
really resist --- monads of the same capability are provided too.)

I have no comment on HSX, and you already know the language vs library
contrast.
Andreas S | 3 Sep 01:51 2006
Picon

putStr is not evaluated in the correct order

Hello, i've got a newbie question to ask. I'd like to ask for user input in 
the same line as the prompt. I found this example on the web
main = do
   putStr "Who are you? "
   name <- getLine
   putStrLn ("Hello, " ++ name)

This works find in ghci, but the compiled code (ghc 6.4.2) executes getLine 
first before executing putStr. Instead of:
Who are you? myself
Hello, myself

I got:
myself
Who are you? Hello, myself

I'm new with haskell, so I can't be too sure about this, but it seems from 
putStr implementation in Prelude, putStr should be executed first.

Why are they different? And if they are suppose to be different, then how to 
put prompt and input on the same line for the compiled code?

Thank you in advance
-andre
Jeremy Shaw | 3 Sep 02:11 2006

Re: putStr is not evaluated in the correct order

Hello,

GHCi and the compiled program do not buffer the output in quite the
same way. In the compile program, stdout is line buffered, so it will
not output anything until it gets a '\n'. You can force the output
using 'hFlush stdout':

> import System.IO
> main = do
>    putStr "Who are you? "
>    hFlush stdout
>    name <- getLine
>    putStrLn ("Hello, " ++ name)
> 

You could also change stdout to be unbuffered -- but using flush is
probably the prefered method:

> main = do
>    hSetBuffering stdout NoBuffering
>    putStr "Who are you? "
>    name <- getLine
>    putStrLn ("Hello, " ++ name)

Either solution should make the GHCi and compiled version behave the
same.

The behaviour of the compiled version is consistent with most other
languages under Unix. The behaviour under GHCi could be considered
buggy -- it has certainly confused many people. On the other hand, I
(Continue reading)

Tomasz Zielonka | 3 Sep 09:20 2006
Picon

Re: putStr is not evaluated in the correct order

On Sat, Sep 02, 2006 at 05:11:33PM -0700, Jeremy Shaw wrote:
> GHCi and the compiled program do not buffer the output in quite the
> same way.

This comes up so often that perhaps GHCi should advertise those
differences. For example, the starting message could say something
like this:

   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.?, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

For a list of differences between GHCi-interpreted and GHC-compiled
programs, type :differences

Loading package base-1.0 ... linking ... done.

Best regards
Tomasz
Eijiro Sumii | 4 Sep 08:40 2006
Picon

Re: Call for Posters, APLAS 2006 (in Sydney, in November)

The deadline of abstracts for APALS 2006 poster presentation is approaching.

    http://www.kb.ecei.tohoku.ac.jp/aplas2006/
    http://www.kb.ecei.tohoku.ac.jp/aplas2006/call-for-posters.txt

Our web server is now alive.  (It was down because of power outage
when this announcement was distributed last time.  We are sorry if you
experienced any inconvenience.)

Eijiro Sumii
APLAS 2006 Poster Chair

>                     CALL FOR POSTER PRESENTATIONS
>
>    The Fourth ASIAN Symposium on Programming Languages and Systems
>                              (APLAS 2006)
>
>                        November 8-10, 2006
>            University of New South Wales, Sydney, Australia
>
>               Deadline for Abstracts: September 11, 2006
>
> APLAS 2006 will include a poster session during the conference.  The
> session aims to give students and researchers an opportunity to
> present their research to the community, and to get responses from
> other researchers.
>
> SCOPE:
>
> Poster presentations are sought in all areas of programming languages
(Continue reading)

Tope Omitola | 4 Sep 00:35 2006
Picon
Picon

2nd CALL FOR PAPERS: CLAT 2007


*************our apologies for multiple copies****************

===============================================

                      SECOND CALL FOR PAPERS

                                   CLAT 2007
  Computer-aided Law and Advanced Technologies track
of ACM Symposium on Applied Computing, SAC 2007
                         http://www.clat.unibo.it
                         http://www.mfn.unipmn.it/~lavinia/clat2007

                        Seoul, Korea, March 11-15, 2007
===============================================

The 3rd Computer-aided Law and Advanced Technologies forum (CLAT
2007) will be held as part of the 22nd ACM Symposium on Applied
Computing (SAC 2007), March 11-15, 2007, Seoul, Korea (http://
www.acm.org/conferences/sac/sac2007/).

SAC 2007
For the past twenty years, the ACM Symposium on Applied Computing
(SAC) has been an essential forum for applied computer scientists,
computer engineers, software engineers, and application developers
from around the world.  SAC 2007 is sponsored by the ACM Special
Interest Group on Applied Computing, and hosted by the Seoul National
University in Seoul, and Suwon University in Gyeonggi-do.

CLAT 2007 Advances in computer applications and the social cyberspaces
(Continue reading)

Simon Marlow | 4 Sep 10:49 2006
Picon

Re: putStr is not evaluated in the correct order

Tomasz Zielonka wrote:
> On Sat, Sep 02, 2006 at 05:11:33PM -0700, Jeremy Shaw wrote:
> 
>>GHCi and the compiled program do not buffer the output in quite the
>>same way.
> 
> 
> This comes up so often that perhaps GHCi should advertise those
> differences. For example, the starting message could say something
> like this:
> 
>    ___         ___ _
>   / _ \ /\  /\/ __(_)
>  / /_\// /_/ / /  | |      GHC Interactive, version 6.?, for Haskell 98.
> / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
> \____/\/ /_/\____/|_|      Type :? for help.
> 
> For a list of differences between GHCi-interpreted and GHC-compiled
> programs, type :differences
> 
> Loading package base-1.0 ... linking ... done.

It is in the FAQ.  The FAQ is currently a bit hard to navigate and could do with 
splitting up into separate pages, though.

http://haskell.org/haskellwiki/GHC:FAQ#If_I_print_out_a_string_using_putStr.2C_and_then_attempt_to_read_some_input_using_hGetLine.2C_I_don.27t_see_the_output_from_the_putStr.

We could consider adding a message along the lines you suggest... any other ideas?

Cheers,
(Continue reading)

Tope Omitola | 4 Sep 00:35 2006
Picon
Picon

2nd CALL FOR PAPERS: CLAT 2007


*************our apologies for multiple copies****************

===============================================

                      SECOND CALL FOR PAPERS

                                   CLAT 2007
  Computer-aided Law and Advanced Technologies track
of ACM Symposium on Applied Computing, SAC 2007
                         http://www.clat.unibo.it
                         http://www.mfn.unipmn.it/~lavinia/clat2007

                        Seoul, Korea, March 11-15, 2007
===============================================

The 3rd Computer-aided Law and Advanced Technologies forum (CLAT
2007) will be held as part of the 22nd ACM Symposium on Applied
Computing (SAC 2007), March 11-15, 2007, Seoul, Korea (http://
www.acm.org/conferences/sac/sac2007/).

SAC 2007
For the past twenty years, the ACM Symposium on Applied Computing
(SAC) has been an essential forum for applied computer scientists,
computer engineers, software engineers, and application developers
from around the world.  SAC 2007 is sponsored by the ACM Special
Interest Group on Applied Computing, and hosted by the Seoul National
University in Seoul, and Suwon University in Gyeonggi-do.

CLAT 2007 Advances in computer applications and the social cyberspaces
(Continue reading)

Paul Johnson | 4 Sep 21:05 2006
Picon

Re: putStr is not evaluated in the correct order

"Andreas S" <andreas_s <at> hotmail.com> writes:

> This works find in ghci, but the compiled code (ghc 6.4.2) executes getLine 
> first before executing putStr. Instead of:
> Who are you? myself
> Hello, myself
> 
> I got:
> myself
>Who are you? Hello, myself

I have now fixed the WikiBook to use putStrLn instead of putStr.  Sorry about that.

Paul.
Clifford Beshers | 4 Sep 21:27 2006

Re: Re: putStr is not evaluated in the correct order


Simon Marlow wrote:
>
> We could consider adding a message along the lines you suggest... any 
> other ideas?
>

I remember running into this.  I wasn't confused by the expected 
behavior, it was the fact that ghci had different behavior than compiled 
programs and that the settings seem to be wrong at startup.  I tracked 
down this bug at the time and forgot to report it.

ghci starts with NoBuffering behavior, even though the mode appears to 
be LineBuffering.  Setting it once fixes the problem.

I've included a ghci session that demonstrates the bug by showing the 
change in behavior when pressing Control-D in response to each call to 
getLine. The results are identical for 6.4.1 and 6.6 rc1.

   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Prelude> :m +System.IO
Prelude System.IO> hGetBuffering stdin >>= print
LineBuffering
Prelude System.IO> getLine >>= print
(Continue reading)


Gmane