Commit Graph

2 Commits

Author SHA1 Message Date
Jan de Muijnck-Hughes
5ea6aa0520 Address semantic differences in putting things to STDOUT.
The changes are as follows:

+ `print` is for putting showable things to STDOUT.
+ `printLn` is for putting showable things to STDOUT with a new line
+ `putCharLn` for putting a single character to STDOUT, with a new line.

Effects has been updated accordingly.
2015-03-06 17:26:33 +00:00
Edwin Brady
8f93b00307 Syntax for failures in pattern matching let/<-
let pat = val | <alternatives> in x'

...becomes...

  case val of
       pat => x'
       <alternatives>

  do pat <- val | <alternatives>
     p

...becomes...

  do x <- val
     case x of
          pat => p
          <alternatives>

So in particular, large effectful functions can deal with failure inline
rather than having lots of nested case blocks, e.g.

main : IO ()
main = do [p, a] <- getArgs
                      | [p] => putStrLn "No arguments!"
                      | (x :: y :: _) => putStrLn "Too many arguments!"
          print (foo (Just (cast a)))
2014-03-07 20:57:43 +00:00