Last active
December 22, 2015 12:29
-
-
Save yen3/6472765 to your computer and use it in GitHub Desktop.
Read the contents from the clipboard in Mac OSX
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
-- 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