Skip to content

Instantly share code, notes, and snippets.

@yen3
Last active December 22, 2015 12:29
Show Gist options
  • Save yen3/6472765 to your computer and use it in GitHub Desktop.
Save yen3/6472765 to your computer and use it in GitHub Desktop.
Read the contents from the clipboard in Mac OSX
-- Read the contents of clipboard
-- Ref: http://stackoverflow.com/questions/1712347/closest-equivalent-to-subprocess-communicate-in-haskell
import System.Process
processData :: String -> String
processData = (id :: String -> String)
processPaste :: (String -> String) -> IO ()
processPaste pd = do
let cmd = "pbpaste"
args = []
instr = []
(rc, out, err) <- readProcessWithExitCode cmd args instr
putStrLn $ pd out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment