[Haskell-cafe] Problem with type in a function

Leza Morais Lutonda leza.ml at fecrd.cujae.edu.cu
Wed Jul 2 19:52:52 UTC 2014


Hi,

I have the following function

plotf :: Ploteable a => ([a] -> IO ()) -> (a -> a) -> [a] -> IO ()
plotf plot fn xs = plot $ map fn xs

that compiles correctly, but when I use it with:

plotf win sin [1..100::Double] -- where win :: [Double] -> IO ()

I'm geting the error:
No instance for (Ploteable Double) arising from a use of ‘plotf’
In the expression: plotf win sin [1 .. 100 :: Double]
In an equation for ‘it’: it = plotf win sin [1 .. 100 :: Double]

What am I missing?

Thanks!



50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964  http://cujae.edu.cu




More information about the Haskell-Cafe mailing list