Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/conformance98/FFI/newtype/Main.hs

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


module Main where

import NHC.PackedString
import NHC.FFI

newtype File           = F Addr deriving Show
newtype FileDescriptor = FD File deriving Show

foreign import noproto fopen :: PackedString -> PackedString -> IO FileDescriptor

--foreign import fopen :: String -> String -> IO FileDescriptor

main = do
  putStrLn "before fopen"
  fd <- fopen (packString "test") (packString "rw")
  --(FD fd) <- fopen (packString "test") (packString "rw")
  --(FD fd) <- fopen ("test") ("rw")
  putStrLn "after fopen"
  putStrLn ("result is "++show fd)
  putStrLn "done."

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.