[Haskell-beginners] Type declarations

Patrik Iselind patrik.mrx at gmail.com
Sun Nov 26 21:51:26 UTC 2017


Patrik Iselind

Den 2017-11-26 kl. 22:41, skrev Francesco Ariis:
> 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
So what you're saying is that the `a` and `b` characters in my examples 
should not be there. Other than that it's correct?

// Patrik


More information about the Beginners mailing list