:: a -> (a -> b) -> b -package:conferer package:ghc-prim

The oneShot function can be used to give a hint to the compiler that its argument will be called at most once, which may (or may not) enable certain optimizations. It can be useful to improve the performance of code in continuation passing style. If oneShot is used wrongly, then it may be that computations whose result that would otherwise be shared are re-evaluated every time they are used. Otherwise, the use of oneShot is safe. oneShot is representation-polymorphic: the type variables may refer to lifted or unlifted types.