[Haskell-beginners] Type declarations

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


Den 2017-11-26 kl. 21:24, skrev Francesco Ariis:
> On Sun, Nov 26, 2017 at 07:39:49PM +0100, Patrik Iselind wrote:
>> Does this mean that i can write `delta :: Point Double t -> Point Double t
>> -> Direction d` as a type declaration. Then i would require `Coordinate
>> Double Double` as in parameters. Correct?
> Careful there! Let's take a simple data declaration
>
>      data Point = Point Int Float
>
> On the right you have *the type*, on the left you have *the (data)
> constructor*.
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?

// Patrik


More information about the Beginners mailing list