On Mon, Apr 1, 2013 at 6:26 AM, Ovidiu D <ovidiudeac@gmail.com> wrote:Eschewing laziness (which adds only complexity in this case), here's
> 1. Make f behave lazy
> Its input list is made of lines read from stdin and I want it to process
> lines one by one as they are entered by the user.
something that'll work, if a little ugly:
import System.Exit
f :: String -> IO ()
f "exit" = exitSuccess
f a = putStrLn $ "you entered: " ++ a
main = do
s <- getLine
f s
main
Going down this path would involve IORef's, among others from the "sin bin".
Something more pure and haskell-y would typically involve an analysis
of the DSL abstract syntax and state space and implementation using a
combination of State and Free monads.
-- Kim-Ee
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners