Hacker News new | ask | show | jobs
by dllthomas 2028 days ago
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