[Haskell-cafe] Problem with type in a function
MigMit
miguelimo38 at yandex.ru
Wed Jul 2 20:07:19 UTC 2014
Exactly what it is telling you you're missing. You said "plotf applies to any type 'a' if it's of class Ploteable". Then you try to use it with a=Double. So, it doesn't see how Double is of class Ploteable.
On 02 Jul 2014, at 23:52, Leza Morais Lutonda <leza.ml at fecrd.cujae.edu.cu> wrote:
>
> 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
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list