Logs: freenode/#haskell
| 2020-10-07 07:11:51 | → | jinblack- joins (~JinBlack@2001:41d0:8:4b28::1) |
| 2020-10-07 07:12:30 | → | lyxia_ joins (~lyxia@poisson.chat) |
| 2020-10-07 07:12:50 | → | jluttine_ joins (~jluttine@87-95-204-180.bb.dnainternet.fi) |
| 2020-10-07 07:13:03 | × | vicfred quits (~vicfred@unaffiliated/vicfred) (Quit: Leaving) |
| 2020-10-07 07:13:03 | × | jinblack quits (~JinBlack@new.jinblack.it) (Ping timeout: 272 seconds) |
| 2020-10-07 07:13:03 | × | iteratee_ quits (~kyle@162.211.154.4) (Read error: Connection reset by peer) |
| 2020-10-07 07:13:03 | × | lyxia quits (~lyxia@poisson.chat) (Ping timeout: 272 seconds) |
| 2020-10-07 07:13:03 | × | jluttine quits (~jluttine@87-95-204-180.bb.dnainternet.fi) (Ping timeout: 272 seconds) |
| 2020-10-07 07:13:03 | × | deu quits (de@uio.re) (Ping timeout: 272 seconds) |
| 2020-10-07 07:13:23 | → | deu joins (de@uio.re) |
| 2020-10-07 07:16:29 | <dminuoso> | % setr (each . _Left) 1 [Left 'c', Left 'd', Right "foo"] -- ski |
| 2020-10-07 07:16:30 | <yahb> | dminuoso: ([1,1],[Left 1,Left 1,Right "foo"]) |
| 2020-10-07 07:16:36 | <dminuoso> | % setr :: Traversal s t a b -> b -> s -> ([b], t); setr l b = runRemember #. l (\_ -> Remember ([b], b)) |
| 2020-10-07 07:16:37 | <yahb> | dminuoso: |
| 2020-10-07 07:16:48 | <dminuoso> | % newtype Remember b t = Remember ([b], t) deriving (Eq, Ord, Functor) |
| 2020-10-07 07:16:49 | <yahb> | dminuoso: |
| 2020-10-07 07:16:59 | <dminuoso> | % instance Applicative (Remember b) where pure a = Remember ([], a); Remember (fs, f) <*> Remember (gs, g) = Remember ((fs <> gs), f g) |
| 2020-10-07 07:16:59 | <yahb> | dminuoso: |
| 2020-10-07 07:17:51 | <dminuoso> | Also for you, unclechu, ^- |
| 2020-10-07 07:18:55 | × | GyroW_ quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-07 07:19:06 | → | carlomagno1 joins (~cararell@inet-hqmc01-o.oracle.com) |
| 2020-10-07 07:19:10 | → | GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) |
| 2020-10-07 07:19:10 | × | GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host) |
| 2020-10-07 07:19:10 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 07:19:11 | <dminuoso> | It also occured to me, that you can just use (a,) instead of Remember. |
| 2020-10-07 07:19:22 | × | fredcy quits (~fredcy@mail.yankowski.com) (Quit: ZNC - http://znc.in) |
| 2020-10-07 07:19:24 | × | Graypup_ quits (Graypup@lfcode.ca) (Quit: ZNC 1.6.1 - http://znc.in) |
| 2020-10-07 07:19:38 | → | fredcy joins (~fredcy@mail.yankowski.com) |
| 2020-10-07 07:19:38 | → | Graypup__ joins (Graypup@lfcode.ca) |
| 2020-10-07 07:20:00 | × | polux2001 quits (~polux@51.15.169.172) (Quit: Ping timeout (120 seconds)) |
| 2020-10-07 07:20:01 | × | drupol quits (sid117588@gateway/web/irccloud.com/x-rynwclhcvdkvjpek) (Read error: Connection reset by peer) |
| 2020-10-07 07:20:01 | × | alexknvl quits (sid259568@gateway/web/irccloud.com/x-shhushfytlhxjajz) (Read error: Connection reset by peer) |
| 2020-10-07 07:20:05 | × | carlomagno quits (~cararell@inet-hqmc01-o.oracle.com) (Ping timeout: 240 seconds) |
| 2020-10-07 07:20:12 | → | alexknvl joins (sid259568@gateway/web/irccloud.com/x-esxzjxwhwfjmhmwu) |
| 2020-10-07 07:20:17 | → | polux2001 joins (~polux@51.15.169.172) |
| 2020-10-07 07:20:18 | → | drupol joins (sid117588@gateway/web/irccloud.com/x-botdgnvcemakmhms) |
| 2020-10-07 07:20:25 | × | abhixec quits (~abhixec@c-67-169-141-95.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2020-10-07 07:20:44 | × | vonfry quits (~user@li1870-189.members.linode.com) (Remote host closed the connection) |
| 2020-10-07 07:20:49 | <dminuoso> | % setr :: Traversal s t a b -> b -> s -> ([b], t); setr l b = l (\_ -> ([b], b)) |
| 2020-10-07 07:20:49 | <yahb> | dminuoso: |
| 2020-10-07 07:20:53 | <dminuoso> | Oh yeah, that's much much simpler. :) |
| 2020-10-07 07:21:52 | → | snakemas1 joins (~snakemast@213.100.206.23) |
| 2020-10-07 07:22:22 | <Squarism> | dminuoso, was that for me? |
| 2020-10-07 07:23:23 | <dminuoso> | No |
| 2020-10-07 07:27:08 | → | mmohammadi98126 joins (~mmohammad@5.238.172.236) |
| 2020-10-07 07:30:20 | → | raichoo joins (~raichoo@213.240.178.58) |
| 2020-10-07 07:33:33 | → | plutoniix joins (~q@175.176.222.7) |
| 2020-10-07 07:34:16 | → | justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311) |
| 2020-10-07 07:35:06 | × | GyroW quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-07 07:35:11 | → | livvy joins (~livvy@gateway/tor-sasl/livvy) |
| 2020-10-07 07:35:24 | → | GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) |
| 2020-10-07 07:35:25 | × | GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host) |
| 2020-10-07 07:35:25 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 07:41:47 | × | nineonine quits (~nineonine@50.216.62.2) (Remote host closed the connection) |
| 2020-10-07 07:41:59 | → | frot-lab joins (3b47f017@gateway/web/cgi-irc/kiwiirc.com/ip.59.71.240.23) |
| 2020-10-07 07:42:27 | × | aarvar quits (~foewfoiew@50.35.43.33) (Ping timeout: 240 seconds) |
| 2020-10-07 07:44:00 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-07 07:44:39 | <siraben> | If Foo is a newtype constructor, is map Foo a no-op? |
| 2020-10-07 07:46:10 | <dminuoso> | % newtype Foo a = Foo a |
| 2020-10-07 07:46:11 | <yahb> | dminuoso: |
| 2020-10-07 07:46:40 | <dminuoso> | siraben: I dont think so. |
| 2020-10-07 07:46:50 | <dminuoso> | But you can use coerce if you want it to be free. |
| 2020-10-07 07:46:50 | <siraben> | dminuoso: I would need to use coerce right? |
| 2020-10-07 07:46:52 | <dminuoso> | Right |
| 2020-10-07 07:47:23 | <tomsmeding> | which begs the question: why _isn't_ it a no-op? |
| 2020-10-07 07:47:23 | <siraben> | Ok |
| 2020-10-07 07:47:46 | <siraben> | tomsmeding: looks like it's in the paper https://www.microsoft.com/en-us/research/uploads/prod/2018/05/coercible-JFP.pdf |
| 2020-10-07 07:47:59 | <siraben> | The optimiser in the Glasgow Haskell Compiler (GHC) is powerless to fix the problem because it |
| 2020-10-07 07:47:59 | <siraben> | works over a typed intermediate language; the MkHTML constructor changes the type of its operand, and hence cannot be optimised away. |
| 2020-10-07 07:48:34 | <tomsmeding> | I see |
| 2020-10-07 07:48:45 | <tomsmeding> | that's unfortunate |
| 2020-10-07 07:51:19 | <tomsmeding> | still, that claim is untrue |
| 2020-10-07 07:51:27 | <tomsmeding> | the map could be replaced with a coerce! |
| 2020-10-07 07:51:31 | <tomsmeding> | and the result would still typecheck |
| 2020-10-07 07:52:06 | <tomsmeding> | that's quite a specific optimisation, but "cannot be optimised away" is too strong I think |
| 2020-10-07 07:52:19 | <siraben> | can it be optimized away without coerce |
| 2020-10-07 07:53:02 | <dminuoso> | tomsmeding: Given the 4 authors of the paper, Im quite convinced they do know what they're talking about. :p |
| 2020-10-07 07:53:10 | <tomsmeding> | dminuoso: fair point :p |
| 2020-10-07 07:53:29 | <tomsmeding> | perhaps they meant that it could not be optimised without coerce, as siraben said |
| 2020-10-07 07:53:34 | <tomsmeding> | but then now we have coerce...? :p |
| 2020-10-07 07:53:40 | <tomsmeding> | anyhow |
| 2020-10-07 07:53:58 | <dminuoso> | Well, coerce is the *result* of that paper. |
| 2020-10-07 07:53:59 | <siraben> | tomsmeding: the paper is about implementing coerce... |
| 2020-10-07 07:54:04 | <tomsmeding> | I know! |
| 2020-10-07 07:54:19 | → | borne joins (~fritjof@2001:638:708:30da:5a9f:5f48:16a:a1d1) |
| 2020-10-07 07:54:21 | <tomsmeding> | I'm asking about now, 4 years after that paper :p |
| 2020-10-07 07:54:32 | <siraben> | I think claim is still true then? Seems like you would have to insert coerce manually |
| 2020-10-07 07:54:33 | <tomsmeding> | why map Foo is apparently not a no-op |
| 2020-10-07 07:54:35 | <siraben> | Would have to check GHC Core to be sure. |
| 2020-10-07 07:54:53 | <tomsmeding> | so my core (heh) question is, why doesn't ghc insert a coerce as an optimisation |
| 2020-10-07 07:55:48 | <siraben> | fmap Foo is a no-op because of the functor law, right? |
| 2020-10-07 07:55:55 | <siraben> | fmap id = idF |
| 2020-10-07 07:56:11 | <dminuoso> | 09:55:48 siraben | fmap Foo is a no-op because of the functor law, right? |
| 2020-10-07 07:56:18 | <dminuoso> | GHC does not use these laws. |
| 2020-10-07 07:56:26 | <dminuoso> | It cant because it doesn't know whether they are even satisfied. |
| 2020-10-07 07:57:05 | <dminuoso> | (This is why things like Co/Yoneda are so useful, because they help GHC fuse without knowing about functor laws) |
| 2020-10-07 07:57:29 | × | cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 265 seconds) |
| 2020-10-07 07:57:50 | <siraben> | Ah I have not used the yoneda library |
| 2020-10-07 07:58:06 | <dminuoso> | So it'd have to reconstruct that knowledge from the definition of map (if its inlined at all!) |
| 2020-10-07 07:58:21 | <dminuoso> | And I dont know whether GHC can do that at all. |
All times are in UTC.