diff options
author | Mart Lubbers | 2015-04-24 14:35:17 +0200 |
---|---|---|
committer | Mart Lubbers | 2015-04-24 14:35:17 +0200 |
commit | a067356625105f50978443d3b0a0a5d8f6391184 (patch) | |
tree | d194d49f36232b8e5860ca557c75f11a3ac05afe /fp2/week2/mart/StdIOMonad.icl | |
parent | updated practicum files (diff) |
rare shit
Diffstat (limited to 'fp2/week2/mart/StdIOMonad.icl')
-rw-r--r-- | fp2/week2/mart/StdIOMonad.icl | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/fp2/week2/mart/StdIOMonad.icl b/fp2/week2/mart/StdIOMonad.icl index 7f112a7..1d4b24e 100644 --- a/fp2/week2/mart/StdIOMonad.icl +++ b/fp2/week2/mart/StdIOMonad.icl @@ -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
+
+// Deze module verpakt StdFile in een monadische jas
+
+import StdFile
+import StdMonad
+//import StdOverloaded
+
+:: IO a = IO [a] // kies een geschikte representatie voor IO
+:: Filemode = Lees | Schrijf
+:: Filenaam :== String
+:: Filehandle :== [] // kies een geschikte representatie voor Filehandle
+
+//instance toInt Filemode where
+// toInt Lees = FReadText
+// toInt Schrijf = FWriteText
|