@solnic I think I only saw a port of the monads lib, and I argued that crystal almost obviates the need for both Maybe and Either monads by having type unions in it's type system already. But then again, I've never actually used the monads so I might be missing something.
I'm mainly interested in ROM itself and dry-validation, which look like excellent tools for building webapps.
@solnic Crystal's meta-programming is really quite advanced, however the rules of macros go as follows:
1) Don't use macros
2) Don't use macros
3) Do it without macros
4) Check duplicated code in your non-macros solution
5) Eliminate your duplicated code with macros.
So I try to keep the smallest macro surface possible.
That being said, even Crystal without macros is super duper powerful. I'd love to help you out regarding Crystal if you even find the time!
@RX14 haha yeah I totally agree in principle, although I have to say *libraries* are really special type of code, and leveraging more powerful features of a language is typically desirable to achieve better APIs.
Thanks for offering help. So many great langs, so little time…:)
Anyhow, in rom we have a feature where relations are auto-curried, which means that you can refer to them without providing arguments. This is used to compose relations into graphs. No idea if it’s possible in Crystal.
@solnic Libraries are themselves code, and this macro advice is mainly to keep the library devs sane rather than the users! Macros can get really ugly really fast, so keeping their scope and surface area small really helps to get readable library code.
Looking at the example, I think auto-currying could be achieved! Not entirely sure though of course.
@solnic no. It's much like inheriting Hash or Array in Ruby, things could go wrong at any moment.
We much prefer composition to inheritance. Composing proc or copying that exact implementation would be trivial though.