Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created February 3, 2020 14:41
Show Gist options
  • Save monadplus/6132c4437161883cb2d316b4af1a5046 to your computer and use it in GitHub Desktop.
Save monadplus/6132c4437161883cb2d316b4af1a5046 to your computer and use it in GitHub Desktop.
Class Synonyms
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
module ClassSynonyms where
-- This is bordersome to write every time..
-- f :: (C1 a, C2 a, C3 a) => ...
-- class synonyms
class (C1 a, C2 a, C3 a) => C a where { }
instance (C1 a, C2 a, C3 a) => C a where { }
-- Better!
f :: C a => ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment