Created
August 7, 2020 03:51
-
-
Save neilmayhew/2f3909e54faabb1a0b40eff35be94537 to your computer and use it in GitHub Desktop.
Ordering Semigroup instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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