Skip to content

Instantly share code, notes, and snippets.

@p1xelHer0
Last active August 6, 2018 21:14
Show Gist options
  • Save p1xelHer0/705e8dfc9aeeed9337c09e3883bba801 to your computer and use it in GitHub Desktop.
Save p1xelHer0/705e8dfc9aeeed9337c09e3883bba801 to your computer and use it in GitHub Desktop.
data Two a b =
Two a
b
deriving (Eq, Show)
instance (Semigroup a, Semigroup b) =>
Semigroup (Two a b) where
(Two x1 y1) <> (Two x2 y2) = Two (x1 M.<> x2) (y1 M.<> y2)
instance (Monoid a, Semigroup a, Monoid b, Semigroup b) =>
Monoid (Two a b) where
mempty = Two mempty mempty
mappend = (S.<>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment