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;
|
|
|
|
for self.each {|elt| r += f(elt); }
|
|
|
|
//!^ WARNING unreachable expression
|
|
|
|
//!^^ ERROR the type of this value must be known
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fn main() {
|
2012-06-26 15:55:56 -05:00
|
|
|
["hi"].bind({|x| [x] });
|
2012-04-07 19:11:33 -05:00
|
|
|
}
|