From 83342e816fb8ff1ab97287f11d9a98022a41688f Mon Sep 17 00:00:00 2001 From: JeffreyBenjaminBrown Date: Mon, 25 Mar 2019 09:12:36 -0500 Subject: [PATCH] add an Ord instance --- Data/List/PointedList.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Data/List/PointedList.hs b/Data/List/PointedList.hs index de5cf2a..20aa83a 100644 --- a/Data/List/PointedList.hs +++ b/Data/List/PointedList.hs @@ -47,6 +47,10 @@ prefix f (PointedList ls x rs) = (\ls' -> PointedList (reverse ls') x rs) <$> f instance (Show a) => Show (PointedList a) where show (PointedList ls x rs) = show (reverse ls) ++ " " ++ show x ++ " " ++ show rs +-- | `fromList l <= fromList m` if and only if `l <= m` +instance Ord a => Ord (PointedList a) where + compare pl ql = compare (toList pl) (toList ql) + instance Functor PointedList where fmap f (PointedList ls x rs) = PointedList (map f ls) (f x) (map f rs)