Functions can be seen as exponentials in our algebra. As we can see, if we take a type a
with n instances and a type b
with m instances, the type a -> b
will have m to the power of n instances.
As an example, Bool -> Bool
is isomorphic to (Bool,Bool)
, as 2*2 = 2².
iso1 :: (Bool -> Bool) -> (Bool,Bool)
iso1 f = (f True,f False)
iso2 :: (Bool,Bool) -> (Bool -> Bool)
iso2 (x,y) = (\p -> if p then x else y)