Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #560 from rustbot/triagebot-ice-79636
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid authored Dec 9, 2020
2 parents bbc66f7 + 689b658 commit f979bf4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ices/79636.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![feature(generic_associated_types)]

trait Monad {
type Unwrapped;
type Wrapped<B>;

fn bind<B, F>(self, f: F) -> Self::Wrapped<B> {
todo!()
}
}

fn join<MOuter, MInner, A>(outer: MOuter) -> MOuter::Wrapped<A>
where
MOuter: Monad<Unwrapped = MInner>,
MInner: Monad<Unwrapped = A, Wrapped = MOuter::Wrapped<A>>,
{
outer.bind(|inner| inner)
}

fn main() {
assert_eq!(join(Some(Some(true))), Some(true));
}

0 comments on commit f979bf4

Please sign in to comment.