Created
September 2, 2011 04:09
-
-
Save carlohamalainen/1187895 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
ncInq :: NCID -> IO (Int, Int, Int, Int) | |
ncInq ncid = do | |
alloca $ \ndims_ptr -> do | |
alloca $ \nvars_ptr -> do | |
alloca $ \natts_ptr -> do | |
alloca $ \unlimdimid_ptr -> do | |
status <- nc_inq ncid ndims_ptr nvars_ptr natts_ptr unlimdimid_ptr | |
ndims <- peek ndims_ptr | |
nvars <- peek nvars_ptr | |
natts <- peek natts_ptr | |
unlimdimid <- peek unlimdimid_ptr | |
return (fromEnum ndims, fromEnum nvars, fromEnum natts, fromEnum unlimdimid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@tonymorris:
That is not equivalent. alloca takes a function as a parameter. See my last fork for an example using ContT that looks more like your version, though.