File: Notations.v

package info (click to toggle)
coq-ext-lib 0.13.0-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 808 kB
  • sloc: makefile: 44; python: 31; sh: 4; lisp: 3
file content (30 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Require Import ExtLib.Structures.Monad.
Generalizable All Variables.

Module NotationExample.

  Import MonadNotation.
  Open Scope monad_scope.

  Fixpoint repeatM `{Monad M} (n : nat) `(x : A) (p : A -> M A) : M unit :=
    match n with
    | O => ret tt
    | S n => y <- p x;;
             repeatM n y p
    end.

End NotationExample.

Module LetNotationExample.

  Import MonadLetNotation.
  Open Scope monad_scope.

  Fixpoint repeatM `{Monad M} (n : nat) `(x : A) (p : A -> M A) : M unit :=
    match n with
    | O => ret tt
    | S n => let* y := p x in
             repeatM n y p
    end.

End LetNotationExample.