Skip to content

Commit 138c915

Browse files
author
Gregory Malecha
committed
fixing some of the examples.
1 parent 8b7bbc7 commit 138c915

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

examples/ConsiderDemo.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Require NPeano.
2+
Import NPeano.Nat.
13
Require Import ExtLib.Tactics.Consider.
24

35
Set Implicit Arguments.

examples/EvalWithExc.v

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
Require Import Coq.Strings.String.
12
(** Require the monad definitions **)
23
Require Import ExtLib.Structures.Monads.
34
(** Use the instances for exceptions **)
45
Require Import ExtLib.Data.Monads.EitherMonad.
56
(** Strings will be used for error messages **)
6-
Require Import String.
7+
Require Import ExtLib.Data.String.
78

89
Set Implicit Arguments.
910
Set Strict Implicit.
@@ -27,16 +28,16 @@ Section monadic.
2728
Variable m : Type -> Type.
2829
Context {Monad_m : Monad m}.
2930
Context {MonadExc_m : MonadExc string m}.
30-
31+
3132
(** Use the notation for monads **)
3233
Import MonadNotation.
3334
Local Open Scope monad_scope.
34-
35+
3536
(** Functions that get [nat] or [bool] values from a [value] **)
3637
Definition asInt (v : value) : m nat :=
3738
match v with
38-
| Int n => ret n
39-
| _ =>
39+
| Int n => ret n
40+
| _ =>
4041
(** if we don't have an integer, signal an error using
4142
** [raise] from the MoandExc instance
4243
**)
@@ -54,7 +55,7 @@ Section monadic.
5455
**)
5556
Fixpoint eval' (e : exp) : m value :=
5657
match e with
57-
(** when there is no error, we can just return (i.e. [ret])
58+
(** when there is no error, we can just return (i.e. [ret])
5859
** the answer
5960
**)
6061
| ConstI i => ret (Int i)
@@ -72,7 +73,7 @@ Section monadic.
7273
t <- eval' t ;;
7374
t <- asBool t ;;
7475
(** case split and perform the appropriate recursion **)
75-
if t then
76+
if (t : bool) then
7677
eval' tr
7778
else
7879
eval' fa
@@ -83,7 +84,7 @@ End monadic.
8384
(** Wrap the [eval] function up with the monad instance that we
8485
** want to use
8586
**)
86-
Definition eval : exp -> string + value :=
87+
Definition eval : exp -> string + value :=
8788
eval' (m := sum string).
8889

8990
(** Some tests **)

examples/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ ARGS :=-R ../theories ExtLib
1010
coq: Makefile.coq
1111
$(MAKE) -f Makefile.coq
1212

13-
Makefile.coq: Makefile $(VS)
14-
coq_makefile $(ARGS) $(VS) \
15-
| sed -re 's/-R ([^ ]+) ExtLib/-I \1 -as ExtLib/g' \
16-
> Makefile.coq
13+
Makefile.coq: Makefile _CoqProject $(VS)
14+
coq_makefile -f _CoqProject $(VS) -o Makefile.coq
1715

1816
Makefile.test.coq: Makefile $(TVS)
1917
coq_makefile $(ARGS) $(TVS) \

examples/_CoqProject

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-Q ../theories ExtLib
2+
-Q . ExtLibExamples

0 commit comments

Comments
 (0)