
Not a very descriptive subject, I know, but here's what I'd like to do. I can take getChar and create an infinate list: listChars = getChar : listChars but how do I go about creating a finite list, e.g. a list that ends as soon as 'q' is pressed? I was thinking of something like listChars1 = do c <- lift getChar if c == 'q' then [return c] else [return c] ++ listChars1 However, that triggers an interesting behaviour in ghci: *Main> :t listChars1 <interactive>:1:0: Can't find interface-file declaration for listChars1 Probable cause: bug in .hi-boot file, or inconsistent .hi file Use -ddump-if-trace to get an idea of which file caused the error Compiling it doesn't work either: % ghc -o listio listio.hs listio.o: In function `Main_main_info': (.text+0x1bd): undefined reference to `Main_listChars1_closure' listio.o: In function `Main_main_srt': (.rodata+0x10): undefined reference to `Main_listChars1_closure' collect2: ld returned 1 exit status I was also looking briefly at ListT, bout couldn't quite see how to use basic list operations on it, e.g. ':' '++' etc. listChars2 :: ListT IO Char listChars2 = do c <- lift getChar if c == 'q' then lift $ return c else (lift $ return c) ++ listChars2 /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. Microsoft has a new version out, Windows XP, which according to everybody is the 'most reliable Windows ever.' To me, this is like saying that asparagus is 'the most articulate vegetable ever.' -- Dave Barry