Optical potentials of halo and weakly bound nuclei