3 ms·
To make it work in Haskell you would need to wrap the elements in a FoldElement type and the functions in a FoldFunction type, and then allow not total function
by Evbn 14y ago
To make it work in Haskell you would need to wrap the elements in a FoldElement type and the functions in a FoldFunction type, and then allow not total functions or some Either/Maybe style defaulting, and use case analysis to unpack each FoldElement.
It could be useful if you are building a general framework (like a calculator, or a game AI decision engine) for user-defined functions.