Rodenbach 2017-01-27 05:46:47
In the Input/Output chapter of Learn You A Haskell a function reverseWords = unwords . map reverse . words is shown. Why is the author not simply calling the reverse function?
MarcelineVQ 2017-01-27 05:48:45
they're a little different, reverse would reverse the entire line, what the above does is reverse each seperate word in a line
MarcelineVQ 2017-01-27 05:49:05
> (unwords . map reverse . words) "oh my goodness"
lambdabot 2017-01-27 05:49:07
"ho ym ssendoog"
MarcelineVQ 2017-01-27 05:49:12
> reverse "oh my goodness"
lambdabot 2017-01-27 05:49:15
"ssendoog ym ho"
Rodenbach 2017-01-27 05:51:16
MarcelineVQ: true, makes sense, thx
ph88 2017-01-27 05:55:44
byorgey, i have another question about nearly the same code, is that ok ?
pavel 2017-01-27 06:19:10
Hello everyone
pavel 2017-01-27 06:19:53
I've got a problem with understanding function composition
ph88 2017-01-27 06:21:14
sup pavel
dfeuer 2017-01-27 06:21:38
edwardk: yes, Data.Set is missing
dfeuer 2017-01-27 06:22:57
edwardk: yes, Data.Set is missing alterF. And I would like to add it. With apologies to lens, it will be Bool rather than Maybe ().
bennofs1 2017-01-27 06:31:43
Ok, I've simplified my problem from before. Run https://gist.github.com/bennofs/b97dbd484f8598b3347304ee9c4c2a79 (requires pretty-show haskell package) with runhaskell, and you'll be surprised: it outputs "Nothing" and "Just" mixed
ph88 2017-01-27 06:34:04
bennofs1, Just should have a value
bennofs1 2017-01-27 06:35:07
ph88: I'm not interested in the value in this case
bennofs1 2017-01-27 06:35:17
ph88: this program should print only 'Nothing' or only 'Just'
bennofs1 2017-01-27 06:35:23
ph88: the problem is, it prints *both*
bennofs1 2017-01-27 06:37:21
can happy generate parsers that have non-deterministic behavior?
bennofs1 2017-01-27 06:39:59
I'm quite convinced that this is a ghc bug now
ph88 2017-01-27 06:40:06
ill test it
bennofs1 2017-01-27 06:40:21
there's no unsafe function in any of the involved functions i believe
ph88 2017-01-27 06:43:14
bennofs1, i also get Just and Nothing
pavonia 2017-01-27 06:43:44
bennofs1: It indeed seems to be a GHC bug: https://github.com/yav/pretty-show/issues/21
bennofs1 2017-01-27 06:44:52
pavonia: oh, thanks for digging that one up! that saves me quite some time