Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Musings on One / Zero

Representable

data One a = One
  deriving Functor

instance Distributive One where
  distribute :: Functor f => f (One a) -> One (f a)
  distribute _ = One

instance Representable One where
  type Rep One = Void

  index :: One a -> Void -> a
  index One = absurd

  tabulate :: (Void -> a) -> One a
  tabulate _ = One

Share Product Notation

Write it as

data () a = One
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment