Skip to content

Breaking change: Flipped Compose and BackCompose

Compare
Choose a tag to compare
@louthy louthy released this 17 May 12:29

The Func extension methods Compose and BackCompose have been flipped. I felt they were the wrong way around, and that in this situation where the Prelude function compose works one way:

    static Func<int, float>  f = x => x * 3.0f;
    static Func<float, bool> g = x => x > 4.0f;

    var h = compose(f, g);

That the extension method should also go the same way:

   var h = f.Compose(g);

It would also feel more natural when composing multiple functions:

   var x = a.Compose(b).Compose(c).Compose(d);

So if you use the Compose and BackCompose extensions, then you need to flip them in your code.