Reduce duplication in Primitives.hs