proposition: Lemma bind_endo_nothing {c} (f : c -> Maybe c) (m : Maybe c) : m >>= f = Nothing <-> m = Nothing \/ exists y, f y = Nothing /\ m = Just y.
proof: Proof. induction m; simpl; split; intros. - destruct (f a) eqn:?. now inversion H; subst. right. now eexists; eauto. - destruct H. discriminate. firstorder eauto. inversion_clear H0. now rewrite H. - now left. - reflexivity. Qed.
imports: Hask.Control.Monad