  In this paper, we study Euclidean and Hermitian hulls of generalized
Reed-Solomon codes and twisted generalized Reed-Solomon codes, as well as the
Hermitian hulls of Roth-Lempel typed codes. We present explicit constructions
of MDS and AMDS linear codes for which their hull dimensions are well
determined. As an application, we provide several classes of
entanglement-assisted quantum error correcting codes with new parameters.
