Closed gcanti closed 9 years ago
Hello
Thanks for sharing.
Maybe I'm missing it, but how would I do something like this with your library:
var Shape = Type({Circle: [Number, Point], Rectangle: [Point, Point]});
var area = (shape) =>
Shape.case({
Circle: (radius, _) => Math.PI * radius * radius,
Rectangle: (p1, p2) => (p2[0] - p1[0]) * (p2[1] - p1[0])
}, circle);
There's nothing like that, I mean nothing implemented in the base library. It's defenitely a nice feature. I'll try to implement something similar to your pattern matching with tcomb. Good job @paldepind
Actually that feature is the single thing I want from this library ;)
Your library looks cool (especially paired with your forms library) and broader in scope than this one. I'm happy if you can find useful inspiration.
The pattern matching is not really pattern matching. But it is useful in a lot of cases!
Hi!
I wrote a similar library:
https://github.com/gcanti/tcomb
I opened this issue just in case it might be helpful / interesting to you (sharing ideas, critiques, etc...) Feel free to close it.
Cheers, Giulio