creating custom instance of UArray
Suppose I have a simple data type like: data Cell = Open | Blocked and I'd like to use a UArray Int Cell . Is there an easy way to do this? Can I somehow reuse the definition for UArray Int Bool ? crockeea This answer explains why Vectors are better than Arrays, so I'm going to give you the answer for unboxed vectors. I did try deriving an MArray and IArray instance for Cell based on the Bool instances, but the Bool instances are quite complicated; it would be at least as ugly as manually deriving an Unbox instance for vectors. Unlike vectors, you also can't just derive Storable and use