Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Vector/Vector.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module NHC.Vector
  ( Vector()
  , copy
  , new
  , (!)
  , update
  ) where

import PreludeBuiltin(Vector)
import _E

foreign import ccall primCopyVectorC   :: Vector a -> IO (Vector a)
foreign import ccall primNewVectorC    :: Int -> _E a -> IO (Vector a)
foreign import ccall primVectorIndexC  :: Vector a -> Int -> IO a
foreign import ccall primUpdateVectorC :: Int -> _E a -> Vector a -> IO ()


copy :: Vector a -> IO (Vector a)
copy = primCopyVectorC

new :: Int -> a -> IO (Vector a)
new n x = primNewVectorC n (_E x)

(!) :: Vector a -> Int -> IO a
(!) = primVectorIndexC

update :: Vector a -> Int -> a -> IO ()
update v n x = primUpdateVectorC n (_E x) v

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.