-
-
Save Kimundi/8356354 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
trait Category<S, T> { | |
fn id<A, AA: Category<A, A>>() -> AA; | |
fn compose<A, B, C, AB: Category<A, B>, BC: Category<B, C>, AC: Category<A, C>>(BC, AB) -> AC; | |
} | |
impl<'a, S, T> Category<S, T> for ('a |S| -> T) { | |
fn id<A, |A| -> A>() -> ('a |A| -> A) { | |
|a: A| -> A { a } | |
} | |
fn compose<A, B, C, |A| -> B, |B| -> C, |A| -> C>(f: |B| -> C, g: |A| -> B) -> ('a |A| -> C) { | |
|a: A| -> A { f(g(a))} | |
} | |
} |
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
% rustc peg.rs !3563 | |
peg.rs:7:14: 7:15 error: expected ident, found `|` | |
peg.rs:7 fn id<A, |A| -> A>() -> ('a |A| -> A) { | |
^ | |
task 'rustc' failed at 'explicit failure', /private/tmp/rust-R5p2/rust-0.9/src/libsyntax/diagnostic.rs:41 | |
task '<main>' failed at 'explicit failure', /private/tmp/rust-R5p2/rust-0.9/src/librustc/lib.rs:453 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment