home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / hugs_1 / demos_hs_AnsiDemo < prev    next >
Encoding:
Text File  |  1996-08-12  |  1.1 KB  |  28 lines

  1. -- This program is a simple example of the kind of thing that you can do with
  2. -- ANSI escape character sequences.  But, of course, it will only work on
  3. -- machines that support those character sequences (xterms and PCs with
  4. -- ansi.sys installed, for example).
  5. --
  6. -- Type `interact program' to run the program.
  7.  
  8. import AnsiInteract
  9.  
  10. writes  = writeStr . concat
  11. program = writes [ cls,
  12.                    at (17,5)  (highlight "Demonstration program"),
  13.                    at (48,5)  "Version 1.0",
  14.                    at (17,7)  "This program illustrates a simple approach",
  15.                    at (17,8)  "to screen-based interactive programs using",
  16.                    at (17,9)  "the Hugs functional programming system.",
  17.                    at (17,11) "Please press any key to continue ..."
  18.                  ]
  19.           (pressAnyKey
  20.           (promptReadAt (17,15) 18 "Please enter your name: " (\name ->
  21.           (let reply = "Hello " ++ name ++ "!" in
  22.            writeAt (40-(length reply`div` 2),18) reply
  23.           (moveTo (1,23)
  24.           (writeStr "I'm waiting...\n"
  25.           (pressAnyKey
  26.           end)))))))
  27.  
  28.