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

SourceForge.net noreply at sourceforge.net
Tue May 20 04:57:08 EDT 2003


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 at informatik.uni-freiburg.de


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

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



More information about the Glasgow-haskell-bugs mailing list