/
opam
49 lines (39 loc) · 1.62 KB
/
opam
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
opam-version: "2.0"
maintainer: "Jonathan Chan <jyc@fastmail.fm>"
authors: "Jonathan Chan <jyc@fastmail.fm>"
homepage: "https://bitbucket.org/jyc/ppx_sexp"
bug-reports:
"https://bitbucket.org/jyc/ppx_sexp/issues"
license: "BSD-2-Clause"
dev-repo: "hg+https://bitbucket.org/jyc/ppx_sexp"
build: ["./build"]
install: ["./install"]
remove: ["./uninstall"]
depends: [
"ocaml" {>= "4.02.0" & < "4.03.0"}
"ocamlfind" {build}
]
synopsis:
"ppx_sexp is a ppx preprocessor for embedding S-expressions in OCaml programs."
description: """
For example, this:
[%sexp (define a "hi there!")]
is translated into:
`List [`Symbol "define"; `Symbol "a"; `String "hi there"]
You can unquote, or insert regular OCaml expressions inside of the S-expression that will be evaluated instead of converted to atoms (e.g. `List`, `Symbol`) using the `[%in ...]` syntax:
let a = [%sexp (title "Hello, world!")] in
[%sexp (html
(head
[%in a])
(body
(p "Hi there!")))]
When inserting values, you must make sure to contain them in the appropriate polymorphic variant (the names correspond directly to OCaml's AST constant types, with the exception of Bool):
[%sexp (print [%in `String "S-expressions: abbreviated sexp"])]
The `%in` syntax is intended to be used for embedding other S-expressions.
If you are embedding atoms, there is a streamlined syntax:
[%sexp (print [%string "S-expressions: sexp"])]
Unquote-splicing is also supported."""
url {
src: "https://github.com/ocaml/opam-source-archives/raw/main/ppx_sexp-0.3.0.tar.gz"
checksum: "md5=afbfb6e6c9eca9032234464703b83588"
}