Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-17 16:57:03 <koz_> Come up with a simple (as in, two lines) input with indentation.
2021-03-17 16:57:06 <koz_> One correct, one wrong.
2021-03-17 16:57:11 <koz_> And try and write a parser for that.
2021-03-17 16:57:17 <koz_> Such that the right one parses, and the wrong one errors.
2021-03-17 16:57:23 <koz_> _Then_ try to generalize.
2021-03-17 16:57:24 <shapr> jumper149: do you have blucontrol hooked into your nix setup as a user level service?
2021-03-17 16:57:25 × cuz quits (~user@38.140.58.234) (Ping timeout: 276 seconds)
2021-03-17 16:57:42 <shapr> aw, Jordandave23 didn't want to re-learn Haskell after all :-(
2021-03-17 16:57:43 × Sorny quits (~Sornaensi@79.142.232.102) (Ping timeout: 260 seconds)
2021-03-17 16:57:49 <dhruvasagar> koz_: ok, thanks for your help
2021-03-17 16:58:16 <jumper149> shapr: I simply call it in my .xprofile https://github.com/jumper149/dotfiles/blob/master/.xprofile#L22
2021-03-17 16:58:33 × Sornaensis quits (~Sornaensi@077213203030.dynamic.telenor.dk) (Ping timeout: 256 seconds)
2021-03-17 16:58:44 <koz_> (ok, maybe three lines)
2021-03-17 16:58:55 <koz_> (but the point is, it should be fairly short and mostly about the indentation)
2021-03-17 16:59:00 <shapr> jumper149: ah, thanks
2021-03-17 16:59:02 × Boomerang quits (~Boomerang@2a05:f6c7:2179:0:c023:32c1:e407:f7a0) (Ping timeout: 265 seconds)
2021-03-17 16:59:08 <jumper149> Never had it crash so I never felt the need to write a service. It would be cool to have though
2021-03-17 16:59:55 <bobweb> koz_: Yes, I resolved the previous issue by not trying to access the elements inside the data constructor: that was the part of the exercise that I was misunderstanding. In the present issue, (<>) is supposed to return the first (Snd x) value (or the right-most value if both are (Fst _). So """Fst 1 <> Snd 2""" should just return """Snd 2""" as
2021-03-17 16:59:55 <bobweb> there is no manipulation of the data variables (1 and 2, in this case). E.G., """Fst 1""" returns """Fst 1""" and """Snd 2""" returns """Snd 2""", no problem because the (Or a b) type derives Show. So why does """Fst 1 <> Snd 2""" refuse to show """Snd 2"""?
2021-03-17 17:00:38 howdoi joins (uid224@gateway/web/irccloud.com/x-dtnuksdjtbsicedj)
2021-03-17 17:00:42 <koz_> bobweb: Again, firstly what geekosaur mentioned. Secondly, since I can't see the code for the tests themselves, it's very difficult for me to say anything.
2021-03-17 17:00:55 <koz_> The thing you're pasting that it's running doesn't have strings in it.
2021-03-17 17:00:55 <jumper149> shapr: And I also have this https://github.com/jumper149/dotfiles/blob/master/.xprofile#L22
2021-03-17 17:01:00 <koz_> (or Strings, same diff)
2021-03-17 17:01:14 <jumper149> shapr: wrong link: https://github.com/jumper149/dotfiles/blob/nixos/.config/nixpkgs/overlays-custom/main.nix#L47
2021-03-17 17:04:01 specdrake joins (~anurag@111.223.26.138)
2021-03-17 17:05:23 Ishutin joins (~ishutin@94-21-131-78.pool.digikabel.hu)
2021-03-17 17:05:46 <shapr> ah, that's the kind of thing I need
2021-03-17 17:07:12 <jumper149> shapr: I might as well just make a PR for nixpkgs. :D
2021-03-17 17:07:18 RandomArcher joins (~RandomArc@90.153.186.31)
2021-03-17 17:07:31 <jumper149> The derivation is already done anyways
2021-03-17 17:08:13 notzmv joins (~zmv@unaffiliated/zmv)
2021-03-17 17:08:13 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-17 17:08:23 × Ishutin_ quits (~ishutin@77-234-64-188.pool.digikabel.hu) (Ping timeout: 245 seconds)
2021-03-17 17:08:36 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-17 17:10:35 jumper149 puts it into nixpkgs right now :)
2021-03-17 17:10:37 <shapr> jumper149: yay!
2021-03-17 17:10:45 × specdrake quits (~anurag@111.223.26.138) (Remote host closed the connection)
2021-03-17 17:11:46 solidus-river joins (~mike@174.127.249.180)
2021-03-17 17:11:59 × kritzefitz quits (~kritzefit@fw-front.credativ.com) (Remote host closed the connection)
2021-03-17 17:13:01 augnun joins (~augnun@2804:14c:658b:41bb:57d:9776:9e3e:4447)
2021-03-17 17:13:03 × CoconutCrab quits (~Cua@unaffiliated/coconutcrab) (Ping timeout: 244 seconds)
2021-03-17 17:14:27 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed)
2021-03-17 17:14:51 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-03-17 17:16:12 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2021-03-17 17:16:23 hackage musicw 0.3.8 - Sound synthesis library, to be used with GHCJS and Web Audio API https://hackage.haskell.org/package/musicw-0.3.8 (dktr0)
2021-03-17 17:17:55 × exarkun quits (~exarkun@14.79.69.34.bc.googleusercontent.com) (Excess Flood)
2021-03-17 17:18:15 exarkun joins (~exarkun@14.79.69.34.bc.googleusercontent.com)
2021-03-17 17:18:36 × RandomArcher quits (~RandomArc@90.153.186.31) (Ping timeout: 246 seconds)
2021-03-17 17:18:57 × notzmv quits (~zmv@unaffiliated/zmv) (Ping timeout: 246 seconds)
2021-03-17 17:19:24 × rprospero quits (~adam@186.75.232.35.bc.googleusercontent.com) (Quit: ZNC 1.7.5 - https://znc.in)
2021-03-17 17:19:31 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 256 seconds)
2021-03-17 17:19:40 rprospero joins (~adam@186.75.232.35.bc.googleusercontent.com)
2021-03-17 17:20:06 × heatsink quits (~heatsink@2600:1700:bef1:5e10:f837:3533:97b:1f44) (Remote host closed the connection)
2021-03-17 17:20:34 × pjb quits (~t@2a01cb04063ec50044b6cbec1ec8dc3b.ipv6.abo.wanadoo.fr) (Read error: Connection reset by peer)
2021-03-17 17:22:32 conal joins (~conal@64.71.133.70)
2021-03-17 17:24:07 <bobweb> Here is an expanded and annotated version of my issue: https://paste.tomsmeding.com/ Basically everything works except that (<>) won't print e.g., Fst 1 <> Snd 2 returns an error instead of returning Snd 2. As (<>) on (Or a b = Fst a | Snd b deriving (Eq, Show))  is not defined to operate on the x in Snd x, it should have no problem printing (by
2021-03-17 17:24:08 <bobweb> my understanding). Thanks.
2021-03-17 17:25:11 romesrf joins (~romesrf@44.190.189.46.rev.vodafone.pt)
2021-03-17 17:25:35 × romesrf quits (~romesrf@44.190.189.46.rev.vodafone.pt) (Client Quit)
2021-03-17 17:25:39 <geekosaur> the error message you showed earlier was about defaulting, which is why I suggested ExtendedDefaultRules to get around it. (also your link above is wrong, it's the URL of the paste site and not of a paste)
2021-03-17 17:25:55 romesrf joins (~romesrf@44.190.189.46.rev.vodafone.pt)
2021-03-17 17:26:12 hyperisco joins (~hyperisco@d192-186-117-226.static.comm.cgocable.net)
2021-03-17 17:26:46 <geekosaur> in the absence of ExtendedDefaultRules, ghc can't see through Semigroup to see that the thing inside it has a type with a Show instance
2021-03-17 17:26:51 <bobweb> geekosaur: Oops! Sorry. Here: https://paste.tomsmeding.com/t2eAq6e2
2021-03-17 17:27:34 <geekosaur> interesting, that's in ghci so ExtendedDefaultRules isn't enough
2021-03-17 17:28:28 <bobweb> The author expects that this should be a simple exercise, I think.
2021-03-17 17:28:28 <geekosaur> I'm betting it works if you give 2 an explicit type, though
2021-03-17 17:28:40 sam9000 joins (~samrudhku@150.129.88.87)
2021-03-17 17:28:45 <bobweb> Yes, as long as its a string.
2021-03-17 17:28:50 <geekosaur> maybe you turn ExtendedDefaultRules off in a .ghci file?
2021-03-17 17:28:58 <sam9000> exit
2021-03-17 17:29:01 × sam9000 quits (~samrudhku@150.129.88.87) (Quit: leaving)
2021-03-17 17:29:21 <geekosaur> Snd (2 :: Int) -- should also work
2021-03-17 17:29:38 <geekosaur> or :: Integer if you prefer
2021-03-17 17:29:58 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2021-03-17 17:30:31 <geekosaur> conversely strings would stop working if you enabled OverloadedStrings
2021-03-17 17:31:02 <bobweb> See errors here: https://paste.tomsmeding.com/4djxlyKQ
2021-03-17 17:31:30 × romesrf quits (~romesrf@44.190.189.46.rev.vodafone.pt) (Quit: WeeChat 3.1)
2021-03-17 17:31:33 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds)
2021-03-17 17:31:42 × Major_Biscuit quits (~Major_Bis@82-169-100-198.biz.kpn.net) (Ping timeout: 265 seconds)
2021-03-17 17:31:56 <geekosaur> oh, hm, right, so it's actually using some other instance there. or failing to find an instance at all and reporting it poorly
2021-03-17 17:32:51 <bobweb> I'm in Stack project if that matters...
2021-03-17 17:33:04 <geekosaur> (it shouldn't even reach Show if it has no Num instance for something with a Semigroup instance, but most things with Num instances have at least two possible Semigroups and neither one is better than the other so ghc refuses to pick one as "the" Semigroup)
2021-03-17 17:33:46 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-17 17:33:47 fuzzypixelz joins (2ec10464@eth-west-pareq2-46-193-4-100.wb.wifirst.net)
2021-03-17 17:33:49 <geekosaur> (Sum and Product to be specific)
2021-03-17 17:34:34 conal joins (~conal@64.71.133.70)
2021-03-17 17:34:45 <geekosaur> did the earlier exercise have you specify a Monoid or Semigroup instance for any other type than Or?
2021-03-17 17:35:24 × motherfsck quits (~motherfsc@unaffiliated/motherfsck) (Quit: quit)
2021-03-17 17:35:25 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-17 17:35:27 <geekosaur> because, as I said, ghc doesn't pick either Sum or Produce by default as "the" Monoid or Semigroup over any Num instance
2021-03-17 17:35:39 <geekosaur> but the code you showed assumes one has been picked somehow
2021-03-17 17:35:41 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-17 17:36:12 <geekosaur> or maybe they provide a different Num instance somewhere
2021-03-17 17:38:30 <monochrom> There are multiple problems forbidding "Fst 1 <> Snd 2" to work automatically, even after extended defaults and type annotations.
2021-03-17 17:38:48 <geekosaur> yes
2021-03-17 17:38:56 × thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 240 seconds)
2021-03-17 17:39:39 thc202 joins (~thc202@unaffiliated/thc202)
2021-03-17 17:39:40 <monochrom> One issue is you're now looking for a type X such that X is an instance of Num and Semigroup. (Show is too easy.) There is none.

All times are in UTC.