Add Eq/Ord instances for ForeignPtr; enable bytestring library compilation

The instances for ForeignPtr are needed to allow bytestring to be
compiled.