Hello list,

I am pleased to announce a new release of the AppleScript package[1], which 
supports compiling and running AppleScript code from Haskell, and also supports 
calling back into Haskell from AppleScript. This release has many new features, 
including:

* AppleScript can now call back into Haskell, and return a final result to 
Haskell

* a quasiquoter for writing AppleScript code

* unicode support

Here is an example showcasing the main features:
> {-# LANGUAGE QuasiQuotes #-}
> import Foreign.AppleScript.Rich
> import qualified Data.Text.Lazy    as Text
> import qualified Data.Text.Lazy.IO as Text
>
> main = Text.putStrLn =<< evalScript mainScript
>
> mainScript = [applescript|
>   tell application "System Events"
>     -- Haskell value splices, and Unicode support.
>     display dialog "The value of π is $value{pi :: Double}$."
>
>     -- AppleScript can call back into Haskell.
>     set yourName to text returned of (display dialog "What is your name?" 
> default answer "")
>     display dialog ("Your name in reverse is " & $callback{ \t -> return 
> (Text.reverse t) }$[ yourName ]$)
>
>     -- Splice other AppleScript code into here
>     $applescript{ othergreeter }$
> 
>     -- Return text from AppleScript back to Haskell
>     return "Hello from AppleScript!"
>   end tell
>  |]
>
> othergreeter = [applescript|
>   display dialog "Hello from the other greeter!"
>  |]
With this release, I have taken over maintenance from Wouter Swierstra. Many 
thanks go to Wouter for his original work on this package.

[1]: http://hackage.haskell.org/package/AppleScript
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to