Emulating the elegance of JavaScript's new Array in Haskell What does new Array(x) do? Trick question. It does different things depending on whether x is an integer or something else. I wanted to replicate this elegant functionality in Haskell: behold.