Created
July 9, 2012 21:25
-
-
Save ben0x539/3079049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std; | |
import result::{result, ok, chain}; | |
fn read_file(filename: str) -> result<@str, @str> { | |
ret ok(@("<contents of " + filename + ">")); | |
} | |
fn parse_buf(buf: @str) -> @str { | |
ret @("<parsed: " + *buf + ">"); | |
} | |
fn main(_args: ~[str]) { | |
let res = do chain(read_file("foo")) |buf| { | |
ok(parse_buf(buf)) | |
}; | |
log(info, res); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment