tikhon 2017-02-06 08:01:42
Does anyone here have experience with Haskell Kafka clients? I found a couple of options (haskakafka and milena), and I'd love to hear about how these libraries play out in practice.
ThomasLocke 2017-02-06 08:08:06
What exactly does -threaded do when added to ghc-options in my cabal file?
ongy 2017-02-06 08:08:22
compile the application with the threaded rts
ThomasLocke 2017-02-06 08:08:44
Right now I have this: -Wall -threaded -rtsopts -with-rtsopts=-N but I'm not sure exactly what -threaded and rtpsopts do
ph88 2017-02-06 08:08:58
hello
ThomasLocke 2017-02-06 08:09:32
ongy, OK, so does that mean that the runtime then automatically figures out how many cores are on the system where the program runs?
ph88 2017-02-06 08:10:01
how can i use if-then in a do-block? https://paste.fedoraproject.org/550018/64081471/
ongy 2017-02-06 08:11:40
I'm not quite sure about the -N flag and what it does without a number
dmwit 2017-02-06 08:11:43
ThomasLocke: -with-rtsopts=-N does that part
ThomasLocke 2017-02-06 08:11:52
I think I just found the answer... -N apparently lets the runtime decide for itself.
ThomasLocke 2017-02-06 08:12:06
dmwit, Yes.
ThomasLocke 2017-02-06 08:12:28
So -threaded and -N sorta/kinda goes hand in hand, yes? Or am I missing something?
dedgrant 2017-02-06 08:12:35
ph88 See Control.Monad.when (https://hackage.haskell.org/package/base-4.9.1.0/docs/Control-Monad.html#v:when)
dmwit 2017-02-06 08:12:43
ThomasLocke: They are useful together, yes.
ph88 2017-02-06 08:12:57
thank you dedgrant :)
ThomasLocke 2017-02-06 08:13:00
-threaded is about concurrency and -N about parallelism
ThomasLocke 2017-02-06 08:13:20
Does that sound about right?
dmwit 2017-02-06 08:13:41
I don't think so. -threaded is about whether parallelism is available at all. (Concurrency is always available.)
ThomasLocke 2017-02-06 08:13:55
dmwit, I see.
dmwit 2017-02-06 08:15:00
-N is about how many OS threads the runtime system starts with to implement concurrency and parallelism with.
ThomasLocke 2017-02-06 08:15:02
So projects that set neither -threaded nor -N in the cabal file, might be doing something in the source itself with GHC.Conc.setNumCapabilities and similar?
dmwit 2017-02-06 08:15:23
I don't think setNumCapabilities does anything in the non-threaded runtime.
dmwit 2017-02-06 08:15:32
(i.e. when the program is compiled without -threaded)
dmwit 2017-02-06 08:16:03
ThomasLocke: You might like http://dmwit.com/gtk2hs (ignoring the gtk-specific bits).
dmwit 2017-02-06 08:16:41
Skip "Best Practice" and "The Guts", I guess. The rest is going to be right up your alley.
ThomasLocke 2017-02-06 08:18:28
dmwit, Thanks. I'll take a look. :o)
Tuplanolla 2017-02-06 08:18:56
Why does `Network.Socket` have a huge swathe of address families in `Family`, but `SockAddr` has only four constructors?
Tuplanolla 2017-02-06 08:20:05
They seem to only cover `AF_UNIX`, `AF_INET`, `AF_INET6` and, for some reason, `AF_CAN`.
dmwit 2017-02-06 08:21:01
This comes up often enough that I should really split this out into two posts, one about Haskell's threading model and one about gtk2hs.
ph88 2017-02-06 08:28:35
dedgrant, could you tell me what i'm doing wrong here with using when? https://paste.fedoraproject.org/550027/40931214/
ph88 2017-02-06 08:30:00
ups, i put the import in the wrong file -___-
newbie__ 2017-02-06 08:30:41
hello, folks! I have a question about control characters in Haskell
newbie__ 2017-02-06 08:31:09
Currently working through Professor Hutton's Programming in Haskell, and there are examples where control characters like \DEL etc are used
newbie__ 2017-02-06 08:31:34
but they don't seem to be working for me :( ... I am using getChar to read in the character... any idea what could be wrong?
ph88 2017-02-06 08:32:23
is there a shortcut function to do return () ? https://paste.fedoraproject.org/550030/14864095/
ph88 2017-02-06 08:33:17
newbie__, maybe you can use the ord function and see which code your character has
newbie__ 2017-02-06 08:33:43
ph88 let me try that and get back!
ph88 2017-02-06 08:33:57
https://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Char.html#v:ord
newbie__ 2017-02-06 08:36:19
ph88 I can't seem to be able to print it out (I'm doing: c <- getChar putStrLn ("code = " ++ (show (ord c))) inside a do block
newbie__ 2017-02-06 08:36:22
is that correct?
newbie__ 2017-02-06 08:36:41
I instead get the ASCII code for return since it looks like getChar is waiting for the enter key for me
Tuplanolla 2017-02-06 08:37:08
Hint, newbie__: `hSetBuffering stdin NoBuffering`.
newbie__ 2017-02-06 08:38:47
Tuplanolla That gives me code 27 when I use runghc ... okay, some progress! :D
Tuplanolla 2017-02-06 08:39:02
> chr 27
lambdabot 2017-02-06 08:39:06
'\ESC'
newbie__ 2017-02-06 08:39:31
okay, it works in ghci as well as using runghc!
newbie__ 2017-02-06 08:40:01
I'm on a macOS box... is that causing that ASCII code?
ph88 2017-02-06 08:40:01
Tuplanolla, could you take a look at my code please ?
ph88 2017-02-06 08:40:27
what you mean causing the ascii code ?
newbie__ 2017-02-06 08:40:44
I'm new to mac.. is \ESC the same as the DEL key?
Tuplanolla 2017-02-06 08:40:47
Okay. What's the issue, ph88?
newbie__ 2017-02-06 08:41:17
I'm using a third party keyboard with my mac... maybe the bindings are wrong? I'll check using the laptop keyboard and see
ph88 2017-02-06 08:41:20
newbie__, hhmm ye interesting question .. i'm not sure if all the keys get mapped to ascii actually .. but for sure they have _some_ code
ph88 2017-02-06 08:41:32
Tuplanolla, https://paste.fedoraproject.org/550030/14864095/
Tuplanolla 2017-02-06 08:41:45
I'm already looking at it, ph88.
ph88 2017-02-06 08:42:04
eh it's a bit outdated paste, line 8 is already solved
newbie__ 2017-02-06 08:42:33
ph88 yup... using my laptop keyboard, I get code 127 which appears to be the code for delete
newbie__ 2017-02-06 08:42:35
:-)
newbie__ 2017-02-06 08:42:42
Thanks, ph88, Tuplanolla!
ph88 2017-02-06 08:42:44
nice
Tuplanolla 2017-02-06 08:43:07
I guess you want `void $ M.lookAhead $ c [e delimitersNl]`, ph88.
ph88 2017-02-06 08:44:17
Tuplanolla, when i use void can M.lookAhead $ c [e delimitersNl] still fail and terminate the do-block ?
Tuplanolla 2017-02-06 08:44:42
Yes.
Tuplanolla 2017-02-06 08:44:57
@src void
lambdabot 2017-02-06 08:44:57
void = fmap (const ())