documentation
ochsec opened this issue · 4 comments
I was trying out the library and it seems that when you do a merge on a type you end up with a dynamic ExpandoObject which then wouldn't pipe to another method/function. Do I have to remap the dynamic objects back to a type any time I do a merge?
More generally, does this library preserve typing and facilitate mapping one type to another? Obviously this wouldn't be an issue for Ramda.js, but a big deal for C#.
Please provide an example
The library tries to preserve typing as much as possible, for example the type of the result of a Filter
function should give you an IEnumerable<int>
Func<int, bool> odd = i => i % 2 == 0;
var array = R.Filter(odd, new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
However when you add/remove a property from a well known type, then the type of the result would be an expando object.
var res= R.Dissoc("C", new Test { A = 1, B = 2, C = 10 });
You can safely pipe using an expando object
var dec = new Func<int, int>(x => x - 1);
var merged = R.Map(dec, R.Merge(new { W = 1, X = 2 }, new { Y = 3, Z = 4 }));
If you have a specific issue please provide me an example so I could check it myself.
Thanks, that's exactly what I was asking about. It's not really an "issue" per say but it seems like you have to map the object back to a type when you alter the object.
If you want to create some documentation I'd be happy to help out.
Let's talk about it by email.