Envelope compacton and solitary pattern solutions of a generalized nonlinear Schrodinger equation