[Haskell-beginners] Making my own type belong to Data.Ord

Patrik Iselind patrik.mrx at gmail.com
Sat Jan 20 20:20:33 UTC 2018


Hi,

I'm trying to follow the "Real World Haskell" book online and have 
reached exercise 12 in chapter three. See the bottom of 
http://book.realworldhaskell.org/read/defining-types-streamlining-functions.html 
for reference.

It's the very last exercise on the page concerning constructing a Convex 
Hull. I have no problem implementing a Graham Scan in non-functional 
languages as i have far more experience with those. But the book hasn't 
yet covered how i make my own data belong to for example the Data.Ord 
class. The question then for me is how am i supposed to sort my coordinates?

Type classes are not covered for another three chapters in the book. 
Given this it seems to me that i should be able to solve this without 
using Data.Ord, i just cannot see how. Any pointers would be highly 
appreciated.

-- 
Patrik Iselind



More information about the Beginners mailing list