[Haskell-cafe] [Pipes] Can pipes solve this problem? How?

2012-08-15 Thread Daniel Hlynskyi
Hello Cafe. Consider code, that takes input from handle until special substring matched: matchInf a res s | a `isPrefixOf` s = reverse res matchInf a res (c:cs) = matchInf a (c:res) cs hTakeWhileNotFound str hdl = hGetContents hdl = return.matchInf str [] It is simple, but

[Haskell-cafe] Cannot System,Timeout.timeout Network.accept

2012-06-21 Thread Daniel Hlynskyi
Hello Cafe. I cannot accept socket connection with timeout (Windows, GHC 7.4,1). Consider following code: import Network import System.Timeout main = withSocketsDo $ do print :: Starting server ... sock - listenOn (PortNumber 4010) res - timeout 1 (accept sock) print Timed

Re: [Haskell-cafe] How helpful is h-99 (and should we complete the missing ones)?

2012-04-15 Thread Daniel Hlynskyi
So here's my question: how useful is h-99 (are they overrated as learning tools)? I find myself solve most of them in a from the scratch fashion (e.g., no Monad, no Applicative, no Functor aside from List and a few Maybe). Some of them are paper-worthy, for example the prime problems. I hope

Re: [Haskell-cafe] [C][enums][newbie] What is natural Haskell representation of such enum?

2012-01-23 Thread Daniel Hlynskyi
Thanks. This and previous email are answers to question I asked. But not the answer to question I mean. I'll describe the whole task, as Yves Parès suggested. I'm trying to convert C++ code to Haskell. I have such hierarchy: class Object, class Item : Object, class Container : Item. Another one