concept uarray in category haskell

appears as: UArray, UArrays
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

42.1.2. Creating a UArray

As in most programming languages, when you create an array in Haskell, you have to specify its size. Unlike with most languages, you get to choose what your indices are! UArrays take two type parameters; the first is for the type of the index, and the second is for the type of the value. You have some flexibility in the type you can use for the index. You can use types that are members of Enum and Bounded. This means your index could be Char or Int, but not Double (not an instance of Enum), and not Integer (not an instance of Bounded). You could even have the index be of type Bool, but that would always be a two-element array. For the most part, you want your indices’ Int types to be 0 to length –1. To create a UArray, you use the array function. The array function takes two arguments: