I find it a little difficult to understand the Haskell world, so I would really appreciate some help!
I want to create 2 dimensional array of Chars (a matrix 10x10 of symbols) and it should be mutable, so I tried this:
import Data.Array.IO
arr <- newArray ((1,10), (1,10)) '!' :: IO (IOArray (Int, Int) Char)
a <- readArray arr (1,1)
but it didn't worked out. Could you please tell me how to create the array and how to access its members, or if this isn't a good way, another way to do this?
And also I would like to ask if there is a way to color some of the elements in the array in a different color. I imported System.Console.ANSI but I'm not quite sure how exactly to color what I want to be in a different color. A example of outputting a red letter would be really helpfull.
Thank you very much in advance! :)
STkind, not theIOkind, though]). There are typically so many free cells that scanning them is much more expensive than a lookup in e.g. aMap.