[Haskell-beginners] main: <<loop>> ....?

David Virebayre dav.vire+haskell at gmail.com
Mon Aug 22 10:19:31 CEST 2011


2011/8/22 Sunil S Nandihalli <sunil.nandihalli at gmail.com>:
> Yes David, it is printing some stuff.. I am trying to track down where
> it is getting into infinite loop by placing a lot of trace commands ..
> Thanks
> Sunil.

Try to run it in ghci, step by step:

1) input<-getContents

better to replace this step by a

1) input <- readFile "mytestdata"


2) let w@(nstr:locPairStrs) = lines input
3) let n = read nstr::Integer
4) let locs = take (fromIntegral n) $ map (tuplify2 . (\x-> map
stringToRatio $ words x))
                     locPairStrs
5) let answer = solve n locs
6) putStrLn $ " n : "++ show n
7) putStrLn $ " locs : "++show locs
8) putStrLn $ show $ vornoiGraph locs
9) putStrLn $ plotAsString locs answer

see what happens, and where.


>
> On Mon, Aug 22, 2011 at 1:19 PM, David Virebayre
> <dav.vire+haskell at gmail.com> wrote:
>> 2011/8/22 Sunil S Nandihalli <sunil.nandihalli at gmail.com>:
>>> Is there a way I can find out where it is in infinite loop?
>>
>> I don't know of any other way to find it than looking at the code, I
>> hope someone with more experience will be able to explain a better
>> way.
>>
>> After looking at the source code you posted, does it print anything
>> before it prints <<loop>> ?
>>
>



More information about the Beginners mailing list