Rewrriten with ekmett's `constraints' package.