Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Data/List/PointedList.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down