ofListIO xs  = newIO n f
  where
    n        = length xs
    m        = M.fromList $ zip [0..] xs
    f i      = (M.!) m i


{-@ mapIO :: (a -> b) -> a:IOArr a -> IO ({v:IOArr b | size v = size a}) @-}
ofListIO xs  = newIO n f
  where
    n        = length xs
    m        = M.fromList $ zip [0..] xs
    f i      = (M.!) m i


{-@ mapIO :: (a -> b) -> a:IOArr a -> IO ({v:IOArr b | size v = size a}) @-}
ofListIO xs  = newIO n f
  where
    n        = length xs
    m        = M.fromList $ zip [0..] xs
    f i      = (M.!) m i


{-@ mapIO :: (a -> b) -> a:IOArr a -> IO ({v:IOArr b | size v = size a}) @-}