In McBride and Paterson's 'Applicative programming with effects' they introduce some lovely syntactic sugar for lifting a pure function:
[| f x y z |]
for
f <$> x <*> y <*> z
and I recall someone somewhere else using li f w x y z il
or il f v w x y z li
, and I thought/hoped that might be because it could be defined using some existing language feature and cunning definition of li
and il
.
I can't find any reference to this beyond the paper, and assuming that [|
and |]
aren't likely to turn up in ghc any time soon, is it possible to implement li
and il
somehow? I can't think of a sensible type for them, so I assume I'd need Template Haskell or similar, but don't know nearly enough to accomplish this. [af| f x y ]
would be fine, but I don't know whether it's possible before I start attempting it, and certainly need help if it is.