mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fixed test_bij
This commit is contained in:
parent
3aae03b3dd
commit
9003d26a60
1 changed files with 9 additions and 9 deletions
|
|
@ -20,18 +20,18 @@ type term =
|
|||
| App of term list
|
||||
|
||||
let bij_term =
|
||||
let bij = Bij.(fix
|
||||
let bij = Bij.fix
|
||||
(fun bij ->
|
||||
switch
|
||||
Bij.switch
|
||||
~inject:(function
|
||||
| Const s -> "const", BranchTo (string_, s)
|
||||
| Int i -> "int", BranchTo (int_, i)
|
||||
| App l -> "app", BranchTo (list_ (Lazy.force bij), l))
|
||||
| Const s -> "const", Bij.(BranchTo (string_, s))
|
||||
| Int i -> "int", Bij.(BranchTo (int_, i))
|
||||
| App l -> "app", Bij.(BranchTo (list_ (Lazy.force bij), l)))
|
||||
~extract:(function
|
||||
| "const" -> BranchFrom (string_, fun x -> Const x)
|
||||
| "int" -> BranchFrom (int_, fun x -> Int x)
|
||||
| "app" -> BranchFrom (list_ (Lazy.force bij), fun l -> App l)
|
||||
| _ -> raise (DecodingError "unexpected case switch")))
|
||||
| "const" -> Bij.(BranchFrom (string_, fun x -> Const x))
|
||||
| "int" -> Bij.(BranchFrom (int_, fun x -> Int x))
|
||||
| "app" -> Bij.(BranchFrom (list_ (Lazy.force bij), fun l -> App l))
|
||||
| _ -> raise Bij.(DecodingError "unexpected case switch"))
|
||||
)
|
||||
in
|
||||
bij
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue