fact: Definition andmbind (p : Parser Toks Tok M A n) (q : A -> Box (Parser Toks Tok M B) n) : Parser Toks Tok M (A * option B) n := MkParser (fun _ mlen ts => bind (runParser p mlen ts) (fun sa => let salen := Nat.le_trans _ _ _ (small sa) mlen in let combine := fun sb => Success.map (fun p => (fst p, Some (snd p))) (Success.and sa sb) in Category.alt (fmap combine (runParser (call (q (value sa)) salen) (Nat.le_refl _) (leftovers sa))) (pure (Success.map (fun a => (a , None)) sa)))).
imports: Coq(PeanoNat) parseque(Category Induction Sized NEList Success EqDec)