Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Extracting Value from a Monad

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Extracting Value from a Monad


Chronological Thread 
  • From: t x <txrev319 AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Extracting Value from a Monad
  • Date: Sun, 15 Sep 2013 07:16:43 +0000

Hi,

  Consider the following code in Mtac.

  Definition when_has_value1 (p: option Prop) :=
    match p with
      | None => True
      | Some p' => p'
    end.

  Definition when_has_value2 (p: M Prop) :=
    match p with
      | ret p' => p'
      |  _ => True (* there was an exception *)
    end.

The first function extracts a value from the option Monad -- if there is a prop, we return the prop. Otherwise, we return true.

The second definition attempts (but does not compile) to extract a value from the M monad -- however it doesn't work. I feel like I'm doing something ridiciously stupid and there's a trivial fix -- how do I get the second function to work?

Thanks!


  • [Coq-Club] Extracting Value from a Monad, t x, 09/15/2013

Archive powered by MHonArc 2.6.18.

Top of Page