
On Sun, Nov 26, 2017 at 07:02:36PM +0100, mrx wrote:
What do you mean by parameter of Point a?
Let's start with a type you probably know, Maybe: data Maybe a = Just a | Nothing The `a` in `Maybe a` is a type parameter, as the whole thing can be a `Maybe Int`, `Maybe String`, etc. Now let's check what `Point a` does data Point a = Coordinate Double Double Uhhh, suspicious, there is an `a` on the left side, but it's pretty useless, because there is no `a` on the right side. This is most likely not correct. Better to write -- this, concrete data Point = Coordinate Double Double -- or parametric data Point a = Coordinate a a
Do you think it would be a mistake to simply skip writing the type declarations completely until I've reached type classes?
As now you know how write signatures like `something :: Int -> [String]`, when you meet `Something a => etc.` tread with care until you reach the chapter on typeclasses.