4 ms·
I'm not sure you could do that with a monad. They still let you use whatever pure function you want, which can have arbitrary complexity.
by chpatrick 12y ago
I'm not sure you could do that with a monad. They still let you use whatever pure function you want, which can have arbitrary complexity.
- jonpeda 12y agoYou could use the monad to generate an embedded program that runs in constant time on a given class of problems. Then the challenge is smaller-- ensure that the program generator is not exposed to tainted inputs, and run the generated program in your request-handling loop.
- tinco 12y agoYou could wrap your operands in a type with a bind function that takes a function argument that has to be marked constant time. I guess it wouldnt strictly be a monad. You would then have to trust the implementor that he does not mark any non-constant time functions as being that, but I think that is reasonable.