[Haskell-beginners] warning in making instances of Functor class!
Abhijit Patel
abhisandhyasp.ap at gmail.com
Fri Dec 25 18:32:19 UTC 2015
why am i getting warning in the following code?? though it works
perfectly!!!
Prelude> newtype Pair1 c b a=Pair1 {getPair1 :: (a,b,c)}
Prelude> :{
Prelude| instance Functor (Pair1 m n) where
Prelude| fmap f (Pair1 (x,y,z))=Pair1 (f x,y,z)
Prelude| :}
<interactive>:55:10: Warning:
No explicit implementation for
‘Prelude.fmap’
In the instance declaration for ‘Functor (Pair1 m n)’
-- The below shows it is working fine!
Prelude> getPair1 $ fmap (*100) (Pair1 (2,3,1))
(200,3,1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151226/f0d13459/attachment.html>
More information about the Beginners
mailing list