Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
nofib
Commits
9f9d5dfc
Commit
9f9d5dfc
authored
Dec 12, 2012
by
ian@well-typed.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detabbing
parent
442a39f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
spectral/mandel/Main.lhs
spectral/mandel/Main.lhs
+13
-13
No files found.
spectral/mandel/Main.lhs
View file @
9f9d5dfc
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment