Hacker News new | ask | show | jobs
by epsilonclose 2035 days ago
Thank you for clarifying. I was familiar with the notation A^B for the set of all f: A -> B, but this seemed like something more (and it does appear to be).

Putting some links I looked at here to save someone a few seconds of Googling: https://en.wikipedia.org/wiki/Exponential_object https://ncatlab.org/nlab/show/exponential+object

1 comments

I'm not sure if the notation you'd encountered differed, but in this case the equivalence is between A^B and B -> A (note the order).

Interestingly, every identity you learned in grade school algebra which involved only addition, multiplication, and exponentiation holds here as an isomorphism. It can be a fun exercise to write the functions that take you back and forth. For instance:

    A^(B+C) = A^B * A^C

    to: (Either b c -> a) -> (b -> a, c -> a)
    to f = (f . Left, f . Right)

    fro: (b -> a, c -> a) -> (Either b c -> a)
    fro (f, g) = \case
      Left b -> f b
      Right c -> g c