Hi, I need to pack GADT constructors into some data structure that will allow me to search for specific item and iterate over all items.
Here’s the naive implementation which results in compile time error:
type _ t = | S: string t | I: int t let items: type a. (a t * (a -> bool)) list = [ (S, fun x -> x = ""); (I, fun x -> x = 0); ]
This has type: string t But somewhere wanted: a t The incompatible parts: string vs a
I’m not tied to
list, any iterable/searchable data structure will work.
Is this achievable with GADT?