Church encoding and algebras