Logs: freenode/#haskell
| 2021-03-27 17:21:19 | <maerwald> | yeah, I want to avoid exactly those assumptions |
| 2021-03-27 17:21:43 | × | frozenErebus quits (~frozenEre@37.231.244.249) (Quit: leaving) |
| 2021-03-27 17:21:47 | <ephemient> | you will have to handle unexpected failures later, regardless of what you assume up front |
| 2021-03-27 17:21:55 | <maerwald> | the question now is how to unify over windows and unix (given that we assume all ByteStrings are valid on unix) |
| 2021-03-27 17:22:15 | <maerwald> | when converting FROM ByteString |
| 2021-03-27 17:22:19 | ← | jakalx parts (~jakalx@base.jakalx.net) ("Error from remote client") |
| 2021-03-27 17:23:22 | <ephemient> | I would leave it as a bytestring until open() time, which can fail due to encoding *or* system-specific reasons |
| 2021-03-27 17:23:48 | → | ddellacosta joins (~ddellacos@86.106.143.92) |
| 2021-03-27 17:24:00 | <maerwald> | this is what I've done: https://git.io/JYsjV |
| 2021-03-27 17:25:34 | × | gentauro quits (~gentauro@unaffiliated/gentauro) (Quit: leaving) |
| 2021-03-27 17:25:37 | × | zebrag quits (~inkbottle@aaubervilliers-654-1-98-245.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!) |
| 2021-03-27 17:25:46 | × | MrMobius quits (~MrMobius@208.58.206.154) (Ping timeout: 245 seconds) |
| 2021-03-27 17:25:53 | <maerwald> | FileSystem support is up to an application to worry about imo. E.g. some applications don't support AUFS, because it breaks `rename` sometimes (you need portable file copy). |
| 2021-03-27 17:26:00 | → | zebrag joins (~inkbottle@aaubervilliers-654-1-98-245.w86-212.abo.wanadoo.fr) |
| 2021-03-27 17:26:41 | <ephemient> | I don't see why you need detect invalid Windows filenames earlier than `open` time |
| 2021-03-27 17:26:44 | → | MrMobius joins (~MrMobius@208.58.206.154) |
| 2021-03-27 17:26:54 | <maerwald> | ephemient: that's the invariant for the type |
| 2021-03-27 17:26:56 | <ephemient> | you can't detect many cases of invalid filenames without trying to `open` them, across all OSes |
| 2021-03-27 17:27:09 | × | gxt quits (~gxt@gateway/tor-sasl/gxt) (Ping timeout: 240 seconds) |
| 2021-03-27 17:27:13 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-03-27 17:27:18 | <maerwald> | did you read the abstract filepath proposal? |
| 2021-03-27 17:27:20 | → | pera joins (~pera@unaffiliated/pera) |
| 2021-03-27 17:28:33 | × | ddellacosta quits (~ddellacos@86.106.143.92) (Ping timeout: 265 seconds) |
| 2021-03-27 17:28:33 | → | gentauro joins (~gentauro@unaffiliated/gentauro) |
| 2021-03-27 17:29:13 | → | gxt joins (~gxt@gateway/tor-sasl/gxt) |
| 2021-03-27 17:29:22 | <ephemient> | `data WindowsFilePath = WFP ByteArray# -- UTF16 data` doesn't seem like the right thing to do, to me |
| 2021-03-27 17:29:42 | <maerwald> | well, I'm implementing it, so this is assumed as correct |
| 2021-03-27 17:31:54 | <maerwald> | I'm less worried about the internal representation decisions, but how the abstraction will play out (or if there's no reasonable one). Converting from ByteString is one of those things that can't be properly abstracted over. Another option is to just refer ppl to the internals if they need that kind of thing |
| 2021-03-27 17:32:59 | → | Vadrigar_ joins (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) |
| 2021-03-27 17:33:16 | <maerwald> | that's why there are 2 constructors |
| 2021-03-27 17:33:38 | <maerwald> | so you don't accidentially write one codepath if you start matching on the raw data |
| 2021-03-27 17:34:14 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-03-27 17:35:02 | <ephemient> | if I were targeting W10+ only, I'd use UTF-8 across all platforms, period |
| 2021-03-27 17:36:14 | → | vicfred joins (vicfred@gateway/vpn/mullvad/vicfred) |
| 2021-03-27 17:36:30 | <ephemient> | with older Windows in the mix... `data WindowsFilePath = WFPW {- UTF-16 -} | WFPA {- UTF-8 -}` I guess. a bit unfortunate in that it would require a custom Eq that uses the current codepage for conversion |
| 2021-03-27 17:37:49 | → | d34df00d joins (~d34df00d@104-14-27-213.lightspeed.austtx.sbcglobal.net) |
| 2021-03-27 17:37:52 | <d34df00d> | Hi! |
| 2021-03-27 17:38:11 | × | Vadrigar_ quits (~Vadrigar@ip5b417208.dynamic.kabel-deutschland.de) (Ping timeout: 240 seconds) |
| 2021-03-27 17:40:31 | × | madjest14 quits (~Android@2a02-a420-47-b3b2-8077-257-ad0b-f19d.mobile6.kpn.net) (Ping timeout: 276 seconds) |
| 2021-03-27 17:41:24 | <maerwald> | ephemient: rust does a very similar thing to the abstract filepath proposal, see OsString. It's Vec<u8> on unix and WTF-8 (more lax utf-8) on windows |
| 2021-03-27 17:41:51 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: Lost terminal) |
| 2021-03-27 17:42:29 | <maerwald> | but it is more than about filepaths, so it's not a clean abstraction |
| 2021-03-27 17:43:07 | <maerwald> | https://doc.rust-lang.org/std/ffi/index.html#conversions is also interesting |
| 2021-03-27 17:43:38 | <maerwald> | following that, they would only expose `fromByteString` on unix via CPP ifdef |
| 2021-03-27 17:44:09 | × | paddymahoney quits (~paddymaho@cpe9050ca207f83-cm9050ca207f80.cpe.net.cable.rogers.com) (Remote host closed the connection) |
| 2021-03-27 17:45:16 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-03-27 17:45:47 | → | curl joins (5ce955fb@gateway/web/cgi-irc/kiwiirc.com/ip.92.233.85.251) |
| 2021-03-27 17:46:22 | × | geekosaur quits (82650c7a@130.101.12.122) (Ping timeout: 240 seconds) |
| 2021-03-27 17:47:11 | × | Pickchea quits (~private@unaffiliated/pickchea) (Ping timeout: 240 seconds) |
| 2021-03-27 17:47:41 | → | ezrakilty joins (~ezrakilty@97-113-58-224.tukw.qwest.net) |
| 2021-03-27 17:47:56 | <curl> | is there a name for the first argument of (a->(o,a)) -> a -> [o] |
| 2021-03-27 17:48:42 | <curl> | or of that function? |
| 2021-03-27 17:49:18 | → | pupuupup joins (~pupuupup@node-bv.pool-125-24.dynamic.totinternet.net) |
| 2021-03-27 17:49:56 | <maerwald> | https://hackage.haskell.org/package/fixed-vector-1.2.0.0/docs/Data-Vector-Fixed.html#v:unfoldr |
| 2021-03-27 17:49:58 | <maerwald> | unfold? |
| 2021-03-27 17:50:46 | hackage | zenacy-unicode 1.0.1 - Unicode utilities for Haskell https://hackage.haskell.org/package/zenacy-unicode-1.0.1 (mlcfp) |
| 2021-03-27 17:50:47 | <curl> | :t unfoldr |
| 2021-03-27 17:50:48 | <lambdabot> | (b -> Maybe (a, b)) -> b -> [a] |
| 2021-03-27 17:51:01 | <curl> | yeah i see |
| 2021-03-27 17:51:03 | <curl> | thanks |
| 2021-03-27 17:51:46 | hackage | zenacy-html 2.0.3 - A standard compliant HTML parsing library https://hackage.haskell.org/package/zenacy-html-2.0.3 (mlcfp) |
| 2021-03-27 17:52:12 | <curl> | i guess i can always use Just to make the maybe version |
| 2021-03-27 17:53:47 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:1cfc:5265:7008:dc13) |
| 2021-03-27 17:54:15 | <curl> | how do i compose things like that together? i guess i need a fold inbetween to use fusion |
| 2021-03-27 17:55:39 | → | paddymahoney joins (~paddymaho@cpe9050ca207f83-cm9050ca207f80.cpe.net.cable.rogers.com) |
| 2021-03-27 17:55:55 | × | plakband quits (~plakband@softbank126227040096.bbtec.net) (Quit: WeeChat 2.9) |
| 2021-03-27 17:55:57 | <curl> | probably just successive traversals and mappings, but i want the data to feed through one element at a time through some kind of sequence of processes each of which has its own memory state |
| 2021-03-27 17:56:15 | <curl> | at least notionally |
| 2021-03-27 17:56:36 | <curl> | or, because that can be a way of looking at it, that maybe there is a way of coding that is like that |
| 2021-03-27 17:56:45 | × | gioyik quits (~gioyik@gateway/tor-sasl/gioyik) (Ping timeout: 240 seconds) |
| 2021-03-27 17:57:23 | <curl> | does that make sense? feeding the data one element at a time through some kind of stationary bunch of functions |
| 2021-03-27 17:57:28 | <maerwald> | > unfoldr (\b -> if b < 5 then Just (b, b + 1) else Nothing) 1 |
| 2021-03-27 17:57:31 | <lambdabot> | [1,2,3,4] |
| 2021-03-27 17:58:02 | <maerwald> | b is your state |
| 2021-03-27 17:58:18 | <maerwald> | `Nothing` aborts the loop |
| 2021-03-27 17:58:34 | <curl> | :t mapAccumr undefined undefined $ unfoldr (\b -> if b < 5 then Just (b, b + 1) else Nothing) 1 |
| 2021-03-27 17:58:35 | <lambdabot> | error: |
| 2021-03-27 17:58:36 | <lambdabot> | • Variable not in scope: mapAccumr :: t0 -> t1 -> [a0] -> t |
| 2021-03-27 17:58:36 | <lambdabot> | • Perhaps you meant one of these: |
| 2021-03-27 17:59:22 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:1cfc:5265:7008:dc13) (Ping timeout: 276 seconds) |
| 2021-03-27 18:02:22 | → | ddellacosta joins (~ddellacos@86.106.143.66) |
| 2021-03-27 18:02:27 | <curl> | > mapAccumR (\x y -> (x+1,x+y)) 0 $ unfoldr (\b -> if b < 5 then Just (b, b + 1) else Nothing) 1 |
| 2021-03-27 18:02:29 | <lambdabot> | (4,[4,4,4,4]) |
| 2021-03-27 18:02:56 | → | geekosaur joins (82650c7a@130.101.12.122) |
| 2021-03-27 18:03:16 | × | borne quits (~fritjof@200116b8640fd800f7ed9fd86a2491f0.dip.versatel-1u1.de) (Ping timeout: 240 seconds) |
| 2021-03-27 18:03:24 | → | supersven[m] joins (supersvenm@gateway/shell/matrix.org/x-wgclishhljzvmcme) |
| 2021-03-27 18:03:38 | <curl> | > mapAccumL (\x y -> (x+1,x+y)) 0 $ unfoldr (\b -> if b < 5 then Just (b, b + 1) else Nothing) 1 |
| 2021-03-27 18:03:41 | <lambdabot> | (4,[1,3,5,7]) |
| 2021-03-27 18:04:11 | <curl> | see how the 0 enters and acts as a state undergoing +1 |
| 2021-03-27 18:04:52 | × | tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Remote host closed the connection) |
| 2021-03-27 18:05:24 | <curl> | so you see the idea of "composing" these things together, with them aech having their own state? |
| 2021-03-27 18:06:10 | → | geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) |
| 2021-03-27 18:06:55 | → | tromp joins (~tromp@dhcp-077-249-230-040.chello.nl) |
| 2021-03-27 18:06:56 | × | ddellacosta quits (~ddellacos@86.106.143.66) (Ping timeout: 260 seconds) |
| 2021-03-27 18:07:19 | × | e quits (e@freenode/staff/spy.edk) (Quit: edk) |
| 2021-03-27 18:07:27 | <curl> | i guess there is some condition of the first argument of mapAccumL where it can factorise over 2 mapAccumL's in series |
| 2021-03-27 18:08:24 | <curl> | giving some rewrite rule that mashed them all into one call to mapAccumL |
| 2021-03-27 18:08:34 | <curl> | or even by fusion right into the unfold |
| 2021-03-27 18:09:01 | <curl> | mashes* |
| 2021-03-27 18:09:07 | → | ddellacosta joins (~ddellacos@86.106.143.27) |
All times are in UTC.