BREAKING: New LanguageExt.Transformers package #1044
Replies: 4 comments 1 reply
-
This function is now also gone from the core package:
It used to be part of HKT.Extensions.cs. I replaced it with: I noticed there's extensions for
but the |
Beta Was this translation helpful? Give feedback.
-
@BrunoJuchli Thanks for the heads up, I'll take a look this evening. |
Beta Was this translation helpful? Give feedback.
-
It does appear to be generated in the Make sure you're doing
It's just |
Beta Was this translation helpful? Give feedback.
-
But yeah, you can absolutely just roll your own extensions for the types you need: IEnumerable<Either<L, B>> MapT<L, A, B>(this IEnumerable<Either<L, A>> mma, Func<A, B> f) =>
mma.Map(ma => ma.Map(f)); I am going to look at writing a Source Generator for pairs of monadic types, so you can declare which pairs of types you want transformers for, and it generates the code (instead of the 20,000 extension methods created by the T4 templates in the Transformers project). This will work for types you create too (as long as they fit the patterns). |
Beta Was this translation helpful? Give feedback.
-
The transformers extensions, which are a big set of T4 templates for generating extension methods for nested monadic types have now been broken out into their own package:
LanguageExt.Transformers
If you use the following functions:
BindT
,MapT
,FoldT
,FoldBackT
,ExistsT
,ForAllT
,IterT
,FilterT
,PlusT
,SubtractT
,ProductT
,DivideT
,SumT
,CountT
,AppendT
,CompareT
,EqualsT
, orApplyT
- then you will get compile errors, and will need to add a reference to theLanguageExt.Transformers
package.I've done this for a couple of reasons:
LanguageExt.Core
library. This change takes theCore
package from3,276 kb
to2,051 kb
.Core
library will always be quite chunky because of the sheer amount of features, but the transformer extension methods definitely aren't always needed, so breaking them out made senseThe main transformer extensions that remain in the
Core
library are:Traverse
Sequence
These are so heavily used that I believe moving them out into the
Transformers
library would mean everyone would be obliged to use it, and therefore it wouldn't achieve anything. There may be an argument for bringingBindT
andMapT
back into the core at some point. I will see how this plays out (it wouldn't be a future breaking change if that were the case).Any problems, please report via the Issues in the usual way.
This discussion was created from the release BREAKING: New LanguageExt.Transformers package.
Beta Was this translation helpful? Give feedback.
All reactions