Haskell accepts the definition of the following type
data Lam = Func (Lam -> Lam)
which intends to represent untyped lambda-terms. For example, Church's booleans are in this type
trueChurch :: Lam
trueChurch = Func (\x -> Func (\y -> x))
falseChurch :: Lam
falseChurch = Func (\x -> Func (\y -> y))
The constructor Func :: (Lam -> Lam) -> Lam has this inverse function
lamUnfold :: Lam -> (Lam -> Lam)
lamUnfold (Func f) = f
and those two functions define a type isomorphism between Lam -> Lam and Lam. This is surprising when we look at the cardinals (the sizes) of those types. Because of the Church booleans above, the cardinal of Lam is at least 2, so there are more elements in Lam -> Lam than in Lam -> Bool. The latter is the type of subtypes of Lam, i.e. the powerset of Lam, and by Cantor's theorem it already has much more elements than Lam does. How does the existence of type Lam not violate Cantor's theorem ?
Part of the answer might be in domain theory. If I understand correctly, the elements of Lam -> Lam would not be all set-theoretic functions (which are bigger than Lam by Cantor's theorem), but only continuous functions. If so, what is the topology that defines this continuity, and why are Haskell terms of type Lam -> Lam continuous for it ?