Created
July 15, 2011 14:55
-
-
Save norm2782/1084844 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
I have a function | |
GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *path); | |
Return int is a possible error code. Actual value I'm interested in is **repository | |
Haskell code: | |
openRepo :: String -> IO (Either GitError Repository) | |
openRepo path = do | |
let repo = nullPtr | |
pstr <- newCString path | |
res <- {#call git_repository_open#} repo pstr | |
return $ case res of | |
0 -> Right $ Repository repo | |
n -> Left . toEnum . fromIntegral $ n | |
newtype Repository = Repository { unRepository :: Ptr () } | |
This is not going too well: | |
Assertion failed: (repo_out && path), function git_repository_open, file repository.c, line 347. | |
What's going wrong here? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment