Commit 9f9d5dfc authored by ian@well-typed.com's avatar ian@well-typed.com

Detabbing

parent 442a39f7
......@@ -5,25 +5,25 @@ import Mandel
import PortablePixmap
import System.IO
main = getContents >>= \ userInput ->
readNum "Enter min x = " (lines userInput) $ \ minx input ->
readNum "Enter min y = " input $ \ miny input ->
readNum "Enter max x = " input $ \ maxx input ->
readNum "Enter max y = " input $ \ maxy input ->
readNum "Screen width = " input $ \ screenX input ->
readNum "Screen height= " input $ \ screenY input ->
readNum "Screen depth = " input $ \ limit _ ->
putStr (show (mandelset minx miny maxx maxy screenX screenY limit))
main = getContents >>= \ userInput ->
readNum "Enter min x = " (lines userInput) $ \ minx input ->
readNum "Enter min y = " input $ \ miny input ->
readNum "Enter max x = " input $ \ maxx input ->
readNum "Enter max y = " input $ \ maxy input ->
readNum "Screen width = " input $ \ screenX input ->
readNum "Screen height= " input $ \ screenY input ->
readNum "Screen depth = " input $ \ limit _ ->
putStr (show (mandelset minx miny maxx maxy screenX screenY limit))
readNum::(Num a, Read a) => String -> [String] -> (a->[String]->IO ()) -> IO ()
readNum prompt inputLines succ
= hPutStr stderr prompt >>
case inputLines of
(x:xs) -> case (reads x) of
[(y,"")] -> succ y xs
_ -> hPutStr stderr "Error - retype the number\n" >>
readNum prompt xs succ
_ -> hPutStr stderr "Early EOF"
[(y,"")] -> succ y xs
_ -> hPutStr stderr "Error - retype the number\n" >>
readNum prompt xs succ
_ -> hPutStr stderr "Early EOF"
{-
Enter min x = -1.5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment