[Haskell-cafe] Problem with type in a function

Leza Morais Lutonda leza.ml at fecrd.cujae.edu.cu
Wed Jul 2 20:13:51 UTC 2014


OK. I got it.
I was just confused about Double being instance of Ploteable when I have 
[Double] as an instance.

I'm sorry.

On 02/07/14 16:07, MigMit wrote:
> 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
>


-- 
*Leza Morais Lutonda, Lemol-C*
/Electronic and Telecomunicaction Eng./
/Software Development and Architecture Entusiast/
http://lemol.github.io
@lemolsoft <http://twitter.com/lemolsoft> in twitter


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140702/4a388311/attachment.html>


More information about the Haskell-Cafe mailing list