this repo has no description
1opam-version: "2.0"
2synopsis: "4.02.3+curried-constr"
3description: """
4Variant constructors as functions
5==================================
6
7Suppose we have:
8
9```ocaml
10type t = Foo of int * float
11```
12
13Then
14
15```ocaml
16Foo
17```
18
19is equal to `fun (x,y) -> Foo (x,y)`. And,
20
21```ocaml
22(Foo ..) (* This is not valid in the vanilla OCaml *)
23```
24
25and
26```
27!Foo (* If you keep the vanilla syntax *)
28```
29
30are equal to `fun x y -> Foo (x,y)`.
31
32It works for list cons constructor too:
33
34```ocaml
35(::) : ('a * 'a list) -> 'a list
36(:: ..) : 'a -> 'a list -> 'a list
37!(::) : 'a -> 'a list -> 'a list
38```
39
40Polymorphic variants as functions
41---------------------------------------------
42
43```ocaml
44(`Foo ..) (* This is not valid in the vanilla OCaml *)
45!`Foo
46```
47
48are equivalent to
49
50```ocaml
51fun x -> `Foo x
52```
53
54Note that ``(`Foo ..)`` always take only one argument:
55the arity of the polymorphic variant constructors is at most one
56and it is determined purely syntactically.
57
58
59```ocaml
60(`Foo..) (1,2,3) (* `Foo (1,2,3) *)
61(`Foo..) 1 2 3 (* (`Foo 1) 2 3 which ends in a type error *)
62```
63
64Code ``(`Foo)`` has no special meaning. It is just equivalent to `` `Foo``.
65
66Samples
67---------------------------------------------
68
69You can try examples at `testsuite/curried_constr/test.ml`."""
70maintainer: "David Allsopp <david@tarides.com>"
71depends: [
72 "ocaml" {= "4.02.3" & post}
73 "base-unix" {post}
74 "base-bigarray" {post}
75 "base-threads" {post}
76 "base-ocamlbuild" {post}
77]
78conflict-class: "ocaml-core-compiler"
79flags: compiler
80setenv: CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"
81build: [
82 [
83 "sed"
84 "-ib"
85 "-e"
86 "s/opts=\"\"/opts=\"-Wno-implicit-function-declaration\"/"
87 "config/auto-aux/hasgot"
88 ] {os = "macos"}
89 ["./configure" "-prefix" prefix "-with-debug-runtime"]
90 {os != "openbsd" & os != "freebsd" & os != "macos"}
91 [
92 "./configure"
93 "-prefix"
94 prefix
95 "-with-debug-runtime"
96 "-cc"
97 "cc"
98 "-aspp"
99 "cc -c"
100 ] {os = "openbsd" | os = "freebsd" | os = "macos"}
101 [make "world.opt"]
102]
103install: [make "install"]
104url {
105 src:
106 "https://github.com/camlspotter/ocaml/archive/4.02.3+curried-constr.tar.gz"
107 checksum: [
108 "sha256=53f5420416e6f9dbd8abb790dd4d2e1cf62c04e042a320a02086c4cdc5a1cd48"
109 "md5=754cb6ef120d90273610ab5f860b99e7"
110 ]
111}
112patches: ["fix-gcc10.patch" "gpr1330.patch" "alt-signal-stack.patch"]
113available: !(os = "macos" & arch = "arm64")
114license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
115authors: [
116 "Xavier Leroy"
117 "Damien Doligez"
118 "Alain Frisch"
119 "Jacques Garrigue"
120 "Didier Rémy"
121 "Jérôme Vouillon"
122]
123bug-reports: "https://github.com/ocaml/opam-repository/issues"
124homepage: "https://ocaml.org"
125dev-repo: "git+https://github.com/ocaml/ocaml.git#4.02"
126extra-source "alt-signal-stack.patch" {
127 src: "https://github.com/ocaml/ocaml/commit/9de2b77472aee18a94b41cff70caee27fb901225.patch?full_index=1"
128 checksum: "sha256=91841447cc2d11ebe67a078ace677a18f06432ebf15c4c6d5a09e04b67dd041a"
129}
130extra-source "gpr1330.patch" {
131 src: "https://github.com/ocaml/ocaml/commit/bcc7a767279ff70518b3f4219cc0b9bffec7dd43.patch?full_index=1"
132 checksum: "sha256=594d4dd6c192fe77e9fc025674b51e3de74d70326b2e750a249a09eeded68716"
133}
134extra-source "fix-gcc10.patch" {
135 src:
136 "https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/ocaml-base-compiler/fix-gcc10.patch.4.02.3"
137 checksum: [
138 "sha256=7f66fe8a08dbb4f63f927b864576d15ab6062787d19ffe6dfa5c36b733c9e330"
139 "md5=4516183897da9033f49dd291fa198b8c"
140 ]
141}