Skip to content

Instantly share code, notes, and snippets.

@Shimuuar
Created July 18, 2014 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shimuuar/c221e1f8e98c49d0adc7 to your computer and use it in GitHub Desktop.
Save Shimuuar/c221e1f8e98c49d0adc7 to your computer and use it in GitHub Desktop.
-- Trick for expressing contexts like (∀ a. Binary a => Binary (f a))
--
-- This type class says that if we have dictionary for data type `a' we can
-- construct dictionary for `f a' or equivalently that if `a' is instance of
-- Binary `f a' is instance too.
class Binary2 f where
binaryDict :: BinaryDict a -> BinaryDict (f a)
data BinaryDict a where
BinaryDict :: Binary a => BinaryDict a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment