Logs: liberachat/#haskell
| 2026-04-06 13:27:51 | <ski> | hGetChar :: Handle -> MyIO Char |
| 2026-04-06 13:28:03 | <ski> | HPutChar :: Handle -> Char -> MyIO () |
| 2026-04-06 13:28:05 | <ski> | ... |
| 2026-04-06 13:28:07 | <ski> | and so on |
| 2026-04-06 13:28:30 | <ski> | you could write an interpreter, `runMyIO :: MyIO a -> IO a', for this |
| 2026-04-06 13:28:41 | <ski> | (er, s/hGetChar/HGetChar/) |
| 2026-04-06 13:29:08 | × | terrorjack quits (~terrorjac@2a01:4f8:271:2d98::2) (Quit: The Lounge - https://thelounge.chat) |
| 2026-04-06 13:29:10 | × | sonny quits (~sonny@bras-base-london140cw-grc-17-142-113-177-150.dsl.bell.ca) (Quit: Client closed) |
| 2026-04-06 13:29:55 | <ski> | btw, before monadic I/O was introduces in Haskell, there was a "dialogue"-style I/O, where you defined |
| 2026-04-06 13:29:59 | <ski> | main :: Dialogue |
| 2026-04-06 13:30:00 | <ski> | where |
| 2026-04-06 13:30:13 | <ski> | type Dialogue = [Responses] -> [Requests] |
| 2026-04-06 13:31:09 | <ski> | iowy, you write a function which returns a lazy list of I/O requests, and then (after generating the current request), you look at the current response |
| 2026-04-06 13:31:18 | <ski> | something like |
| 2026-04-06 13:32:07 | → | somemathguy joins (~somemathg@user/somemathguy) |
| 2026-04-06 13:32:22 | <ski> | data Request = OpenFile FilePath IOMode | HGetChar Handle | HPutChar Handle Char | ... |
| 2026-04-06 13:32:58 | <ski> | data Response = FileOpened Handle | HCharGot Char | HCharPut | ... |
| 2026-04-06 13:33:03 | × | Pozyomka quits (~pyon@user/pyon) (Quit: bbml) |
| 2026-04-06 13:33:17 | → | terrorjack joins (~terrorjac@static.27.101.55.162.clients.your-server.de) |
| 2026-04-06 13:33:28 | <ski> | and then you can define helper functions like |
| 2026-04-06 13:33:46 | <ski> | hPutChar :: Handle -> Char -> Dialogue -> Dialogue |
| 2026-04-06 13:33:53 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 13:34:57 | <ski> | hPutChar h c cont resps0 = HPutChar h c : case resps0 of HCharPut:resps -> cont resps |
| 2026-04-06 13:35:00 | <ski> | and |
| 2026-04-06 13:35:12 | <ski> | hGetChar :: Handle -> (Char -> Dialogue) -> Dialogue |
| 2026-04-06 13:35:45 | <ski> | hGetChar h c_cont resps0 = HGetChar h : case resps0 of HCharGot c:resps -> c_cont c resps |
| 2026-04-06 13:37:16 | <ski> | where you pass a "continuation" dialogue for what to do (which will generate the remaining requests and process the corresponding responses), after the character you've outputted, or inputted |
| 2026-04-06 13:40:04 | <ski> | in this case, there'd be a thin run-time driver, which inspects the requests from the dialogue, performs it, and then generates the corresponding response for the dialogue to receive |
| 2026-04-06 13:40:35 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 245 seconds) |
| 2026-04-06 13:40:50 | × | synchromesh quits (~john@2406:5a00:2412:2c00:75ab:7cb0:db12:1e18) (Read error: Connection reset by peer) |
| 2026-04-06 13:41:03 | <ski> | (btw, this `(Char -> Dialogue) -> Dialogue' can be expressed as a "continuation monad", `Cont Dialogue Char', and similarly `Cont Dialogue ()' for the output case) |
| 2026-04-06 13:41:13 | <ski> | @unmtl Cont Dialogue Char |
| 2026-04-06 13:41:13 | <lambdabot> | (Char -> Dialogue) -> Dialogue |
| 2026-04-06 13:41:32 | <ski> | @src Cont |
| 2026-04-06 13:41:32 | <lambdabot> | newtype Cont r a = Cont { runCont :: (a -> r) -> r } |
| 2026-04-06 13:42:09 | → | synchromesh joins (~john@2406:5a00:2412:2c00:75ab:7cb0:db12:1e18) |
| 2026-04-06 13:47:21 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 13:48:49 | → | tromp joins (~textual@2001:1c00:340e:2700:8cf8:7bb7:a0e:7cfa) |
| 2026-04-06 13:52:30 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 255 seconds) |
| 2026-04-06 13:55:59 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
| 2026-04-06 13:56:03 | <TMA> | my understanding of I/O in Haskell stopped with threading RealWorld through everything |
| 2026-04-06 14:03:08 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 14:08:09 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
| 2026-04-06 14:18:55 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 14:20:25 | × | traxex quits (traxex@user/traxex) (Ping timeout: 272 seconds) |
| 2026-04-06 14:24:02 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 2026-04-06 14:30:37 | × | somemathguy quits (~somemathg@user/somemathguy) (Quit: WeeChat 4.1.1) |
| 2026-04-06 14:33:07 | <EvanR> | my understanding of I/O started when threading RealWorld stopped xD |
| 2026-04-06 14:34:44 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 14:39:55 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds) |
| 2026-04-06 14:40:35 | <EvanR> | RealWorld and [Response] -> [Request] both seems like dead ends in IO enlightenment |
| 2026-04-06 14:45:20 | → | chromoblob joins (~chromoblo@user/chromob1ot1c) |
| 2026-04-06 14:48:20 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 14:51:32 | → | puke joins (~puke@user/puke) |
| 2026-04-06 14:53:40 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 276 seconds) |
| 2026-04-06 14:55:22 | <ski> | they're stepping stones |
| 2026-04-06 14:57:17 | <TMA> | EvanR: my understanding now is: haskell has no I/O. it has IO instead and that's dark magic I don't want to touch |
| 2026-04-06 15:04:08 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 15:08:57 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
| 2026-04-06 15:10:52 | → | jmcantrell_ joins (~weechat@user/jmcantrell) |
| 2026-04-06 15:10:52 | jmcantrell_ | is now known as jmcantrell |
| 2026-04-06 15:14:40 | <tomsmeding> | TMA: have you ever done anything with linear types? |
| 2026-04-06 15:15:11 | <tomsmeding> | if you write IO as `newtype IO a = IO (RealWorld %1-> (RealWorld, Ur a))` suddenly it makes perfectsense |
| 2026-04-06 15:15:17 | <tomsmeding> | *perfect sense |
| 2026-04-06 15:16:33 | → | acidjnk_new joins (~acidjnk@p200300d6e700e50883c9e32b40afcfd6.dip0.t-ipconnect.de) |
| 2026-04-06 15:16:34 | <tomsmeding> | ostensibly that %1 should be there, but it isn't |
| 2026-04-06 15:16:55 | <__monty__> | TMA: That's a bad conclusion. (As in, it saddens me that you've come to it, not as in you're bad for reaching it.) Maybe forego "understanding" IO for a bit and just try it out for a bit, get a feel for it. (Don't fall into the trap of turning your observations into rigid rules of how it works though, keep an open mind.) |
| 2026-04-06 15:16:59 | <tomsmeding> | but that's mostly an emperor's-new-clothes situation, everyone assumes it's there |
| 2026-04-06 15:19:54 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 15:25:46 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 2026-04-06 15:26:33 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 255 seconds) |
| 2026-04-06 15:27:14 | × | jmcantrell quits (~weechat@user/jmcantrell) (Ping timeout: 248 seconds) |
| 2026-04-06 15:34:37 | → | humasect joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 2026-04-06 15:35:09 | <TMA> | tomsmeding: I have read about them. |
| 2026-04-06 15:36:41 | <TMA> | __monty__: nobody permits me to use haskell in employment related work so I use haskell mostly as an inspiration for structuring code in other languages, so this level of understanding does not hinder me at all |
| 2026-04-06 15:37:36 | TMA | has come to terms with own limitations |
| 2026-04-06 15:37:56 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 15:38:17 | TMA | is not smart enough and that's fine |
| 2026-04-06 15:38:54 | × | humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Ping timeout: 246 seconds) |
| 2026-04-06 15:40:02 | × | divlamir quits (~divlamir@user/divlamir) (Read error: Connection reset by peer) |
| 2026-04-06 15:40:22 | → | divlamir joins (~divlamir@user/divlamir) |
| 2026-04-06 15:42:45 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 2026-04-06 15:47:15 | <gentauro> | TMA: do you know Binary Lambda Calculus from John Tromp? https://tromp.github.io/cl/Binary_lambda_calculus.html (see his examples how he handles IO effects) ;) |
| 2026-04-06 15:49:20 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 15:54:19 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds) |
| 2026-04-06 15:57:55 | × | slomp quits (~slomp@47-158-212-88.lsan.ca.frontiernet.net) (Read error: Connection reset by peer) |
| 2026-04-06 15:59:22 | → | slomp joins (~slomp@47-158-212-88.lsan.ca.frontiernet.net) |
| 2026-04-06 16:05:18 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 16:10:03 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 2026-04-06 16:14:39 | → | humasect joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 2026-04-06 16:22:07 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 16:24:41 | <TMA> | gentauro: I have read it. I have not understood it. |
| 2026-04-06 16:25:09 | → | machinedgod joins (~machinedg@d172-219-48-230.abhsia.telus.net) |
| 2026-04-06 16:26:17 | <TMA> | gentauro: some parts are easy. some parts make my brain shut down. |
| 2026-04-06 16:26:20 | TMA | is not smart enough and that's fine |
| 2026-04-06 16:27:37 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 2026-04-06 16:29:24 | <mauke> | RealWorld is bullshit. it doesn't explain anything |
| 2026-04-06 16:38:11 | → | merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl) |
| 2026-04-06 16:43:33 | × | merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 272 seconds) |
| 2026-04-06 16:46:42 | → | Pozyomka joins (~pyon@user/pyon) |
All times are in UTC.