Open asmodehn opened 1 year ago
I think it should be
TypeClass.Property.Generator.generate(42) |> IO.inspect()
Try it and see if it works. It doesn't know that you're defining some instance for an Integer, but if you give it a sample of the datatype you're working with, it should dispatch correctly.
In general, that's how a lot of things are treated in Witchcraft library family: by sampling!
This is an error similar to what I encountered while trying to implement a linearspace typeclass on top of
Witchcraft.Monoid
.Here is a minimal example to reproduce the issue:
This should compile without problem, as expected.
However uncommenting the custom generator will reveal all the different sort of data that is passed to it. It doesn't match the current implementation (Integer) as I would have expected...
I was actually trying this as a simple workaround for #19 ...
Now I am guessing the error is related to this package and the design of custom_generator, but I am not used to
type_class
, so feel free to let me know if I am just holding this wrong, or if I should post this somewhere else (witchcraft itself ?).Cheers !