
Ryan Ingram wrote:
No, that doesn't work; it's close, but not quite. liftM doesn't have the right type signature.
liftM :: Monad m => (a -> r) -> (m a1 -> m r)
What would work is if you could define a function liftLast :: Monad m => (a0 -> a1 -> ... -> aN -> r) -> (a0 -> a1 -> ... -> aN -> m r)
then
nary' f = runIdentity . nary (liftLast f)
-- ryan
I don't see a way to implement liftLast or nary for functions like (a -> b -> ... -> r) where r is not of the form (m s). Of course one can use the Identity Monad for m, but in either case you have to modify functions like (Int -> Int) to something like (Int -> m Int) for a fixed type m (e.g. Identity). -- philipp n. -- View this message in context: http://www.nabble.com/distinguish-functions-from-non-functions-in-a-class-in... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.