Error in executing the example in ocaml 4.06
indykish opened this issue · comments
Tried this in a file using jbuilder.
open Depyt
type t = Foo | Bar of string option;;
let t =
variant "v" (fun foo bar -> function Foo -> foo | Bar x -> bar)
|~ case0 "Foo" Foo
|~ case1 "Bar" (option string) (fun x -> Bar x)
|> sealv
Fmt.pr "t = %a\n" (pp t) Foo;;
compare t Foo (Bar (Some "a"));;
The compile says the following errror.
jbuilder build bin/revolt.exe
ocamlc bin/.revolt.eobjs/revolt.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /usr/bin/ocamlc.opt -w -40 -w +A-40-42 -g -bin-annot -I bin/.revolt.eobjs -I /home/ram/.opam/default/lib/bytes -I /home/ram/.opam/default/lib/cmdliner -I /home/ram/.opam/default/lib/cstruct -I /home/ram/.opam/default/lib/depyt -I /home/ram/.opam/default/lib/fmt -I /home/ram/.opam/default/lib/jsonm -I /home/ram/.opam/default/lib/ocplib-endian -I /home/ram/.opam/default/lib/result -I /home/ram/.opam/default/lib/sexplib -I /home/ram/.opam/default/lib/sexplib/0 -I /home/ram/.opam/default/lib/uchar -I /home/ram/.opam/default/lib/uutf -no-alias-deps -o bin/.revolt.eobjs/revolt.cmo -c -impl bin/revolt.ml)
File "bin/revolt.ml", line 9, characters 7-51:
Error: This expression has type
(t, string option -> t Depyt.case_p) Depyt.case
but an expression was expected of type (t, t Depyt.case_p) Depyt.case
Type string option -> t Depyt.case_p is not compatible with type
t Depyt.case_p
make: *** [Makefile:11: build] Error 1
The reason i tried this was, i building a project using irimin constructs.
I see the module Type doing the same job like Depyt
.
- Why was this library -
Depyt
not used and reinvented again in irmin ? - How do i fix this error, or should i go with module Type.
Hey there.
Why was this library - Depyt not used and reinvented again in irmin ?
Both libraries are very close at the moment indeed, but my plan is to expose merge strategies in Irmin.Type
(which has nothing to do with a more general dynamic type library like depyt) - so you could define a custom datatype where a field has a "last write win" strategy while an other field has to use a 3-way merge one.
A possible solution would be to define an extension mechanism to depyt, but to be honnest, Depyt was more of a playground for me to design the right dynamic type library for Irmin and I am not sure this library has any user at all, so this could be more of a maintenance cost than a real gain at the moment.
How do i fix this error?
See #18
Hey Thanks @samoht ..
Yes i wanted to play it up to see how the The Irmin.Type worked by using this :)
Thanks for the README.md update.