-
-
Save glguy/7a5ae553f463aa7d2c7e786180b9d085 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Foreign.Storable (peek) | |
import Foreign.Marshal.Array (peekArray0) | |
import Foreign.C (CInt, CString, peekCString) | |
import Foreign.Ptr (Ptr, nullPtr) | |
foreign import ccall "&rts_argv" rts_argv_p :: Ptr (Ptr CString) | |
foreign import ccall "&rts_argc" rts_argc_p :: Ptr CInt | |
main = print =<< getRTSArgs | |
getRTSArgs :: IO [String] | |
getRTSArgs = | |
do rts_argv <- peek rts_argv_p | |
ptrs <- peekArray0 nullPtr rts_argv | |
mapM peekCString ptrs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment