Problem using ap -- No instance for (Monad ((->) [[a]]))

If I try a function to make a point-free version of the function in this fold -- foldr (\x ys -> ys ++ map (x:) ys) [[]] :pl gives me GOA Control.Monad> :pl (\x ys -> ys ++ map (x:) ys) ap (++) . map . (:) GOA Control.Monad> :t ap (++) . map . (:) ap (++) . map . (:) :: (Monad ((->) [[a]])) => a -> [[a]] -> [[a]] but this is what happens if I try to use it: GOA Control.Monad> let ps = foldr (ap (++) . map . (:)) [[]] <interactive>:1:16: No instance for (Monad ((->) [[a]])) arising from use of `ap' at <interactive>:1:16-22 Possible fix: add an instance declaration for (Monad ((->) [[a]])) In the first argument of `(.)', namely `ap (++)' In the first argument of `foldr', namely `((ap (++)) . (map . (:)))' In the expression: foldr ((ap (++)) . (map . (:))) [[]] (0.00 secs, 0 bytes) What gives? -- View this message in context: http://www.nabble.com/Problem-using-ap----No-instance-for-%28Monad-%28%28-%3... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
participants (2)
-
Bulat Ziganshin
-
Jim Burton