aboutsummaryrefslogtreecommitdiff
path: root/plugins/extraction/ExtrHaskellNatInt.v
diff options
context:
space:
mode:
authorPierre Letouzey2015-06-22 14:53:31 +0200
committerPierre Letouzey2015-06-22 14:53:31 +0200
commit29fcfc4f8bc1bfbdfbae0c07850aed65f6c3eb04 (patch)
tree1e2edfae22c9f90ae4eceb8cf081df88a98b981e /plugins/extraction/ExtrHaskellNatInt.v
parent6bec099f8487b9d3ec5c44079cf69d3474c73b91 (diff)
parent4b6b4d8cdd12902d166504ec3d96ca94705d81f6 (diff)
Merge branch 'v8.5' into trunk
Diffstat (limited to 'plugins/extraction/ExtrHaskellNatInt.v')
-rw-r--r--plugins/extraction/ExtrHaskellNatInt.v13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/extraction/ExtrHaskellNatInt.v b/plugins/extraction/ExtrHaskellNatInt.v
new file mode 100644
index 0000000000..e94e7d42bd
--- /dev/null
+++ b/plugins/extraction/ExtrHaskellNatInt.v
@@ -0,0 +1,13 @@
+(** Extraction of [nat] into Haskell's [Int] *)
+
+Require Import Arith.
+Require Import ExtrHaskellNatNum.
+
+(**
+ * Disclaimer: trying to obtain efficient certified programs
+ * by extracting [nat] into [Int] is definitively *not* a good idea.
+ * See comments in [ExtrOcamlNatInt.v].
+ *)
+
+Extract Inductive nat => "Prelude.Int" [ "0" "Prelude.succ" ]
+ "(\fO fS n -> if n Prelude.== 0 then fO () else fS (n Prelude.- 1))".