On Sun, Nov 26, 2017 at 02:50:30PM +0100, Patrik Iselind wrote:Hello Patrik,
> Hi,
>
> What's the difference between `delta :: (Point t) => t -> t -> Double` and
> `delta :: Point p -> Point q -> Double`. The later one is accepted by GHCI
> when i do :load.
`delta :: (Point t) => t -> t -> Double` means Point is a typeclass
and t is an instance of a typeclass.
In your case point is a datatype (data Point a etc. etc.) so the second
signature is the correct one.
`p` and `q` are the parameter of `Point a`,
> In the second version, which is accepted by GHCI, i don't see the point of p
> and q. Can i use these somehow?
but since the definition
of Point is:
that `a` most likely has... no point (ueueuee pardon the pun) and would
data Point a = Coordinate Double Double
deriving (Show)
better be written as
data Point = Coordinate Double Double
deriving (Show)
Does this make sense?