一番よいのは CamlP4 が何を出力しているか見ることです。 例として OCamltter の Twitter API の JSON 表現と OCaml の型との間を取り持つ api11.ml がどうなっているか見てみましょう。 type 'a t = { previous_cursor : Json.t; next_cursor : Json.t; next_cursor_str : string; previous_cursor_str : string; contents : 'a mc_embeded; } with conv(json, ocaml) この型宣言の with conv(json, ocaml) の部分は CamlP4 の拡張の部分で、型定義からなにかしらコードを生成しています。 $ rm lib/twitter/api11.cmo $ omake --verbo
This news was initially published as forge.ocamlcore.org/forum/forum.php?forum_id=958 on 2016-12-30, it has been migrated to this static website later. The OCaml Forge was launched 9 years ago. Today, the OCaml community will probably benefit to switch to a more popular hosting option, like Github. Over the course of 2017, the content of the current forge will be transferred to a static website or
There is a new draft on my web page! It is called Tagless and Typeful Normalization by Evaluation using Generalized Algebraic Data Types, which is a mouthful, but only describes accurately the cool new OCaml development we elaborated together with Olivier and Chantal. The world of Normalization by Evaluation (NbE) is still relatively new to me, but its wonders keep amazing me. It’s a program speci
GADTs allow one to statically enforce stronger program invariants than are otherwise possible in a Hindley-Milner style type system. This post retells the story of how to “roll your own” GADTs using an explicit type of equality constraints. More interestingly, we discuss a particularly versatile definition of type equality in Haskell that can now be transcribed into OCaml due to the recent additio
OO の方面から、「静的型とか別に役に立つとは思えない、静的型の人は頭おかしい」 とか関数型の方面から、「静的型が役に立たないなんてはずない OO の人は頭おかしい」 とか良く聞こえてくるんですが、ダックタイピング心理学 とかいう真に頭おかしい意見を無視できるとすると(無視できない量あるんですが)、まあ私にはどっちもわからんでもない、という話です。 型をゴミ箱に捨てておいてから、後でゴミ箱を漁るなら、型なんかいらない オブジェクトの静的型システムを大雑把にいうとまず upcast と downcast があります。 upcast はオブジェクトの静的型をそれが属するクラスからそのスーパークラスにを変えちまうこと、downcast はその逆、オブジェクトの静的型をそれが属するクラスから子クラスに変えちまうことです。サブクラスの物はスーパークラスとしても通用するはずですから upcast は失
Let's say I have a list of options: let opts = [Some 1; None; Some 4] I'd like to convert these into an option of list, such that: If the list contains None, the result is None Otherwise, the various ints are collected. It's relatively straightforward to write this for this specific case (using Core and the Monad module): let sequence foo = let open Option in let open Monad_infix in List.fold ~ini
(Update (2014-05-28): Added notes on delimcc and Catch me if you can to the Discoveries section.) (Update (2014-05-05): The match/exception variant of this proposal has been merged into OCaml trunk, ready for release in 4.02.) (Update: there's a Mantis issue open to discuss this proposal.) OCaml's try construct is good at dealing with exceptions, but not so good at handling the case where no excep
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く