  We use the catalogue of 4315 extragalactic HI 21-cm emission line detections
from HIPASS to calculate the most accurate measurement of the HI mass function
(HIMF) of galaxies to date. The completeness of the HIPASS sample is well
characterised, which enables an accurate calculation of space densities. The
HIMF is fitted with a Schechter function with parameters: alpha=-1.37 +/- 0.03
+/- 0.05, log (M_HI/M_sun=9.80 +/- 0.03 +/- 0.03, and theta*=(6.0 +/- 0.8 +/-
0.6) x 10^{-3} Mpc^{-3} (random and systematic uncertainties at 68% CL, H0=75),
in good agreement with calculations based on the HIPASS Bright Galaxy
Catalogue, which is a complete, but smaller, sub-sample of galaxies. The
cosmological mass density of HI in the local universe is found to be
Omega_HI=(3.5 +/- 0.4 +/- 0.4) x 10^{-4}. This large homogeneous sample allows
us to test whether the shape of the HIMF depends on local galaxy density. We
find tentative evidence for environmental effects in the sense that the HIMF
becomes steeper toward higher density regions, ranging from alpha ~ -1.2 in the
lowest density environments to alpha ~ -1.5 in the highest density environments
probed by this blind HI survey. This effect appears stronger when densities are
measured on larger scales.
