<div dir="auto"><div data-smartmail="gmail_signature" dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote" dir="auto"><br></div><div class="gmail_quote">Den 26 nov 2017 15:08 skrev "Francesco Ariis" <<a href="mailto:fa-ml@ariis.it">fa-ml@ariis.it</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Sun, Nov 26, 2017 at 02:50:30PM +0100, Patrik Iselind wrote:<br>
> Hi,<br>
><br>
> What's the difference between `delta :: (Point t) => t -> t -> Double` and<br>
> `delta :: Point p -> Point q -> Double`. The later one is accepted by GHCI<br>
> when i do :load.<br>
<br>
</div>Hello Patrik,<br>
`delta :: (Point t) => t -> t -> Double` means Point is a typeclass<br>
and t is an instance of a typeclass.<br>
In your case point is a datatype (data Point a etc. etc.) so the second<br>
signature is the correct one.<br>
<div class="quoted-text"><br>
> In the second version, which is accepted by GHCI, i don't see the point of p<br>
> and q. Can i use these somehow?<br>
<br>
</div>`p` and `q` are the parameter of `Point a`,</blockquote></div></div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"></div><div dir="auto">What do you mean by parameter of Point a?</div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> but since the definition<br>
of Point is:<br>
<div class="quoted-text"><br>
data Point a = Coordinate Double Double<br>
deriving (Show)<br>
<br>
</div>that `a` most likely has... no point (ueueuee pardon the pun) and would<br>
better be written as<br>
<br>
data Point = Coordinate Double Double<br>
deriving (Show)<br>
<br>
Does this make sense?<br></blockquote></div></div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div><div dir="auto">I think I'll have to chew that until I reach the chapter on type classes in real world haskell. Hopefully I'll get it then.</div><div dir="auto"><br></div><div dir="auto">Do you think it would be a mistake to simply skip writing the type declarations completely until I've reached type classes?</div><div dir="auto"><br></div><div dir="auto">// Patrik</div></div>