[Haskell-cafe] what did I do wrong

Mathijs Kwik mathijs at bluescreen303.nl
Sat May 10 11:55:29 UTC 2014


Roelof Wobben <r.wobben at home.nl> writes:

> Hello,
>
> I have to find the center of 2 points as a assigment for a course on fpcomplete. This is no homework because I do a self-study. 
>
> So I did  this:
>
> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) )
> main = print $ center ((1,2), (3, 4))

should be:

center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) )
main = print $ center (1,2) (3, 4)

>
> but now I see this error message :
>  
> Main.hs at 2:8-2:13
>
>   * No instance for (Show (((t0, t1), (t2, t3)) -> ((t0, t1), (t2, t3)))) arising from a use of `print' Possible fix: add an instance declaration for (Show (((t0,
>     t1), (t2, t3)) -> ((t0, t1), (t2, t3)))) In the expression: print In the expression: print $ center ((1, 2), (3, 4)) In an equation for `main': main = print $
>     center ((1, 2), (3, 4))
>
> Roelof
>
> _______________________________________________
> 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