Type class inference trouble