Logs: freenode/#haskell
| 2021-04-29 08:55:25 | <olligobber> | % (==) <$> try (fail "mzero") <*> (try empty :: IO (Either IOError ())) |
| 2021-04-29 08:55:26 | <yahb> | olligobber: True |
| 2021-04-29 08:55:44 | <olligobber> | I see |
| 2021-04-29 08:56:44 | <hololeap> | i would think that the issue lies in the difference between `fail "Error" <|> empty` and `empty <|> fail "Error"` |
| 2021-04-29 08:57:01 | <hololeap> | maybe someone can explain why those are different |
| 2021-04-29 08:57:34 | <enobayram> | Because <|> tries the left operand and if it throws then it tries the right operand and if that throws as well, it throws the last exception |
| 2021-04-29 08:58:06 | <hololeap> | makes sense |
| 2021-04-29 08:58:29 | <hololeap> | i assumed it would throw at the first error |
| 2021-04-29 08:58:36 | <merijn> | hololeap: heh |
| 2021-04-29 08:58:47 | <merijn> | hololeap: That'd rather defeat the point of Alternative? |
| 2021-04-29 08:59:00 | <hololeap> | good point |
| 2021-04-29 08:59:51 | × | ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 260 seconds) |
| 2021-04-29 08:59:54 | <olligobber> | yeah, throwing the first error is what `>>` does |
| 2021-04-29 09:00:03 | <enobayram> | I think if empty is supposed to be the identity element of <|>, it should be throwing an exception that <|> recognizes and then throws the exception from the other operand |
| 2021-04-29 09:00:10 | → | bennofs_ joins (~quassel@x4dbf4f4d.dyn.telefonica.de) |
| 2021-04-29 09:00:31 | <enobayram> | Though, even then, I think the Alternative IO instance is distasteful |
| 2021-04-29 09:00:47 | fendor_ | is now known as fendor |
| 2021-04-29 09:01:04 | <enobayram> | I don't think one should swallow exceptions nilly willy like that |
| 2021-04-29 09:01:12 | <olligobber> | probably |
| 2021-04-29 09:01:42 | <olligobber> | though someone once asked me to write a program that wouldn't crash, so I just added `<|> print 0` to the end of main |
| 2021-04-29 09:02:19 | × | pjb quits (~pjb@2a01cb04063ec50065c90891fe55ba7a.ipv6.abo.wanadoo.fr) (Ping timeout: 260 seconds) |
| 2021-04-29 09:02:47 | × | hiroaki quits (~hiroaki@2a02:8108:8c40:2bb8:97f0:170a:ab39:7a21) (Ping timeout: 260 seconds) |
| 2021-04-29 09:03:00 | <enobayram> | What if my program is unsafeCoerce (1 :: Int) :: IO String |
| 2021-04-29 09:03:34 | <olligobber> | % unsafeCoerce (1 :: Int) <|> pure "End" :: IO String |
| 2021-04-29 09:03:34 | <yahb> | olligobber: "[Segmentation fault] |
| 2021-04-29 09:03:52 | <olligobber> | wait what |
| 2021-04-29 09:04:15 | <enobayram> | That's what you get for messing with memory :) |
| 2021-04-29 09:04:15 | <Taneb> | Once you've segfaulted the runtime can't recover |
| 2021-04-29 09:04:25 | <Taneb> | It's not an exception, it's a things are horribly broken |
| 2021-04-29 09:04:35 | → | zariuq joins (~zar@89-24-35-159.nat.epc.tmcz.cz) |
| 2021-04-29 09:04:39 | <olligobber> | % unsafeCoerce (empty :: IO ()) :: Int |
| 2021-04-29 09:04:40 | <yahb> | olligobber: 0 |
| 2021-04-29 09:04:49 | <hololeap> | so (empty == empty) in IO, but (empty /= fail "Error") |
| 2021-04-29 09:05:05 | <olligobber> | % unsafeCoerce (print 1 :: IO ()) :: Int |
| 2021-04-29 09:05:06 | <yahb> | olligobber: 2199023255808 |
| 2021-04-29 09:05:16 | <hololeap> | this doesn't seem that surprising although i suppose it would break the Alternative laws |
| 2021-04-29 09:05:19 | × | ania123 quits (5e89ad7c@94.137.173.124) (Quit: Connection closed) |
| 2021-04-29 09:05:32 | <olligobber> | % unsafeCoerce (2199023255808 :: Int) :: IO () |
| 2021-04-29 09:05:33 | <yahb> | olligobber: |
| 2021-04-29 09:06:04 | <olligobber> | I'm surprised that didn't seg fault |
| 2021-04-29 09:06:15 | <olligobber> | I assume 2199023255808 is a pointer |
| 2021-04-29 09:07:29 | <enobayram> | I don't think one can talk about any sort of reasoning in the presence of memory corruption |
| 2021-04-29 09:07:48 | <olligobber> | no |
| 2021-04-29 09:08:03 | × | jgt_ quits (~jgt@46.154.77.142) (Remote host closed the connection) |
| 2021-04-29 09:08:15 | <enobayram> | for all you know unsafeCoerce (2199023255808 :: Int) :: IO () might have caused an earthquake somewhere |
| 2021-04-29 09:08:33 | <olligobber> | I assume the developers of yahb safeguarded against that |
| 2021-04-29 09:08:50 | <olligobber> | % readFile "/etc/passwd" |
| 2021-04-29 09:08:50 | <yahb> | olligobber: *** Exception: /etc/passwd: openFile: does not exist (No such file or directory) |
| 2021-04-29 09:08:52 | × | zariuq quits (~zar@89-24-35-159.nat.epc.tmcz.cz) (Ping timeout: 240 seconds) |
| 2021-04-29 09:09:09 | <olligobber> | looks like it |
| 2021-04-29 09:09:25 | <hololeap> | it's hard to make any assumptions in programming if we take into account hardware issues |
| 2021-04-29 09:09:41 | <enobayram> | I'm sure that's the intension, but there's no guarantee that your corrupt program didn't just discover a zero day vulnerability in their sandbox :P |
| 2021-04-29 09:09:51 | × | nehsou^ quits (nehsou@ip98-184-89-2.mc.at.cox.net) () |
| 2021-04-29 09:09:55 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 2021-04-29 09:10:11 | <olligobber> | what you're saying is I should continue to send random numbers to yahb until I find a vulnerability? |
| 2021-04-29 09:10:21 | <hololeap> | will your function terminate? what if the power goes out? |
| 2021-04-29 09:10:41 | <hololeap> | olligobber: yes |
| 2021-04-29 09:10:55 | → | hiroaki joins (~hiroaki@2a02:8108:8c40:2bb8:cd02:6757:782f:7e4d) |
| 2021-04-29 09:11:03 | <enobayram> | That's a valid interpretation! Though I was rather going for the perils of unsafeCoerce |
| 2021-04-29 09:12:38 | <olligobber> | yeah, in retrospect I'm glad I didn't test that on my own machine |
| 2021-04-29 09:12:43 | → | is_null_ joins (~jpic@pdpc/supporter/professional/is-null) |
| 2021-04-29 09:12:54 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 2021-04-29 09:13:01 | <maerwald> | yolo |
| 2021-04-29 09:13:58 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-04-29 09:14:06 | <olligobber> | I did `rm -rf ~' once, ended up just reinstalling the os from scratch |
| 2021-04-29 09:14:21 | <enobayram> | same here! |
| 2021-04-29 09:14:52 | <enobayram> | Some stupid build script interpreted my ~ from a previous command as the name of a file name |
| 2021-04-29 09:15:00 | <enobayram> | so it created a file called ~ |
| 2021-04-29 09:15:14 | <maerwald> | that's why you should always quite your filepaths |
| 2021-04-29 09:15:29 | <maerwald> | enobayram: ~ is a shellism |
| 2021-04-29 09:15:30 | <enobayram> | And my immediate reaction was rm -rf ~ |
| 2021-04-29 09:15:39 | <maerwald> | it's a valid file name indeed |
| 2021-04-29 09:15:44 | → | ania123 joins (5e89ad7c@94.137.173.124) |
| 2021-04-29 09:15:54 | × | is_null quits (~jpic@pdpc/supporter/professional/is-null) (Ping timeout: 260 seconds) |
| 2021-04-29 09:16:00 | <maerwald> | and non-shell programs that interpret ~ as HOME have a bug |
| 2021-04-29 09:16:00 | <enobayram> | Yep, but to this day I don't know how that build script received my ~ as a literal ~ |
| 2021-04-29 09:16:08 | <enobayram> | I thought the shell was supposed to replace it |
| 2021-04-29 09:16:15 | <maerwald> | did you quote it? |
| 2021-04-29 09:16:19 | <enobayram> | nope |
| 2021-04-29 09:16:54 | <olligobber> | oh yeah, using "~" as a file name actually creates a file with that name |
| 2021-04-29 09:17:10 | <olligobber> | uh, now to delete that file without deleting my home directory |
| 2021-04-29 09:17:24 | <olligobber> | rm "~" |
| 2021-04-29 09:17:33 | <maerwald> | just don't use -f :) |
| 2021-04-29 09:17:39 | → | is_null joins (~jpic@pdpc/supporter/professional/is-null) |
| 2021-04-29 09:17:46 | × | SolidusRiver quits (~fuag1@174.127.249.180) (Ping timeout: 252 seconds) |
| 2021-04-29 09:17:50 | hololeap | runs `mkdir -p ~/~/~` |
| 2021-04-29 09:17:52 | <enobayram> | Are you brave enough to run that command now? |
| 2021-04-29 09:18:09 | <olligobber> | I ran it and survived |
| 2021-04-29 09:18:25 | <enobayram> | if I were implementing a shell, I'd treat having a ~ in your command while there's a file named ~ in the current directory as an error |
| 2021-04-29 09:18:38 | × | tadeo quits (~tadeo@217.146.82.202) (Remote host closed the connection) |
| 2021-04-29 09:18:52 | <maerwald> | that's probably going to break lots of scripts |
| 2021-04-29 09:19:11 | <enobayram> | while saving many lives! |
| 2021-04-29 09:19:16 | <olligobber> | yeah, having scripts that only break if you happen to have a file with a specific name would be great |
| 2021-04-29 09:19:23 | <maerwald> | lol |
| 2021-04-29 09:19:26 | <hololeap> | that's why "-r" is a thing |
| 2021-04-29 09:19:36 | × | is_null_ quits (~jpic@pdpc/supporter/professional/is-null) (Ping timeout: 252 seconds) |
| 2021-04-29 09:19:40 | → | dsrt^ joins (dsrt@ip98-184-89-2.mc.at.cox.net) |
| 2021-04-29 09:19:49 | <maerwald> | rm --interactive |
| 2021-04-29 09:20:07 | <hololeap> | if ~/~ is a dir, that could be an issue |
| 2021-04-29 09:21:16 | <maerwald> | I don't remember if -r behave correctly if you have recursive bind-mounts. At least most file managers don't |
All times are in UTC.