
26 Nov
2017
26 Nov
'17
4:41 p.m.
On Sun, Nov 26, 2017 at 10:21:39PM +0100, Patrik Iselind wrote:
But if the type Point have a parameter, `data Point p = Coordinate p p`. Then i must be able to tell which `p` when i use Point in a type declaration right? Like `delta :: Point Double a -> Point Double b -> Double` would say that p is Double. How else am i supposed to specify p in type declaration?
If the type has a parameter, like data Point a = Coordinates a a it will specified *once* in the signature, like this: f :: Point Double -> Point Double -> String implementation looking something like f (Coordinates x y) (Coordinates m q) = x + 7 -- etc. etc.