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
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
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
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