finished implementation of lens

This commit is contained in:
Stavros Polymenis 2016-09-17 20:01:22 +01:00
parent 3b35f6ce2f
commit 42df13ce29
3 changed files with 6 additions and 4 deletions

View File

@ -12,4 +12,6 @@ html.cmx: src/html.ml logarion.cmx
logarion.cmx src/html.ml
logarion.cmx: src/logarion.ml
ocamlfind ocamlopt -c -o logarion.cmx -linkpkg -package omd,lens src/logarion.ml
ocamlfind ocamlopt -c -o logarion.cmx -linkpkg \
-package omd,lens,lens.ppx_deriving \
src/logarion.ml

View File

@ -1,5 +1,5 @@
open Lens
type author = {
name: string;
email: string;

View File

@ -28,8 +28,8 @@ let ymd_of_body_pairs pairs =
let open Logarion in
let open Lens.Infix in
let field_of_pair ymd (key, value) = match key with
| "title" -> { ymd with meta = { ymd.meta with title = List.hd value } }
(* | "author" -> ((ymd_t_meta |-- log_meta_t_author |-- author_t_name_t) ^= List.hd value) ymd *)
| "title" -> ((ymd_meta |-- meta_title |-- title ^= List.hd value) ymd
| "author" -> ((ymd_meta |-- meta_author |-- author_name) ^= List.hd value) ymd
| "text" -> { ymd with body = List.hd value }
| _ -> ymd
in