Fine-grained lattice primitives for Haskell