GPWiki.org
GPWiki.org
It is currently Sun May 19, 2013 2:30 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Sep 05, 2008 12:39 am 
Prolific Poster

Joined: Sat Aug 02, 2008 11:33 pm
Posts: 18
when i run this haskell program in the eclipse fp console it waits for my input before asking for it , however when i run it from a terminal it behaves correctly
Code:
module Main where

main = do
  putStrLn "Please enter your name: "
  name <- getLine
  putStrLn ("Hello, " ++ name ++ ", how are you?")


im using eclipse 3.3 with the functionalprogramming plugin and the GHC compiler

any ideas what is going on or how to fix it?

_________________
let rec waste_time t =
waste_time (t + dt);;


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 05, 2008 6:01 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
possibly the console is running in a buffered mode and it isn't correctly flushing stdout before starting a read on stdin.

I don't know haskell though so I don't know how to force a flush.

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 05, 2008 1:47 pm 
Prolific Poster

Joined: Sat Aug 02, 2008 11:33 pm
Posts: 18
thanks ,i fixed it by explicitly setting the console to line buffering on stdout to LineBuffering

_________________
let rec waste_time t =
waste_time (t + dt);;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group