Reputation: 30605
Apologies, as this may seem a very weird question. All of my experience in haskell has been writing functions which usually recursively progress (and some data element decreases with each iteration). However, I have a set of functions which each do some processing on a piece of data and I wanted my calling method to contain each stage, for example
(Pseudo code)
myFunc1 :: Something1 -> Something2
execute myFunc1 Something1
.
execute myFunc2
.
execute myFunc3
.
execute myFunc4
.
return Something2
But I am unsure if this is even possible? Do I simply have to have something silly like:
myFunc4(myFunc3(myFunc2(MyFunc1(Something1))))
?
EDIT: The above line cannot be right, surely!
Upvotes: 4
Views: 1684
Reputation: 170713
If you want to keep left-to-right reading order, you can define
(.>) = flip (.) -- are those in standard library somewhere?
($>) = flip ($)
myComplex = Something1 $> myFunc1 .> myFunc2 .> myFunc3 .> myFunc4
Upvotes: 3