home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IO Examples / Small IO Examples / HelloWorld.icl < prev   
Encoding:
Text File  |  1997-04-25  |  1.3 KB  |  34 lines  |  [TEXT/3PRM]

  1. module HelloWorld
  2.  
  3. /*    Hello World!
  4. */
  5.  
  6. import deltaEventIO, deltaWindow, deltaPicture
  7.  
  8. DontCareId    :==    0
  9.  
  10. Start :: *World -> *World
  11. Start world
  12. #    (events,world)    = OpenEvents world                                // fetch the event stream from the world
  13.     (_,events)        = StartIO ioSystem initProgramState [] events    // perform our IO function on the event stream
  14.     world            = CloseEvents events world                        // close the event stream
  15. =    world
  16. where
  17.     ioSystem                                                        // this program uses only a window
  18.         = [WindowSystem [window]]
  19.     window
  20.         = FixedWindow DontCareId (10,10) "Greeting" ((0,0),(162,100)) updateFunction 
  21.             [    Keyboard Able quitFunction                            // pressing any key quits the program
  22.             ,    Mouse    Able quitFunction                            // pressing the mouse quits the program
  23.             ,    GoAway   quit                                        // closing the window quits the program
  24.             ]
  25.     quitFunction _ programState io                                    // ignore the first argument of mouse or keyboard information
  26.         = quit programState io
  27.     quit programState io                                            // bye, bye: causes StartIO to terminate
  28.         = (programState, QuitIO io)    
  29.     updateFunction _ programState                                    // display the contens of the window
  30.         = (programState, [MovePenTo (30,30), DrawString "Hello World!"])
  31.     
  32.     initProgramState                                                // arbitrary because this program doesn't use the program state
  33.         = 0
  34.