Skip to content

Commit

Permalink
Add lazy support (closes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Aug 25, 2024
1 parent c916f11 commit 9d30a6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Unreleased
* Add `lazy` support (#5).

## 0.1.2
* Add inline record support (#1).
* Add `float` support (#2).
Expand Down
3 changes: 3 additions & 0 deletions src/ppx_deriving_hash.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ let rec expr ~loc ~quoter ct =
[%expr List.fold_left (fun a b -> [%e hash_reduce2 ~loc [%expr a] [%expr [%e expr ~loc a] b]]) [%e hash_empty ~loc]]
| [%type: [%t? a] array] ->
[%expr Array.fold_left (fun a b -> [%e hash_reduce2 ~loc [%expr a] [%expr [%e expr ~loc a] b]]) [%e hash_empty ~loc]]
| [%type: [%t? a] lazy_t]
| [%type: [%t? a] Lazy.t] ->
[%expr fun (lazy x) -> [%e expr ~loc a] x]
| {ptyp_desc = Ptyp_constr ({txt = lid; loc}, args); _} ->
let ident = pexp_ident ~loc {loc; txt = Ppx_deriving.mangle_lid mangle_affix lid} in
let ident = Ppx_deriving.quote ~quoter ident in
Expand Down

0 comments on commit 9d30a6f

Please sign in to comment.