Logs: freenode/#haskell
| 2020-10-07 07:58:22 | → | bor0 joins (~boro@unaffiliated/boro/x-000000001) |
| 2020-10-07 07:58:43 | <dminuoso> | So, for all GHC knows, `map Foo` could change the length of a list for example. |
| 2020-10-07 07:59:35 | <dminuoso> | In some trivial cases GHC can figure this out for sure. But once you get into recursive definitions, I think it starts to get slippery. |
| 2020-10-07 08:00:08 | <dminuoso> | So perhaps `fmap Foo` might be a no-op for Identity |
| 2020-10-07 08:00:27 | <dminuoso> | (Again, if the definition of fmap is inlined at all) |
| 2020-10-07 08:00:48 | → | jonatanb joins (~jonatanb@79.184.190.239.ipv4.supernova.orange.pl) |
| 2020-10-07 08:00:52 | <tomsmeding> | > `map Foo` could change the length for example | indeed, this is quite an involved optimisation that would have to inspect the definition of 'map' |
| 2020-10-07 08:00:55 | <lambdabot> | <hint>:1:1: error: <hint>:1:1: error: parse error on input ‘`’ |
| 2020-10-07 08:00:59 | → | CheRRy2fly21 joins (~CheRRy@129.205.112.30) |
| 2020-10-07 08:00:59 | <tomsmeding> | that's a fair point |
| 2020-10-07 08:01:40 | <tomsmeding> | for the trivial program: newtype Foo a = Foo a deriving (Show) ; main = getContents >>= print . map Foo . lines |
| 2020-10-07 08:01:49 | <tomsmeding> | ghc -ddump-simpl does seem to introduce a `cast` |
| 2020-10-07 08:02:10 | → | chaosmasttter joins (~chaosmast@p200300c4a70b400140e8baf6489c3871.dip0.t-ipconnect.de) |
| 2020-10-07 08:02:40 | frot-lab | is now known as hungrydonkey |
| 2020-10-07 08:02:48 | <tomsmeding> | https://paste.tomsmeding.com/fzcokv87 |
| 2020-10-07 08:03:36 | <tomsmeding> | (that's the only definition in the -ddump-simpl output that contains a call to 'lines', to sort-of justify exclusion of all the rest) |
| 2020-10-07 08:04:12 | <dminuoso> | Well you cant trust GHC to do this in all the places. So if you really need this to be free, just coerce. |
| 2020-10-07 08:04:28 | <dminuoso> | I'd be interested in how GHC knows that cast is appropriate here. |
| 2020-10-07 08:04:28 | × | GyroW quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-07 08:04:34 | <dminuoso> | Perhaps it's special cased for map? |
| 2020-10-07 08:04:48 | → | GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) |
| 2020-10-07 08:04:49 | × | GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host) |
| 2020-10-07 08:04:49 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 08:05:00 | <dminuoso> | Since GHC can know that map at least satisfies functor laws. |
| 2020-10-07 08:05:14 | <tomsmeding> | perhaps |
| 2020-10-07 08:05:21 | <dminuoso> | What happens if you use fmap instead of map? |
| 2020-10-07 08:05:33 | <dminuoso> | Oh well, that might not be helpfujl |
| 2020-10-07 08:05:48 | <dminuoso> | https://hackage.haskell.org/package/base-4.14.0.0/docs/src/GHC.Base.html#line-1115 |
| 2020-10-07 08:05:54 | <dminuoso> | Yeah no that wont help, it'll just get inlined |
| 2020-10-07 08:06:13 | <tomsmeding> | same output :p |
| 2020-10-07 08:06:28 | <dminuoso> | What if you had `IO [Something]` and `fmap . fmap` with that? |
| 2020-10-07 08:06:32 | → | yoneda joins (~mike@193.206.102.122) |
| 2020-10-07 08:07:48 | <tomsmeding> | I re-implemented map as map2 and called that instead, and now I _think_ the cast is gone? |
| 2020-10-07 08:07:56 | <tomsmeding> | like, there still is a cast, but it also explicitly calls map2 |
| 2020-10-07 08:08:05 | × | todda7 quits (~torstein@ppp141255053143.access.hol.gr) (Ping timeout: 240 seconds) |
| 2020-10-07 08:08:21 | <tomsmeding> | https://paste.tomsmeding.com/gdJrKr2U |
| 2020-10-07 08:09:30 | <tomsmeding> | dminuoso: for 'main = fmap (fmap Foo) (fmap lines getContents) >>= print', same output as the original case, so map is elided |
| 2020-10-07 08:09:55 | × | falafel quits (~falafel@2605:e000:1527:d491:1ccf:5c8d:7928:e9cc) (Ping timeout: 240 seconds) |
| 2020-10-07 08:10:10 | → | cpressey joins (~cpressey@88.144.95.3) |
| 2020-10-07 08:11:32 | × | Sgeo quits (~Sgeo@ool-18b982ad.dyn.optonline.net) (Read error: Connection reset by peer) |
| 2020-10-07 08:12:52 | <dminuoso> | Well, it's good to know that for the `IO [A]` case it gets optimized away. That's nice to hear, since getting a coerce in can create some additional undesirable noise. |
| 2020-10-07 08:13:29 | <dminuoso> | I frequently have that problem when working with postgresql-simple, say for some (query ...) :: IO [Only Int] |
| 2020-10-07 08:13:44 | <dminuoso> | Never bothered to analyze core because it was just an annoyance, not a performance issue. |
| 2020-10-07 08:13:45 | × | bahamas quits (~lucian@unaffiliated/bahamas) (Ping timeout: 240 seconds) |
| 2020-10-07 08:17:54 | × | Clough quits (~Cain@27-33-147-252.static.tpgi.com.au) (Read error: Connection reset by peer) |
| 2020-10-07 08:19:19 | → | mmohammadi981266 joins (~mmohammad@5.115.44.157) |
| 2020-10-07 08:19:23 | × | GyroW quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
| 2020-10-07 08:19:33 | → | GyroW joins (~GyroW@d54C03E98.access.telenet.be) |
| 2020-10-07 08:19:33 | × | GyroW quits (~GyroW@d54C03E98.access.telenet.be) (Changing host) |
| 2020-10-07 08:19:33 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 08:20:53 | × | mmohammadi98126 quits (~mmohammad@5.238.172.236) (Ping timeout: 260 seconds) |
| 2020-10-07 08:21:09 | <dminuoso> | maerwald: https://gist.github.com/dminuoso/daa633ce513a71b5df3bfef0c0b41e5c |
| 2020-10-07 08:21:18 | <dminuoso> | I feel being lied to. |
| 2020-10-07 08:21:43 | → | bahamas joins (~lucian@188.24.181.166) |
| 2020-10-07 08:21:43 | × | bahamas quits (~lucian@188.24.181.166) (Changing host) |
| 2020-10-07 08:21:43 | → | bahamas joins (~lucian@unaffiliated/bahamas) |
| 2020-10-07 08:21:58 | <maerwald> | dminuoso: ghcup set ghc 8.6.5 |
| 2020-10-07 08:22:17 | <dminuoso> | Ah. :> |
| 2020-10-07 08:22:20 | <maerwald> | both commands shouldn't even parse |
| 2020-10-07 08:22:25 | <dminuoso> | They do! |
| 2020-10-07 08:22:28 | × | sw1nn quits (~sw1nn@2a00:23c6:2385:3a00:f5c5:6984:9c64:d791) (Quit: WeeChat 2.9) |
| 2020-10-07 08:22:32 | <dminuoso> | The install even worked that wa |
| 2020-10-07 08:22:38 | <maerwald> | that's because the version parser is too lax |
| 2020-10-07 08:22:41 | <dminuoso> | heh |
| 2020-10-07 08:22:51 | <dminuoso> | [ Error ] NotInstalled GHC "8.6.5" |
| 2020-10-07 08:22:59 | × | xerox_ quits (~xerox@unaffiliated/xerox) (Ping timeout: 240 seconds) |
| 2020-10-07 08:23:02 | <dminuoso> | The diagnostic suggested that `ghc set ghc-8.6.5` was parsed properly |
| 2020-10-07 08:23:15 | <maerwald> | read the second line of the output :) |
| 2020-10-07 08:23:23 | <dminuoso> | Sure, but that reads more like a deprecation notice |
| 2020-10-07 08:23:45 | <dminuoso> | But anyhow, cheers. |
| 2020-10-07 08:23:50 | → | sw1nn joins (~sw1nn@host86-173-104-87.range86-173.btcentralplus.com) |
| 2020-10-07 08:24:09 | <maerwald> | I'm not even sure why the first one succeeds |
| 2020-10-07 08:25:32 | → | xerox_ joins (~xerox@unaffiliated/xerox) |
| 2020-10-07 08:26:07 | × | mmohammadi981266 quits (~mmohammad@5.115.44.157) (Ping timeout: 258 seconds) |
| 2020-10-07 08:26:21 | × | CheRRy2fly21 quits (~CheRRy@129.205.112.30) (Ping timeout: 260 seconds) |
| 2020-10-07 08:28:15 | × | hungrydonkey quits (3b47f017@gateway/web/cgi-irc/kiwiirc.com/ip.59.71.240.23) (Quit: Connection closed) |
| 2020-10-07 08:28:38 | × | justsomeguy quits (~justsomeg@unaffiliated/--/x-3805311) () |
| 2020-10-07 08:28:57 | <maerwald> | dminuoso: I think you just made ghcup believe that is a cross-compiler :) |
| 2020-10-07 08:29:52 | <maerwald> | ghcup install bar-8.6.3 # works as well |
| 2020-10-07 08:30:40 | <maerwald> | the pre-version part is assumed to be a triple like armv7-unknown-linux-gnueabihf |
| 2020-10-07 08:30:41 | → | frot-lab joins (3b47f017@gateway/web/cgi-irc/kiwiirc.com/ip.59.71.240.23) |
| 2020-10-07 08:30:56 | → | mmohammadi981266 joins (~mmohammad@5.238.172.236) |
| 2020-10-07 08:33:18 | <dminuoso> | GHC is a pretty obscure architecture |
| 2020-10-07 08:33:29 | <dminuoso> | :P |
| 2020-10-07 08:33:44 | <dminuoso> | Btw, that triple has 4 parts to it! |
| 2020-10-07 08:33:47 | × | darjeeling_ quits (~darjeelin@112.16.171.8) (Ping timeout: 240 seconds) |
| 2020-10-07 08:36:27 | × | Mlpearc quits (~Mlpearc@178.239.168.171) (Remote host closed the connection) |
| 2020-10-07 08:37:19 | → | GyroW_ joins (~GyroW@d54C03E98.access.telenet.be) |
| 2020-10-07 08:37:19 | × | GyroW_ quits (~GyroW@d54C03E98.access.telenet.be) (Changing host) |
| 2020-10-07 08:37:19 | → | GyroW_ joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 08:37:44 | × | GyroW quits (~GyroW@unaffiliated/gyrow) (Ping timeout: 272 seconds) |
| 2020-10-07 08:39:24 | → | kuribas joins (~user@ptr-25vy0i76pxhcqkyum1g.18120a2.ip6.access.telenet.be) |
| 2020-10-07 08:42:39 | × | shatriff quits (~vitaliish@217.27.153.240) (Remote host closed the connection) |
| 2020-10-07 08:43:20 | → | shatriff joins (~vitaliish@217.27.153.240) |
| 2020-10-07 08:44:27 | → | GyroW joins (~GyroW@d54C03E98.access.telenet.be) |
| 2020-10-07 08:44:27 | × | GyroW quits (~GyroW@d54C03E98.access.telenet.be) (Changing host) |
| 2020-10-07 08:44:27 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
| 2020-10-07 08:44:45 | × | GyroW_ quits (~GyroW@unaffiliated/gyrow) (Ping timeout: 240 seconds) |
| 2020-10-07 08:44:45 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-07 08:45:15 | → | thc202 joins (~thc202@unaffiliated/thc202) |
All times are in UTC.