Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
51 views

I have the following attribute attached to nodes [@profiling.mark [ "label1"; "label2"; "label3" ]] which gives me this AST: [{attr_name = {txt = "profiling.mark&...
Lhooq's user avatar
  • 4,461
0 votes
1 answer
80 views

I'm trying to write simple rewriters with ppxlib to get an idea of how to do more complex things. I'm currently struggling with metaquot. The documenation I found is this one but it just touches the ...
Lhooq's user avatar
  • 4,461
0 votes
2 answers
236 views

I am now writing a project in OCaml v4.06, and I have installed ppx_jane v0.11.0. Actually the environment is based on a docker image. Now here is the dune file (menhir (modules parser)) (ocamllex ...
stormckey's user avatar
5 votes
2 answers
177 views

When you define an operator such as let (++) a b = a :: b When you do let v = foo a ++ bar b bar is evaluated before foo. A workaround is to use let expression, i.e. let e1 = foo a in let e2 = bar ...
5 votes
1 answer
120 views

I am making a ppx extension rewriter as part of a code library Ideally the library will be usable with some range of OCaml versions I have noticed that when building AST nodes to output from my ...
Anentropic's user avatar
  • 34.2k
1 vote
1 answer
106 views

I am trying to make a PPX extension rewriter that dynamically builds (among other things) a variant type, based on some config in a JSON file... I have got reasonably far but I am confused whether it ...
Anentropic's user avatar
  • 34.2k
1 vote
0 answers
85 views

Is there a way to efficiently "augment" or attach some more information without much boilerplate? That is, given types type orig = | A | B of orig | C of orig * orig and type dat = int ...
0 votes
2 answers
184 views

For context (skip to question if you like): I am learning ocaml and started reading the Real World Ocaml. So far, really (really!) liking the language and the book. One thing I'm starting to not like ...
Kris's user avatar
  • 4,007
4 votes
0 answers
96 views

I want to try to write my own ppx to allow named arguments in formatting strings: From Format.printf [%fmt "!(abc) !(qsd)"] to Format.printf "%s %s" abc qsd When dumping with ...
Lhooq's user avatar
  • 4,461
1 vote
1 answer
231 views

I have the below OCaml file which compiles correctly without ppx and fails with this dune file (library (name so_proj) (preprocess (pps ppx_inline_test ppx_deriving.show ppx_deriving.ord ...
nicolas's user avatar
  • 9,855
0 votes
2 answers
1k views

I have a functor that takes a Set type like: module type MySet = functor (S : Set.S) -> sig val my_method : S.t -> S.elt -> S.elt list option end module MySet_Make : MySet = functor (S : ...
Anentropic's user avatar
  • 34.2k
2 votes
1 answer
722 views

How can I use ppx derive (https://github.com/ocaml-ppx/ppx_deriving) in my utop? For example, I have to following code: module A = struct module T = struct type t = int [@@deriving hash, sexp, ...
0 votes
2 answers
621 views

Say I am building a record type: type thing { fruit: string; } But I want the possible values of fruit to be constrained to a fixed set of strings. It seems natural to model this in OCaml as a ...
Anentropic's user avatar
  • 34.2k
1 vote
1 answer
76 views

If a record is defined in a module in lib and it contains a deriving annotation that generates functions, how can those functions be used in another module? For example, the yaml/ppx_deriving_yaml ...
Greg's user avatar
  • 3,169
3 votes
1 answer
851 views

I need to generate a value with a different type from my passed type. This is the first time I write on ocaml-like, and for example, in a familiar me haskell I would use Data.Generics. How I have ...

15 30 50 per page
1
2 3

AltStyle によって変換されたページ (->オリジナル) /