If you are not too tuned that everything is completely automatic, you can use utility functions in the newtype package , for example. something like over Ideal $ take 5 .
Edit: Also, aside, it is not too difficult to extend the functions from the newtype package to handle other cases. For example, I had the following definitions:
infixl 3 ./ (./) :: (Newtype no) => (o -> t) -> (n -> t) (./) fx = fx . unpack liftN fx = pack $ f ./ x liftN2 fxy = pack $ f ./ x ./ y liftN3 fxyz = pack $ f ./ x ./ y ./ z
Actually not the best design for such combinators, I suspect, but you get the point.
CA McCann
source share