Last active
December 14, 2015 00:48
-
-
Save mchakravarty/5001207 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
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} | |
module TestInlineObjC (objc_initialise, dumpURL) where | |
import Language.C.Quote.ObjC | |
import InlineObjC | |
objc_import ["<Foundation/Foundation.h>"] | |
dumpURL :: String -> IO () | |
dumpURL urlString | |
= do | |
{ urlData <- $(objc 'urlString [cexp| | |
[NSString stringWithContentsOfURL: [NSURL URLWithString: [NSString stringWithUTF8String: urlString]] | |
encoding: NSUTF8StringEncoding | |
error: NULL] | |
|]) | |
; putStr urlData | |
} | |
objc_emit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment