End NewMonad.
Definition T: MonadTrans := Build_MonadTrans M lift.
End MonoidMonadTrans.
End MonoidMonadTrans.
Definition NatAddMonoid: Monoid.
Proof with auto with arith.
apply (Build_Monoid 0 plus)...
Defined.
Definition SimplyProfiled: Monad := MonoidMonadTrans.M NatAddMonoid IdMonad.ext.
Definition cost {X: Set}: prod nat X -> nat := @fst _ _.
Definition result X: SimplyProfiled X -> X := @snd _ _.

Lemma bind_cost (T U: Set) (a: SimplyProfiled T) (b: T -> SimplyProfiled U):
cost (bind a b) = cost a + cost (b (result a)).