Canonical bases and Hall algebras