Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.stack-work
23 changes: 12 additions & 11 deletions AppleScript.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: AppleScript
Version: 0.2.0.1
Version: 0.2.0.2
License: BSD3
License-file: LICENSE
Author: Wouter Swierstra <wouter.swierstra@gmail.com>, Reiner Pope <reiner.pope@gmail.com>
Expand Down Expand Up @@ -30,16 +30,17 @@ Library {
if os(darwin) {
Buildable: True
Build-Depends: base >= 2 && < 5,
bytestring < 0.10,
data-default < 0.4,
text < 0.12,
haskell-src-meta >= 0.5.0.3 && < 0.6,
text-format < 0.4,
network < 2.4,
conduit < 0.3,
directory < 1.2,
template-haskell == 2.7.*,
mtl == 2.0.*
bytestring,
data-default,
text,
haskell-src-meta >= 0.5.0.3,
text-format,
network,
conduit,
resourcet,
directory,
template-haskell >= 2.7.0.0,
mtl
Exposed-modules:
Foreign.AppleScript
Foreign.AppleScript.Error
Expand Down
33 changes: 16 additions & 17 deletions Foreign/AppleScript/Rich.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{-# LANGUAGE
TemplateHaskell,
OverloadedStrings,
ExistentialQuantification,
ViewPatterns,
TupleSections,
TypeSynonymInstances,
FlexibleInstances
{-# LANGUAGE
TemplateHaskell,
OverloadedStrings,
ExistentialQuantification,
ViewPatterns,
TupleSections,
TypeSynonymInstances,
FlexibleInstances
#-}
{-# OPTIONS_GHC -funbox-strict-fields -Wall -Werror #-}

Expand All @@ -27,14 +27,14 @@
-- > 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
Expand All @@ -52,6 +52,7 @@ module Foreign.AppleScript.Rich
-- * Common-use functions
Plain.appleScriptAvailable,
applescript,
applescriptplain,
runScript,
evalScript,
debugScript,
Expand All @@ -63,16 +64,15 @@ module Foreign.AppleScript.Rich
-- * Configuration
AppleScriptConfig(..),
def,
)
)
where

import Foreign.AppleScript.Error
import qualified Foreign.AppleScript.Plain as Plain

import Control.Applicative
import Control.Monad.State
import Control.Monad.Writer
import Control.Monad.Trans.Resource(ResourceT, runResourceT, withIO)
import Control.Monad.Trans.Resource(ResourceT, runResourceT, allocate)

import Control.Exception(tryJust, finally)
import Control.Concurrent(forkIO, killThread)
Expand Down Expand Up @@ -275,12 +275,11 @@ runScriptFull conf script = runResourceT $ do
port <- liftIO $ portGen conf

-- start the callback server
(_, sock) <- lift $
withIO
(_, sock) <- lift $ allocate
(listenOn (PortNumber port))
sClose
-- (const $ return ())
void $ lift $ withIO
void $ lift $ allocate
(forkIO $ serverLoop handler sock)
killThread

Expand Down
5 changes: 5 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-3.0