logo       

[ ghc-Bugs-740326 ] hFlush doesn't seem to work under GHCi/Solaris: msg#00023

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-740326 ] hFlush doesn't seem to work under GHCi/Solaris

Bugs item #740326, was opened at 2003-05-20 01:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=740326&group_id=8032

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: hFlush doesn't seem to work under GHCi/Solaris

Initial Comment:
Hi folks,

executing "hFlush stdout" doesn't seem to have any
effect when working under GHCi on Solaris (at least for
me ...). Consider the following toy program:

----------------------------
module Main where

import IO

main :: IO ()
main =
do n <- askQuestion "How many numbers would you like
to sum up? "
is <- mapM askNumber [1..n]
let s = sum is
putStrLn $ "The total sum is " ++ (show s) ++ "."

askQuestion :: String -> IO Int
askQuestion s =
do putStr s
hFlush stdout
fmap read getLine

askNumber :: Int -> IO Int
askNumber i = askQuestion $ "Please input number " ++
(show i) ++ ": "
-------------------------------

While everything looks fine under Linux (or when
executing the program after compiling it with GHC) the
output under Solaris looks rather messed up:
---------------------
> ghci-5.04.2 ex2-1.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.04.2, for Haskell 98.
/ /_\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.

Loading package base ... linking ... done.
Loading package haskell98 ... linking ... done.
Compiling Main ( ex2-1.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
How many numbers would you like to sum up? 4
1
Please input number 1: Please input number 2: 2
3
Please input number 3: Please input number 4: 4


The total sum is 10.
*Main>
-----------------------

This is a GHCi-5.04.2 built from the source
distribution under Sparc/Solaris by the way.

Cheers,

Matthias Neubauer
neubauer@xxxxxxxxxxxxxxxxxxxxxxxxxx


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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=740326&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise