rare shit
[fp1415.git] / fp2 / week2 / mart / StdIOMonad.icl
index 7f112a7..1d4b24e 100644 (file)
@@ -1,22 +1,16 @@
-module StdIOMonad
-
-import StdEnv, StdMaybe, StdMonad, StdFile
-
-:: IO a = IO (*World -> *(a, *World))
-
-read :: *World -> (IO String, *World)
-read world
-# (io, world) = stdio world
-# (line, io) = freadline io
-# (ok, world) = fclose io
-| not ok = abort "Couldn't close console"
-| otherwise = line
-
-instance return IO where
-       return x = IO (\w = (x, w))
-
-instance >>= IO where
-       >>= (IO f) g = (IO f)
-
-Start :: *World -> (IO String, *World)
-Start world = read 
+implementation module StdIOMonad\r
+\r
+//     Deze module verpakt StdFile in een monadische jas\r
+\r
+import StdFile\r
+import StdMonad\r
+//import StdOverloaded\r
+\r
+:: IO a = IO [a]       // kies een geschikte representatie voor IO\r
+:: Filemode = Lees | Schrijf\r
+:: Filenaam :== String\r
+:: Filehandle :== []   // kies een geschikte representatie voor Filehandle\r
+\r
+//instance toInt Filemode where\r
+//     toInt Lees                                              = FReadText\r
+//     toInt Schrijf                                   = FWriteText\r