Skip to content

Instantly share code, notes, and snippets.

@neilmayhew
Created August 7, 2020 03:51
Show Gist options
  • Save neilmayhew/2f3909e54faabb1a0b40eff35be94537 to your computer and use it in GitHub Desktop.
Save neilmayhew/2f3909e54faabb1a0b40eff35be94537 to your computer and use it in GitHub Desktop.
Ordering Semigroup instance
class Eq a => Ord a where
compare :: a -> a -> Ordering
class Semigroup a where
(<>) :: a -> a -> a
instance Semigroup Ordering where
(<>) = undefined
func :: (Ord u, Ord v) => (u, u) -> (v, v) -> Ordering
func (a, b) (x, y) = compare a b <> compare x y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment