The do notation
I/O actions may be combined in sequence.
tick :: String -> IO Integer
tick f =
do contents <- readFile f
let n = read contents
writeFile f (show (n+1))
return n
Type: IO ()
No need to
bind a name
to the result.
Föregående bild
Nästa bild
Tillbaka till första bilden
Visa grafisk version