Search Haskell Channel Logs

Saturday, January 28, 2017

#haskell channel featuring Rotaerk, excelsiora, xpika,

xpika 2017-01-28 18:31:22
using pipes how can I consume only 1 character of stdin
Rotaerk 2017-01-28 18:33:38
xpika, are you reading lines, but you only want the first character from the line, or are you trying to read characters before enter is hit?
xpika 2017-01-28 18:35:14
Rotaerk: I don't want to read a line as potentially the first line could be larger than memory. On the safe side I want to read just a few characters instead
Rotaerk 2017-01-28 18:35:33
is this not a text file you're reading?
Rotaerk 2017-01-28 18:36:32
I mean if it's interactive, you generally can't read something until enter is pressed and then you get a whole line
excelsiora 2017-01-28 18:36:54
looks like I can get the compiler with this? https://hackage.haskell.org/package/Cabal-1.24.2.0/docs/Distribution-Simple-Compiler.html How would you idiomatically print the compiler name and version?
Rotaerk 2017-01-28 18:37:01
I think there's a way to change the mode so that you get each entered key or something; never tried that though...
excelsiora 2017-01-28 18:38:37
print?
excelsiora 2017-01-28 18:39:04
putStrLn?
Rotaerk 2017-01-28 18:40:42
excelsiora, you mean the CompilerFlavor and Version within the CompilerId?
xpika 2017-01-28 18:41:37
Rotaerk: the standard functions for reading work on lines stdinLn . i want stdinChar
Rotaerk 2017-01-28 18:41:45
CompilerId implements Show, so you should be able to just print it
Rotaerk 2017-01-28 18:44:18
xpika, what about https://hackage.haskell.org/package/pipes-text
Rotaerk 2017-01-28 18:44:30
it doesn't use stdinChar, but it has something that uses hGetChunk
Rotaerk 2017-01-28 18:44:42
i.e. I don't think you have to worry about reading too much at a time
xpika 2017-01-28 18:44:53
Rotaerk: what if i want to ready binary ?