Print each element of a CArray

I have this CArray

import qualified Data.Array.CArray as CArr
import qualified Data.Array.IArray as IArr

arr :: CArr.CArray Int Double
arr = IArr.array (1, 4)  $ zip [1..4] [1..4]

How do I print each element of CArray? Something like this pseudocode if arr is a list:

mapM_ print arr

Upvotes: 1

Views: 64

Answers (1)

melpomene
melpomene

Reputation: 85887

mapM_ print (IArr.elems arr)

This looks like the easiest solution.

Upvotes: 3

Related Questions