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

2007-07-06 Thread Jim Burton

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-apNo-instance-for-%28Monad-%28%28-%3E%29---a--%29%29-tf4036243.html#a11466625
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem using ap -- No instance for (Monad ((-) [[a]]))

2007-07-06 Thread Bulat Ziganshin
Hello Jim,

Friday, July 6, 2007, 7:12:27 PM, you wrote:

 No instance for (Monad ((-) [[a]]))

:l Control.Monad.Instances

-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe