2012-06-29 18:26:56 -05:00
|
|
|
impl monad<A> for ~[A] {
|
|
|
|
fn bind<B>(f: fn(A) -> ~[B]) {
|
2012-04-07 19:11:33 -05:00
|
|
|
let mut r = fail;
|
2012-06-30 18:19:07 -05:00
|
|
|
for self.each |elt| { r += f(elt); }
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unreachable expression
|
|
|
|
//~^^ ERROR the type of this value must be known
|
2012-04-07 19:11:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fn main() {
|
2012-06-26 15:55:56 -05:00
|
|
|
["hi"].bind({|x| [x] });
|
2012-04-07 19:11:33 -05:00
|
|
|
}
|