[Haskell-beginners] Type declarations

Francesco Ariis fa-ml at ariis.it
Sun Nov 26 20:24:01 UTC 2017


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*.

When you are writing signatures you are writing types, so

    f :: Point -> Point

and not

    f :: Point Int Float -> Point Int Float

Much like you write `addition :: Int -> Int -> Int` and not
`addition :: 7 -> 2 -> 9`.


More information about the Beginners mailing list