How to apply higher order function to an effectful function in Haskell?
问题 I have too functions: higherOrderPure :: (a -> b) -> c effectful :: Monad m => (a -> m b) I'd like to apply the first function to the second: higherOrderPure `someOp` effectful :: Monad m => m c where someOp :: Monad m => ((a -> b) -> c) -> (a -> m b) -> m c Example: curve :: (Double -> Double) -> Dia Any curve f = fromVertices $ map p2 [(x, f x) | x <- [1..100]] func :: Double -> Either String Double func _ = Left "Parse error" -- in other cases this func can be a useful arithmetic