
{- I am trying to figure out a way to send email using HSH and I'm stumped. The problem is that there is no ShellCommand instance for a pure vanilla string, which can be piped into another ShellCommand. There is a ShellCommand String instance, but the string is a command to be executed. I defined PureInput wrapper around String in an attempt to get this working, but I'm stumped defining an fdInvoke method for it. class (Show a) => ShellCommand a where fdInvoke :: a -> System.Posix.Types.Fd -> System.Posix.Types.Fd -> [System.Posix.Types.Fd] -> IO () -> IO [InvokeResult] Can someone help out? Below is a stub. Thomas. -} import HSH newtype PureInput = PureInput { unpureinput :: String } deriving (Read,Show) -- This works fine, blah blah blah gets outputted demo1 = runIO $ ( ( ( ("echo blah blah blah") :: String) -|- ( "cat" :: String) ) :: PipeCommand String String ) -- This is what I want. Specify a pure input string, to be piped into another command. -- In this example it's cat, which isn't very usefuol. -- This would be useful, however, for sending email via sendmail or mailx, with variable input piped in. -- The result should be that "blah blah blah" is printed from cat, just as in demo1. demo2 = runIO $ (PureInput "blah blah blah") -|- ( "cat" :: String) -- How can/should this be done? instance ShellCommand PureInput where fdInvoke (PureInput justAString) ifd ofd closefd forkfunc = undefined