Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/libraries/fps/tests/iavor.hs

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


import qualified Data.ByteString as B
import Data.ByteString (packCString)
import Foreign.C.String
import Foreign

main = do x <- newCString "Hello"
          s <- packCString x
          let h1  = B.head s
          print s
          poke x (toEnum 97)
          print s
          let h2 = B.head s
          print h1
          print h2

{-

$ runhaskell iavor.hs
"Hello"
"Hello"
72
72

-}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].