2010/10/27 Andy Stewart <[email protected]>:
> Serguey Zefirov <[email protected]> writes:
>> I think that you should use TH properly, without compiler and logical errors.
>>
>> What actually do you want?
> I'm build multi-processes communication program.
You don't need TH here, I think.
You can write a class Ask:
class Ask a where ask :: YourMonad a
and then instance it:
instance Ask Int where ask = liftIO $ do { putStrLn "Enter integer:";
l <- getLine; return $ read l}
instance Ask Char where ask = liftIO $ do { putStrLn "Enter char:"; l
<- getLine; return $ head l}
instance Ask String where ask = liftIO $ do { putStrLn "Enter
string:"; l <- getLine; return l}
instance (Ask a, Ask b, Ask c) => Ask (a,b,c) where ask = liftIO $ do
{ a <- ask; b <- ask; c <- ask; return (a,b,c)}
You can pass ask values between processes, receiving results of asking.
TH is great and good, but it is that only when you absolutely
exhausted of usual Haskell options.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe