Logs: freenode/#haskell
| 2020-09-21 15:33:11 | <siraben> | phadej: Bracket pattern is like RAII in C++ and Rust? |
| 2020-09-21 15:33:14 | <merijn> | siraben: I like the idea of that, but I'm not sure about the reality :p |
| 2020-09-21 15:33:19 | <phadej> | (in fact explicitly unsolved, IIRC) |
| 2020-09-21 15:33:29 | <merijn> | siraben: IndexedMonads might be a better solution for a "better bracket", tbh |
| 2020-09-21 15:33:38 | <siraben> | phadej: How do they interact? I know that Rust does not have exceptions but I wonder if it's do to the theoretical limitations. |
| 2020-09-21 15:33:46 | <merijn> | But I don't see Haskell en masse adopting indexed monads :p |
| 2020-09-21 15:33:46 | <siraben> | IndexedMonads is a language extension? |
| 2020-09-21 15:33:56 | <merijn> | siraben: that's a missing space ;) |
| 2020-09-21 15:34:06 | <phadej> | I think someone have to do a bit of homework at this point ;) |
| 2020-09-21 15:34:11 | → | eric___ joins (~eric@2804:431:c7d4:a280:a420:f119:9a1a:c48) |
| 2020-09-21 15:34:41 | × | eric_ quits (~eric@2804:431:c7d4:402a:842:24e2:eb65:718) (Ping timeout: 246 seconds) |
| 2020-09-21 15:34:58 | <phadej> | I don't know what mechanism Rust uses to report division by zero errors |
| 2020-09-21 15:34:59 | <phadej> | e.g. |
| 2020-09-21 15:35:05 | <siraben> | Oh, it's like the LockM monad in https://www.cs.tufts.edu/comp/150FP/archive/simon-peyton-jones/typefun.pdf |
| 2020-09-21 15:35:06 | <siraben> | indexed monads, that is |
| 2020-09-21 15:35:07 | <phadej> | so I cannot comment further |
| 2020-09-21 15:35:31 | <siraben> | phadej: it panics |
| 2020-09-21 15:35:34 | <siraben> | so, stack unwind |
| 2020-09-21 15:35:39 | <merijn> | siraben: indexed monads would be "(>>>=) :: IxMonad m => m i j a -> (a -> m j k b) -> m i k b" |
| 2020-09-21 15:35:49 | → | coffeeturtle joins (~coffeetur@cpc103420-donc13-2-0-cust24.17-1.cable.virginm.net) |
| 2020-09-21 15:35:55 | → | mastarija joins (~mastarija@93-142-74-181.adsl.net.t-com.hr) |
| 2020-09-21 15:36:00 | × | mastarija quits (~mastarija@93-142-74-181.adsl.net.t-com.hr) (Client Quit) |
| 2020-09-21 15:36:02 | <merijn> | siraben: And then you can use i/j/k etc. to encode "file descript is open" file descriptor is closed, etc. |
| 2020-09-21 15:36:07 | <phadej> | siraben: can you recover from panics? |
| 2020-09-21 15:36:17 | <siraben> | phadej: no |
| 2020-09-21 15:36:21 | <siraben> | merijn: right |
| 2020-09-21 15:36:29 | <siraben> | panics are like error in Haskell, I suppose |
| 2020-09-21 15:36:36 | <phadej> | you can catch `error` in Haskell |
| 2020-09-21 15:36:55 | <phadej> | or just let the thread die (but not the whole program) |
| 2020-09-21 15:37:13 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 246 seconds) |
| 2020-09-21 15:37:37 | × | acidjnk_new2 quits (~acidjnk@p200300d0c73658819d57354728142a5b.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
| 2020-09-21 15:37:41 | × | coffeeturtle quits (~coffeetur@cpc103420-donc13-2-0-cust24.17-1.cable.virginm.net) (Remote host closed the connection) |
| 2020-09-21 15:37:55 | <phadej> | :t error |
| 2020-09-21 15:37:57 | <lambdabot> | [Char] -> a |
| 2020-09-21 15:37:58 | <siraben> | heh, well technically you can catch panics in Rust, but it's definitely not recommended https://doc.rust-lang.org/beta/std/panic/fn.catch_unwind.html |
| 2020-09-21 15:38:02 | → | coffeeturtle joins (~coffeetur@cpc103420-donc13-2-0-cust24.17-1.cable.virginm.net) |
| 2020-09-21 15:38:09 | <phadej> | :t throwIO . userError |
| 2020-09-21 15:38:11 | <lambdabot> | String -> IO a |
| 2020-09-21 15:38:18 | <phadej> | :t throw . userError |
| 2020-09-21 15:38:20 | <lambdabot> | String -> c |
| 2020-09-21 15:38:27 | × | suppi quits (~suppi@2605:f700:40:c00::e6fc:6842) (Ping timeout: 260 seconds) |
| 2020-09-21 15:38:30 | <phadej> | error = throw . userError |
| 2020-09-21 15:38:37 | <phadej> | you can try to catch them in IO then |
| 2020-09-21 15:39:10 | <phadej> | which is e.g. useful when you write a web-server framework, so you can log how users' buggy handlers failed |
| 2020-09-21 15:39:31 | <siraben> | https://users.cs.northwestern.edu/~jesse/pubs/substructural-control/CtlURAL.pdf comes up when I search for linear types and exceptions |
| 2020-09-21 15:39:40 | <siraben> | "In short, exceptions and linear types refuse to get along, because linear types make promises that exceptions do not let them keep." |
| 2020-09-21 15:39:49 | <siraben> | But in an affine system apparently this is alright, just drop the variables. |
| 2020-09-21 15:40:20 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-09-21 15:40:28 | <phadej> | yes. |
| 2020-09-21 15:40:44 | <phadej> | this is why I said that LinearHaskell + exceptions is unsolved problem |
| 2020-09-21 15:41:25 | <phadej> | one can be optimistic and think "we need an implementation to see how things fit (or not fit) together, so we can develop LinearHaskell further" |
| 2020-09-21 15:41:39 | <phadej> | or you can be pessimistic and just declare upfront "it won't work" |
| 2020-09-21 15:41:40 | <phadej> | :) |
| 2020-09-21 15:41:50 | × | chele quits (~chele@ip5b416ea2.dynamic.kabel-deutschland.de) (Ping timeout: 256 seconds) |
| 2020-09-21 15:41:55 | → | pingiun joins (~pingiun@ip-213-124-184-182.ip.prioritytelecom.net) |
| 2020-09-21 15:42:22 | <siraben> | Hehe |
| 2020-09-21 15:42:25 | <phadej> | IMHO anyone who says *now* that LinearHaskell will solve any problem is just selling you a hype. |
| 2020-09-21 15:42:38 | <phadej> | yeah, it might solve a problem, but give you dozen new ones. |
| 2020-09-21 15:42:40 | <siraben> | Why emphasis on now? |
| 2020-09-21 15:42:44 | <siraben> | Ah, right. |
| 2020-09-21 15:42:45 | <Taneb> | It might solve the problem of "I would like another thing to mess around with" |
| 2020-09-21 15:43:11 | <siraben> | I'm not expecting it to solve problems immediately, but linear types are interesting and I'd like to mess around with them, heh. |
| 2020-09-21 15:43:18 | × | kenran quits (~maier@b2b-37-24-119-190.unitymedia.biz) (Ping timeout: 256 seconds) |
| 2020-09-21 15:43:18 | → | revprez_anzio joins (~revprez_a@pool-108-49-213-40.bstnma.fios.verizon.net) |
| 2020-09-21 15:43:22 | <phadej> | Taneb: that can be fun :) |
| 2020-09-21 15:43:24 | <siraben> | AffineHaskell, anyone? |
| 2020-09-21 15:43:56 | × | bahamas quits (~lucian@unaffiliated/bahamas) (Ping timeout: 272 seconds) |
| 2020-09-21 15:45:25 | → | vdiazroa joins (578036c2@p578036c2.dip0.t-ipconnect.de) |
| 2020-09-21 15:45:28 | → | mmohammadi98129 joins (~mmohammad@2.178.188.114) |
| 2020-09-21 15:45:38 | × | Chi1thangoo quits (~Chi1thang@87.112.60.168) (Remote host closed the connection) |
| 2020-09-21 15:45:49 | × | mmohammadi9812 quits (~mmohammad@2.178.188.114) (Ping timeout: 265 seconds) |
| 2020-09-21 15:45:49 | mmohammadi98129 | is now known as mmohammadi9812 |
| 2020-09-21 15:47:16 | → | cole-h joins (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) |
| 2020-09-21 15:49:41 | × | nbloomf quits (~nbloomf@2600:1700:83e0:1f40:c87d:6f52:4c16:4130) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-09-21 15:49:43 | → | wroathe joins (~wroathe@c-73-24-27-54.hsd1.mn.comcast.net) |
| 2020-09-21 15:50:16 | × | cr3 quits (~cr3@192-222-143-195.qc.cable.ebox.net) (Ping timeout: 272 seconds) |
| 2020-09-21 15:50:56 | <phadej> | GHC-9.2 will change the syntax for linear arrows, so at least that should make it clear that LinearHaskell is very experimental feature ;) |
| 2020-09-21 15:51:54 | <dolio> | Presumably the emphasis is due to, right now, no one having any significant experience actually designing things with LinearHaskell, so any claims about what it will solve are just speculation. |
| 2020-09-21 15:52:07 | <phadej> | yes |
| 2020-09-21 15:52:18 | → | qwerty joins (59b76b94@a89-183-107-148.net-htp.de) |
| 2020-09-21 15:52:25 | → | ph88_ joins (~ph88@2a02:8109:9e40:2704:a1b2:872a:487a:52ae) |
| 2020-09-21 15:52:31 | × | eric___ quits (~eric@2804:431:c7d4:a280:a420:f119:9a1a:c48) (Read error: Connection reset by peer) |
| 2020-09-21 15:52:35 | <phadej> | obviously authors claim it will solve all problems ;) |
| 2020-09-21 15:52:43 | qwerty | is now known as qwerty123 |
| 2020-09-21 15:52:57 | qwerty123 | is now known as qwerty93 |
| 2020-09-21 15:53:03 | <dolio> | Even the authors mostly have toy examples from research papers and blog posts. |
| 2020-09-21 15:53:09 | → | eric_ joins (~eric@2804:431:c7d4:a280:a420:f119:9a1a:c48) |
| 2020-09-21 15:54:00 | × | coffeeturtle quits (~coffeetur@cpc103420-donc13-2-0-cust24.17-1.cable.virginm.net) (Quit: leaving) |
| 2020-09-21 15:54:09 | <phadej> | the implicit claim? is that you examples generalise |
| 2020-09-21 15:54:15 | <phadej> | s/you/toy/ |
| 2020-09-21 15:54:18 | × | utopic_int0x80 quits (~lucid_0x8@188.253.235.98) (Quit: Leaving) |
| 2020-09-21 15:54:30 | <phadej> | but in this case it is not obvious |
| 2020-09-21 15:55:23 | → | plutoniix joins (~q@ppp-27-55-67-24.revip3.asianet.co.th) |
| 2020-09-21 15:56:21 | → | nikosky joins (ba0e194f@186.14.25.79) |
| 2020-09-21 15:56:29 | × | ph88^ quits (~ph88@2a02:8109:9e40:2704:3dae:c0b9:eddf:4cf0) (Ping timeout: 272 seconds) |
| 2020-09-21 15:56:56 | <qwerty93> | I want to write a function `mycatch :: a -> Either String a` which returns its argument if no error was thrown and otherwise the error message. For example, `mycatch ((error "asd")::Int)` should return `Left "asd"`. How can this be done with `unsafePerformIO`? |
| 2020-09-21 15:57:28 | <dminuoso> | qwerty93: That is not possible in standard haskell/ |
| 2020-09-21 15:57:36 | × | cpressey quits (~cpressey@79-65-248-204.host.pobb.as13285.net) (Quit: WeeChat 1.9.1) |
| 2020-09-21 15:57:36 | <dminuoso> | You have to do this in IO |
| 2020-09-21 15:57:42 | → | nbloomf joins (~nbloomf@2600:1700:83e0:1f40:f82a:5e5e:a65a:42ad) |
All times are in UTC.