Skip to content

Commit

Permalink
Track changes to the CoreFoundation API.
Browse files Browse the repository at this point in the history
  • Loading branch information
judah committed Aug 21, 2011
1 parent db1ee6f commit f86c2c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
14 changes: 1 addition & 13 deletions examples/ExpressionEvaluator/ExpressionController.m
Expand Up @@ -10,19 +10,7 @@

@implementation ExpressionController

-(void)foo {
NSLog(@"About to call foo()");
foo();
NSLog(@"Called foo(a)");
foo();
NSLog(@"Called foo(b)");
foo();
NSLog(@"Called foo().");
}

-(IBAction)evaluate:(id)sender {
[self performSelectorInBackground:@selector(foo) withObject:nil];

-(IBAction)evaluate:(id)sender {
NSString *input = [inputField stringValue];

// Since (NSString *) and CFStringRef are toll-free bridged, processInput
Expand Down
18 changes: 2 additions & 16 deletions examples/ExpressionEvaluator/haskell/ForeignExpr.hs
Expand Up @@ -2,7 +2,6 @@ module ForeignExpr where

import System.CoreFoundation hiding (String)
import qualified System.CoreFoundation as CF
import qualified Data.Text as Text
import Text.ParserCombinators.Parsec
import Control.Concurrent

Expand All @@ -19,21 +18,8 @@ processInput input = do

processInputHelper :: CF.String -> IO CF.String
processInputHelper input = do
inputStr <- fmap Text.unpack $ stringToText input
inputStr <- getChars input
let resultStr = case parse expr "<input>" inputStr of
Left err -> show err
Right result -> show result
stringFromText $ Text.pack resultStr

foreign export ccall foo :: IO ()

foo = do
putStrLn "About to queue..."
r <- mainRunLoop
putStrLn "Queued."
queueIOAndWait r $ do
putStrLn "HereA"
threadDelay 1000000
putStrLn "HereB"
putStrLn "HereD"

newStringFromChars resultStr

0 comments on commit f86c2c0

Please sign in to comment.