Home liberachat/#haskell: Logs Calendar

Logs on 2022-12-08 (liberachat/#haskell)

00:00:28 × Chai-T-Rex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection)
00:00:47 polo is now known as money
00:01:29 Chai-T-Rex joins (~ChaiTRex@user/chaitrex)
00:02:38 × Guest75 quits (~Guest75@192.46.237.51) (Ping timeout: 260 seconds)
00:03:23 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
00:03:45 son0p joins (~ff@2604:3d08:5b7f:5540::a58f)
00:05:31 <sm> Resist the AIs' mind waves, do not propagate their gospel of confusion. Clarity! Sobriety! Humanity!
00:12:17 dsrt^ joins (~dsrt@76.145.185.103)
00:12:51 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:4198:e7b5:35c5:87c6)
00:13:57 × ericsagnes quits (~ericsagne@2405:6580:8a0:1e00:4198:e7b5:35c5:87c6) (Client Quit)
00:14:35 × acidjnk_new quits (~acidjnk@p200300d6e7137a767ca9aed60fa8d1f2.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
00:26:00 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:3354:8194:6cd8:a3c2)
00:26:40 ericsagnes parts (~ericsagne@2405:6580:8a0:1e00:3354:8194:6cd8:a3c2) ()
00:28:48 <EvanR> so a list is 1 + t + t^2 + t^3 + ...
00:29:06 <EvanR> the derivative of this is 0 + 1 + 2t + 3t^2 + 4t^3 + ...
00:29:22 <EvanR> which is list * (1 + 2 + 3 + 4 + ...), what the hell is this factor
00:30:02 <monochrom> No, not list * (1 + 2 + 3 + 4 + ...)
00:30:16 <EvanR> oh bad math
00:30:32 <EvanR> list * list ?
00:31:27 × tremon quits (~tremon@83-84-18-241.cable.dynamic.v4.ziggo.nl) (Quit: getting boxed in)
00:32:09 <monochrom> Yeah.
00:32:33 <monochrom> But the zipper differentiation is not doing that.
00:32:54 <monochrom> Err, wait, maybe it does.
00:35:29 <jackdk> https://www.slideshare.net/JayCoskey/zippers-derivatives-of-regular-types see slides 7 and 8, but I don't remember my differentiation well enough to see how it all works
00:39:00 L29Ah parts (~L29Ah@wikipedia/L29Ah) ()
00:42:24 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:6f8b:1377:1cdb:d8cd)
00:43:00 ericsagnes parts (~ericsagne@2405:6580:8a0:1e00:6f8b:1377:1cdb:d8cd) ()
00:44:33 justsomeguy joins (~justsomeg@user/justsomeguy)
00:45:34 <EvanR> yeah they take a shortcut through actual calculus with the 1/(1-x) trick
00:45:43 <EvanR> which is hilarious
00:45:46 × zant1 quits (~zant@62.214.20.26) (Ping timeout: 256 seconds)
00:47:11 <jackdk> every derivation of list zippers via differentiation does this, and I've never seen it explained in detail
00:47:37 zant1 joins (~zant@62.214.20.26)
00:47:53 <EvanR> list * list = (1 + t + t^2 + ...) squared...
00:48:42 <EvanR> that plus that times t, plus that times t^2, plus...
00:48:58 <EvanR> ok that adds up to 1 + 2t + 3t^2 + ...
00:49:05 <EvanR> cool
00:49:58 <EvanR> that results in a type that can be used as one hole contexts
00:51:04 <EvanR> but what is this one hole context really, is it like splitting the list into two parts, or is it the original list with 1 item missing, and you have to pair that item to get a zipper, in addition to the two lists
00:51:17 geekosaur scans back and notes that he would not particularly expect either clarity or sobriety from humans…
00:51:56 <EvanR> if it's just two parts, does this mean the derivative type always contains some form of sensible substructure of what goes in the hole
00:52:34 <EvanR> I mean, unless you take the derivative of Bool or something and get Void
00:52:34 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db)
00:53:08 × zant1 quits (~zant@62.214.20.26) (Ping timeout: 256 seconds)
00:54:44 jargon_ joins (~jargon@174-22-192-24.phnx.qwest.net)
00:55:50 × jargon quits (~jargon@184.101.177.18) (Ping timeout: 260 seconds)
00:59:03 × ericsagnes quits (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db) (Quit: WeeChat 3.7.1)
00:59:45 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db)
01:00:30 × crazazy` quits (~user@130.89.173.127) (Ping timeout: 256 seconds)
01:02:08 × ericsagnes quits (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db) (Client Quit)
01:02:22 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db)
01:02:41 ericsagnes parts (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db) ()
01:05:56 × Maeda_ quits (~Maeda@91-161-10-149.subs.proxad.net) (Ping timeout: 248 seconds)
01:06:02 <iqubic> what's going on here? I'm a very confused girl.
01:06:45 ericsagnes joins (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db)
01:07:04 × ericsagnes quits (~ericsagne@2405:6580:8a0:1e00:7966:11d5:2610:f5db) (Client Quit)
01:07:09 × cods quits (~fred@82-65-232-44.subs.proxad.net) (Ping timeout: 260 seconds)
01:07:21 cods joins (~fred@82-65-232-44.subs.proxad.net)
01:07:38 ryanbooker joins (uid4340@id-4340.hampstead.irccloud.com)
01:07:55 Maeda joins (~Maeda@91-161-10-149.subs.proxad.net)
01:08:14 <geekosaur> I'm not sure anyone else is less confused
01:08:56 <geekosaur> trying to decipher http://strictlypositive.org/diff.pdf
01:09:37 mvk joins (~mvk@2607:fea8:5ce3:8500::efb)
01:09:39 × mvk quits (~mvk@2607:fea8:5ce3:8500::efb) (Client Quit)
01:09:42 <EvanR> yeah, coming from one direction you have zipper data structure and how that works for something not as trivial as a list, coming from the other direction "the derivative of a type is its type of one hole contexts" (mcbride paper)
01:09:47 geekosaur worked his way through the paper once and thought he sort-of understood it…
01:09:51 <EvanR> they collide somewhere and it works
01:10:21 × albet70 quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection)
01:10:56 <geekosaur> (it's somehow extending type algebra to type calculus)
01:11:58 <iqubic> I know what a zipper is, but I don't understand what that paper is doing.
01:12:12 <geekosaur> the point being, neither does anyone else 🙂
01:12:12 iqubic is a very confused lady indeed.
01:12:16 × aliosablack quits (~chomwitt@2a02:587:7a0c:6a00:1ac0:4dff:fedb:a3f1) (Ping timeout: 252 seconds)
01:12:33 <iqubic> Do you think Coner McBride understands the paper?
01:13:31 <geekosaur> probably, but that doesn't guarantee anyone else does. zippers are useful but how you get them from that is … not entirely clear
01:13:49 <geekosaur> much less how you get them for things like trees, which are harder to differentiate
01:14:16 <geekosaur> or at least harder to interpret the derivative in terms of one-hole contexts
01:14:44 <iqubic> Yeah... I don't know what that paper is doing. I'm not gonna be able to help you.
01:14:49 <geekosaur> I am not very mathy and haven't touched differentiation since 1983
01:14:53 wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com)
01:14:53 × wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host)
01:14:53 wroathe joins (~wroathe@user/wroathe)
01:16:28 albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
01:16:28 <albet70> c_wraith , it is >>= not >> in the docs
01:16:44 Luj39 joins (~Luj@2a01:e0a:5f9:9681:5880:c9ff:fe9f:3dfb)
01:16:56 × RemiYuko quits (~licht@user/akechishiro) (Ping timeout: 246 seconds)
01:17:10 × Luj3 quits (~Luj@2a01:e0a:5f9:9681:5880:c9ff:fe9f:3dfb) (Ping timeout: 252 seconds)
01:17:10 Luj39 is now known as Luj3
01:17:32 <sclv> people understand the abstract combinatorics of species, and it turns out this stuff with types is a special case of it
01:17:51 RemiYuko joins (~licht@user/akechishiro)
01:17:59 <c_wraith> albet70: sure, but (x >> y) is (x >>= \_ -> y), so what you want is a direct consequence
01:18:27 <c_wraith> albet70: it's just a couple substitutions to rewrite it
01:21:17 × tomokojun quits (~tomokojun@static-198-54-134-86.cust.tzulo.com) (Quit: じゃあね〜。)
01:28:09 × xff0x quits (~xff0x@ai071162.d.east.v6connect.net) (Ping timeout: 260 seconds)
01:28:13 × troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 252 seconds)
01:40:32 king_gs joins (~Thunderbi@187.201.204.122)
01:49:12 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
01:49:50 × califax quits (~califax@user/califx) (Ping timeout: 255 seconds)
01:50:56 × king_gs quits (~Thunderbi@187.201.204.122) (Ping timeout: 256 seconds)
01:52:05 × azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds)
01:52:55 califax joins (~califax@user/califx)
01:53:26 × use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:556e:28e8:6695:53e8) (Remote host closed the connection)
01:53:44 use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:556e:28e8:6695:53e8)
01:55:50 azimut joins (~azimut@gateway/tor-sasl/azimut)
01:59:25 king_gs joins (~Thunderbi@187.201.204.122)
02:00:00 × mncheck quits (~mncheck@193.224.205.254) (Ping timeout: 256 seconds)
02:04:23 × justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 264 seconds)
02:04:39 notzmv joins (~zmv@user/notzmv)
02:06:31 xff0x joins (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp)
02:14:37 troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua)
02:17:00 × beteigeuze quits (~Thunderbi@a79-169-109-107.cpe.netcabo.pt) (Ping timeout: 256 seconds)
02:19:43 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 260 seconds)
02:20:52 <EvanR> ok yeah, there is an actual hole. The sub structure that was where the hole is isn't in the derivative
02:22:00 <EvanR> if t(x) = (x,x,x) = x^3, t' = 3x^2 = (3, x, x). Two of the x and a Trool to tell you which one is missing
02:22:47 <EvanR> the 1 + 2x + 3x^2 + 4x^3 + ... is saying the same thing but for any number of elements
02:23:48 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds)
02:34:02 Lycurgus joins (~juan@user/Lycurgus)
02:34:16 codaraxis__ joins (~codaraxis@user/codaraxis)
02:34:51 <iqubic> Are we still talking about derivatives of data types?
02:34:53 <iqubic> Are we still talking about derivatives of data types?
02:36:24 × codaraxis quits (~codaraxis@user/codaraxis) (Ping timeout: 260 seconds)
02:36:50 <EvanR> the singular we, I guess
02:36:57 × money_ quits (~money@user/polo) (Quit: money_)
02:38:32 × codaraxis__ quits (~codaraxis@user/codaraxis) (Ping timeout: 256 seconds)
02:44:27 <monochrom> Are we still asking about what we're talking about? >:)
02:45:41 × king_gs quits (~Thunderbi@187.201.204.122) (Ping timeout: 268 seconds)
02:46:54 × [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Ping timeout: 260 seconds)
02:50:35 [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470)
02:50:49 <Lears> I haven't read the paper, but I think the idea is relatively straightforward to implement in practice without any algebraic tricks. E.g. `data Tree a = Empty | Leaf a | Branch (Tree a) (Tree a)` ==> Tree x = 1 + x + Tree x * Tree x ==> Tree' x = 0 + 1 + Tree' x * Tree x + Tree x * Tree' x ==> `data TreeContext a = OnEmpty !Void | OnLeaf | OnLeftBranch (TreeContext a) (Tree a) | OnRightBranch (Tree a) (TreeContext a)`
02:50:51 razetime joins (~quassel@49.207.203.213)
02:51:55 × Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5)
02:53:13 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "")
02:55:27 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
02:55:43 × use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:556e:28e8:6695:53e8) (Remote host closed the connection)
02:56:02 use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:556e:28e8:6695:53e8)
02:58:10 <Lears> s/(TreeContext a)/!(TreeContext a)/ in the branch fields, I guess. Then if we have `data StrictPair a b = StrictPair !a !b`, `StrictPair a (TreeContext a)` should "do the right thing" re `Empty`.
03:00:08 <iqubic> Yeah, implementing a zipper is easy. Doing the math is hard.
03:00:54 <Lears> What is "the math" here beyond the trivial differentiation steps in the middle?
03:01:33 <Lears> Unless you mean writing the paper to demonstrate the notion in general.
03:01:34 <EvanR> I feel the urge to take "What's the problem?!" to your demonstration xD
03:01:40 <EvanR> tack*
03:01:53 <EvanR> but yeah it's making sense now
03:02:20 × gurkenglas quits (~gurkengla@p548ac72e.dip0.t-ipconnect.de) (Ping timeout: 256 seconds)
03:02:48 <EvanR> the part where the 1-hole context of a list, given above as a series, becomes 2 lists via analytics is like... a weird side-show, funny but distracting
03:03:27 × hueso quits (~root@user/hueso) (Ping timeout: 260 seconds)
03:03:34 <iqubic> How do you take the derivative of a list? What does that look like?
03:03:55 <c_wraith> you convert the type to algebraic form, then take the derivative of that.
03:03:57 <EvanR> first the list type is list(x) = 1 + x * list(x)
03:04:16 <iqubic> Where does the 1 come from? Is that Nil?
03:04:23 <EvanR> to avoid the side-show, lets rewrite it as 1 + x + x^2 + x^3 + ...
03:04:32 <iqubic> Yeah, that makes sense.
03:04:41 <EvanR> yeah 1 is unit or ()
03:04:53 <EvanR> it stands for empty list
03:05:44 <EvanR> and now you can take the derivative
03:05:52 <iqubic> A list is either the empty list (1), 1 element (x^1) or 2 elements (x^2), or 3 (x^3) all the way up to N elements (x^n).
03:06:07 <EvanR> or N+1 elements, and so on
03:06:48 <iqubic> Yeah...
03:07:30 hueso joins (~root@user/hueso)
03:07:58 <iqubic> But what do you do with the derivative of the form "1 + 2x + 3x^2 + 4x^3 + ... + (n-1)x^n"
03:08:32 <EvanR> well that's the sum of context types for the singleton, the pair, the triple, etc
03:08:48 <EvanR> do with it what you will xD
03:09:23 <EvanR> that type holds the same information as two lists of x
03:09:25 <iqubic> I guess at that point you try to construct the ADT that has that form?
03:09:37 <EvanR> either one is enough to implement the list zipper
03:09:47 <iqubic> Yeah, I see.
03:11:17 <EvanR> with that out of the way, time for the sideshow. 1 + x + x^2 + ... = 1 / (1 - x), and the derivative of that is (1 / (1 - x))^2 xD
03:11:33 <EvanR> (two lists)
03:12:29 <iqubic> Huh?? How do you do subtraction and division with ADTs? Aren't they called "sums of products" for a reasion?
03:12:40 <iqubic> s/reasion/reason/
03:13:23 <EvanR> another satisfied customer! next!
03:13:52 <iqubic> I'm not satisfied at all. If anything, I'm more confused.
03:14:23 <EvanR> I tried to clearly demark where we went from making sense to borderline farce xD
03:14:59 × [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Remote host closed the connection)
03:15:12 <EvanR> maybe it's related to how 1 + 2 + 3 + 4 + ... = -1/12 xD
03:15:16 <byorgey> it's not a farce at all. =) 1 / (1 - x) can't be interpreted directly as a type, but it's a perfectly good representation of a formal power series. Combinatoricists have been doing this for a long time.
03:16:04 <byorgey> exercise for the reader: start from list(x) = 1 + x * list(x) and differentiate both sides
03:16:09 <iqubic> Oh, hey there byorgey. Welcome into to our ramblings on ADTs. We're trying to puzzle out exactly what's so "algebraic" about them
03:16:22 <EvanR> yeah that's where the formula comes from, or could come from
03:17:43 <EvanR> iqubic, you bought the formula list(x) = 1 + x * list(x), which I agree with. But maybe we read too much into it already at that stage
03:18:27 <byorgey> Types are algebraic because they form a very nice semiring.
03:18:40 <iqubic> They do?
03:18:49 <EvanR> 0, 1, +, *
03:19:05 <iqubic> Right. Yes. That's right.
03:19:36 <iqubic> Or in this case, Void, Unit, Either, (,)
03:20:17 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
03:21:31 <byorgey> And because there are homomorphisms between the semiring of types (or subsemirings like the semiring of finite types) to other nice semirings like the natural numbers, finite sets, etc., a lot of the "algebraic" machinery we know and love from those settings (exponent laws, derivatives, etc.) works nicely with types as well.
03:21:47 × hueso quits (~root@user/hueso) (Quit: hueso)
03:21:53 <iqubic> I'm beginning to see that, yeah.
03:22:23 <EvanR> full disclosure, last night I saw the AoC puzzle and said damn that needs a zipper! But I had no idea how to do it, and my friend has such a hard time in Language X I told him to just take the derivative of the tree. So here I am trying to even understand it xD
03:22:40 <byorgey> EvanR: yeah, I did it with a zipper =)
03:22:54 <byorgey> but I didn't derive it myself, I just used the rosezipper package
03:23:11 <iqubic> I didn't use a zipper. I found it too hard to parse the input into a zipper.
03:23:18 <EvanR> apparently the elixir library they tried first couldn't handle the directory name attached to the names
03:23:28 <EvanR> attached to the nodes
03:23:47 <byorgey> I parsed the input into a sequence of commands, then I interpreted the commands in a state monad with a zipper as the state.
03:24:49 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds)
03:24:59 <EvanR> do semirings explain 1 / (1 - x) or recursive equations?
03:25:22 <iqubic> Ah. I see. I did a similar thing, but instead of using a zipper I converted the sequence of commands into a (Map [String] [Int]) where I stored only the file sizes.
03:26:07 <EvanR> ok I guess that's a second level of ring
03:26:24 <iqubic> What's the second level?
03:26:36 <EvanR> polynomial ring
03:26:54 <iqubic> I'm not familiar with that structure.
03:27:06 hueso joins (~root@user/hueso)
03:27:10 <byorgey> EvanR: star semirings do, I think.
03:27:44 <byorgey> https://dl.acm.org/doi/10.1145/2544174.2500613
03:28:25 <EvanR> a 3 second google indicates this star is the kleene star?
03:28:35 <byorgey> yes.
03:28:43 <EvanR> mind blown
03:28:45 <byorgey> aka List
03:29:15 <byorgey> ^^^ that paper I linked is one of my favorite.
03:29:29 king_gs joins (~Thunderbi@187.201.204.122)
03:30:37 <EvanR> I use lock picking on this publication
03:30:43 <albet70> in ActionM ()'s do notation, if I want to use 'catch' to catch exception, 1. does it need 'liftIO'? since catch :: IO a -> ... 2. if with liftIO, liftIO the whole catch line?
03:30:56 <EvanR> % randomRIO (1,20)
03:30:56 <yahb2> <interactive>:46:1: error: ; Variable not in scope: randomRIO :: (a0, b0) -> t
03:31:54 finn_elija joins (~finn_elij@user/finn-elija/x-0085643)
03:31:54 × FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija)))
03:31:54 finn_elija is now known as FinnElija
03:32:20 <iqubic> Kleene star is such a complicated name for such a simple concept, LOL
03:32:38 <EvanR> is it? simple
03:33:13 <byorgey> oh, is it paywalled? oops, try https://scholar.archive.org/work/c2l6m5cvdrh4di2xj3steer6ua/access/wayback/https://www.cl.cam.ac.uk/~sd601/papers/semirings.pdf
03:33:46 <byorgey> it is simple yet deep/profound, just like monads.
03:33:49 <iqubic> byorgey: The original link was paywalled, but I can view the paper at that link.
03:33:51 <EvanR> thanks
03:34:04 <iqubic> Even Posix Regex has a Kleene star
03:34:40 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection)
03:35:25 <EvanR> a* = 1 + aa*
03:35:47 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
03:35:51 <EvanR> list(x) = 1 + x * list(x)
03:35:51 <iqubic> Yeah, that makes sense.
03:37:51 <iqubic> byorgey: I'll get around to reading that after Advent of Code.
03:39:04 × mtjm quits (~mutantmel@2604:a880:2:d0::208b:d001) (Remote host closed the connection)
03:40:20 mtjm joins (~mutantmel@2604:a880:2:d0::208b:d001)
03:43:15 L29Ah joins (~L29Ah@wikipedia/L29Ah)
03:44:35 × td_ quits (~td@83.135.9.15) (Ping timeout: 264 seconds)
03:45:42 instantaphex joins (~jb@c-73-171-252-84.hsd1.fl.comcast.net)
03:46:26 td_ joins (~td@83.135.9.14)
03:51:29 wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com)
03:51:29 × wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host)
03:51:29 wroathe joins (~wroathe@user/wroathe)
03:59:00 × king_gs quits (~Thunderbi@187.201.204.122) (Read error: Connection reset by peer)
03:59:06 king_gs1 joins (~Thunderbi@2806:103e:29:94a4:81e0:429b:22ec:cf13)
03:59:34 × Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 256 seconds)
04:01:24 king_gs1 is now known as king_gs
04:10:47 × machinedgod quits (~machinedg@d198-53-218-113.abhsia.telus.net) (Ping timeout: 268 seconds)
04:13:35 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 260 seconds)
04:20:51 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
04:27:14 × ryanbooker quits (uid4340@id-4340.hampstead.irccloud.com) (Quit: Connection closed for inactivity)
04:27:27 wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com)
04:27:27 × wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host)
04:27:27 wroathe joins (~wroathe@user/wroathe)
04:27:53 × king_gs quits (~Thunderbi@2806:103e:29:94a4:81e0:429b:22ec:cf13) (Quit: king_gs)
04:28:06 king_gs joins (~Thunderbi@187.201.204.122)
04:31:59 × bontaq quits (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 264 seconds)
04:33:00 × ddellacosta quits (~ddellacos@static-198-44-136-134.cust.tzulo.com) (Ping timeout: 256 seconds)
04:44:04 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 248 seconds)
04:47:14 mbuf joins (~Shakthi@49.205.85.230)
04:47:15 × king_gs quits (~Thunderbi@187.201.204.122) (Read error: Connection reset by peer)
04:47:38 king_gs joins (~Thunderbi@2806:103e:29:94a4:81e0:429b:22ec:cf13)
04:53:15 × Vajb quits (~Vajb@2001:999:504:3ad6:52a4:a3b5:32d8:e74d) (Read error: Connection reset by peer)
04:53:41 Vajb joins (~Vajb@hag-jnsbng11-58c3a5-27.dhcp.inet.fi)
04:55:14 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds)
04:58:59 × king_gs quits (~Thunderbi@2806:103e:29:94a4:81e0:429b:22ec:cf13) (Ping timeout: 264 seconds)
05:04:48 × tvandinther quits (~tvandinth@111.69.34.210) (Ping timeout: 260 seconds)
05:06:54 × srk quits (~sorki@user/srk) (Ping timeout: 268 seconds)
05:06:55 <freeside> update from running my naive but reasonably well optimized Unboxed Vector implementation of 2019/day/16: my runtime was growing linearly with input size, but interestingly, the most recent jump from 65000 to 650000 caused a 100-fold increase in runtime for only a 10x increase in input size
05:07:00 Lycurgus joins (~juan@user/Lycurgus)
05:07:49 <jackdk> Sounds like you've got an O(n^2) algo in there somewher
05:08:03 <freeside> yeah, definitely feels that way, except it didn't show up for the smaller n
05:08:21 <freeside> that's the funny thing about ^ i guess
05:11:13 <freeside> well, at least i've moved the O(n^2) from space to time, lol
05:11:50 × Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5)
05:23:33 × Vajb quits (~Vajb@hag-jnsbng11-58c3a5-27.dhcp.inet.fi) (Ping timeout: 268 seconds)
05:23:47 Vajb joins (~Vajb@2001:999:504:3ad6:52a4:a3b5:32d8:e74d)
05:29:53 <int-e> freeside: you may have jumped a level in the cache hierarchy.
05:32:18 × johnw quits (~johnw@2600:1700:cf00:db0:1da8:bc45:1742:a938) (Quit: ZNC - http://znc.in)
05:33:42 <int-e> Hmm. But you said naive... if you implement that naively, it should be quadratic, shouldn't it?
05:38:53 <freeside> good point. anyway, i think i have found my bug, i should be letting above and calling below
05:40:07 × waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 252 seconds)
05:42:15 × L29Ah quits (~L29Ah@wikipedia/L29Ah) (Ping timeout: 260 seconds)
05:51:20 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
06:02:32 × instantaphex quits (~jb@c-73-171-252-84.hsd1.fl.comcast.net) (Ping timeout: 256 seconds)
06:06:47 × jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 255 seconds)
06:07:58 jpds2 joins (~jpds@gateway/tor-sasl/jpds)
06:09:38 takuan joins (~takuan@178-116-218-225.access.telenet.be)
06:11:39 <int-e> freeside: (\x -> genBase y x+1) lacks parentheses?
06:12:02 <freeside> i keep flipping between the (Int,Int) form and the Int -> Int form
06:12:16 <freeside> is there any performance advantage to either, or do they get desugared by the compiler?
06:12:57 bgs joins (~bgs@212-85-160-171.dynamic.telemach.net)
06:14:05 instantaphex joins (~jb@c-73-171-252-84.hsd1.fl.comcast.net)
06:14:06 <int-e> I'd trust the compiler more for the curried (untupled) version.
06:14:54 <int-e> But there's a reasonably good chance that the compiler will generate the same worker either way in this particular instance.
06:16:29 <int-e> In any case, this particular problem has a trick that allows it to be solved in millions rather than billions or trillions of operations..
06:16:40 <freeside> i think it is time for me to do Clever Algo Tricks to exploit the properties of the input. The neat thing about the input is that working from bottom to top immediately suggests a sort of optimized fold, where we simply add a single value from the upper row to the running output. https://github.com/mengwong/adventofcode/commit/71d6e5a83f092c58aee8126ed31a05b600c8b80d#commitcomment-92311451
06:16:51 <int-e> (relying on a special property of the input)
06:17:33 <freeside> is there a version of fold that logs each step to a running list? i will go dig in the Data.List docs, or perhaps the Data.Vector docs
06:18:05 <freeside> the last row is known to produce a 0 result, then the row above that is just the last val in the input list, then the row above that produces that last val plus the previous val, etc.
06:18:26 <freeside> i will go think of a succint way to express that after my next meeting and a cup of coffee
06:18:33 × instantaphex quits (~jb@c-73-171-252-84.hsd1.fl.comcast.net) (Ping timeout: 265 seconds)
06:18:36 <jackdk> one of teh scans, maybe?
06:19:35 <freeside> things get messy once we move to the upper right quadrant though, i feel like there is a version of that cache that could rely on the "angled" boundary between the regions
06:20:18 <freeside> the slope of the 0-to-1 boundary is -1; the slope of the 1-to-0 boundary is -0.5; the slope of the 0-to-(-) boundary is -0.25; and so on
06:20:21 <int-e> freeside: here's a slightly bigger version of that matrix rendered a bit differently... maybe that sparks an inspiration? http://paste.debian.net/1263255/ ...incidentally the sole comment in my solution for that part.
06:20:45 <freeside> that matrix shows the derivative of the computation, basically
06:21:37 <freeside> a second derivative would show only a single diagonal of + running down the page
06:22:08 <freeside> conceptually, a sort of hamming encoding
06:22:50 <int-e> freeside: have you looked at the given message index at all?
06:23:35 <freeside> beyond the x div y mod 4 in my genBase, you mean?
06:23:40 codaraxis joins (~codaraxis@user/codaraxis)
06:24:44 <int-e> hmm. oh it's called "message offset" in the problem
06:24:46 <freeside> i will think on this. thank you. i now have to attend a meeting.
06:25:06 <int-e> anyway, there's something there that simplifies the problem considerably
06:25:50 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds)
06:38:33 Scraeling joins (~Scraeling@user/scraeling)
06:47:28 × jmdaemon quits (~jmdaemon@user/jmdaemon) (Ping timeout: 260 seconds)
06:54:51 <iqubic> One of these days I should update my 2D grid code from "Map (V2 Int) a" to something better, but IDK what a better type would be.
06:59:09 <dsal> Mine is `ByteString`
07:00:29 <iqubic> Did you use a ByteString for today?
07:03:28 × bgs quits (~bgs@212-85-160-171.dynamic.telemach.net) (Remote host closed the connection)
07:03:33 <dsal> Yeah. A big part of my time sink was trying to remember how I built this thing. It's kind of messy.
07:03:43 <dsal> At least displaying it is
07:03:45 × shriekingnoise quits (~shrieking@186.137.167.202) (Quit: Quit)
07:04:19 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
07:05:52 <iqubic> My grid implementation was super slow because I think Map is slow.
07:06:28 × troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 248 seconds)
07:06:51 Unicorn_Princess joins (~Unicorn_P@user/Unicorn-Princess/x-3540542)
07:07:34 jakalx joins (~jakalx@base.jakalx.net)
07:11:39 <iqubic> How do you have a 2D ByteString?
07:13:30 <int-e> Map was good enough today
07:15:27 <int-e> iqubic: I suppose you could have a vector of ByteStrings
07:17:06 <dsal> iqubic: Ix
07:17:19 <iqubic> How does Ix help you?
07:17:27 <int-e> :t ix
07:17:27 <dsal> It adds Ds to a 1D thing.
07:17:28 <lambdabot> (Ixed m, Applicative f) => Index m -> (IxValue m -> f (IxValue m)) -> m -> f m
07:17:46 <dsal> :t Ix.index
07:17:47 <lambdabot> error:
07:17:47 <lambdabot> Not in scope: ‘Ix.index’
07:17:47 <lambdabot> Perhaps you meant one of these:
07:17:56 <int-e> :t index
07:17:57 <lambdabot> Ix a => (a, a) -> a -> Int
07:18:04 <dsal> Oh. Convenient.
07:18:08 <iqubic> Oh does it add Ds?
07:18:42 <int-e> > map index ((0,0),(3,3)) [(0,0),(0,1),(1,0),(3,3),(4,1)]
07:18:43 <lambdabot> error:
07:18:43 <lambdabot> • Couldn't match expected type ‘[(a3, b2)] -> t’
07:18:43 <lambdabot> with actual type ‘[a0 -> Int]’
07:19:02 <int-e> > map (index ((0,0),(3,3))) [(0,0),(0,1),(1,0),(3,3),(4,1)]
07:19:04 <lambdabot> [0,1,4,15,*Exception: Error in array index
07:19:12 <dsal> That time you went too far.
07:19:42 <int-e> I just wanted to show where exactly the bounds are.
07:19:52 <dsal> :t ragne
07:19:53 <lambdabot> error:
07:19:53 <lambdabot> • Variable not in scope: ragne
07:19:53 <lambdabot> • Perhaps you meant ‘range’ (imported from Data.Ix)
07:19:53 <dsal> :t range
07:19:54 <lambdabot> Ix a => (a, a) -> [a]
07:19:58 <int-e> So the last pair was supposed to be out of range.
07:20:03 <dsal> :t ragne
07:20:04 <lambdabot> error:
07:20:04 <lambdabot> • Variable not in scope: ragne
07:20:04 <lambdabot> • Perhaps you meant ‘range’ (imported from Data.Ix)
07:20:07 <dsal> haha. I should go to sleep
07:20:17 <int-e> > range ((0,0,0),(1,1,1))
07:20:19 <lambdabot> [(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(1,1,0),(1,1,1)]
07:21:21 <dsal> So for these "square" problems, I just `BS.readFile` and then make bounds with `BS.elemIndices 10 b`
07:21:40 <dsal> No data structure is more efficient than no data structure.
07:21:55 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
07:24:50 <iqubic> I see..
07:24:57 <dsal> I'm kind of annoyed I had to write a `takeUntil` and also that I spent a while trying to even figure out what to call it.
07:25:15 <iqubic> She says, not really understanding.
07:25:23 <iqubic> dsal: I feel you
07:25:40 <dsal> heh
07:25:52 <dsal> Just give it a shot. Ix does the magic here.
07:26:33 <iqubic> I'm sure it does.
07:29:01 <glguy> I prefer UArray with a 2d coordinate indeed for the grid problems like these
07:29:06 <int-e> dsal: I ultimately went for `span` and testing whether the remainder was empty.
07:29:48 <dsal> Hmm... Yeah, span is a thing I always forget.
07:29:53 <glguy> https://github.com/glguy/advent/blob/main/solutions/src/2022/08.hs
07:30:15 <dsal> glguy :That's where I started. This is slightly inconvenient, but I like the "just read the file" data structure.
07:30:27 <glguy> I'm not consistent on when I use break or span
07:30:34 <xerox> I takeWhile the coords https://github.com/mrtnpaolo/advent-of-code-2022/blob/master/execs/Day08.hs
07:30:55 razetime_ joins (~quassel@49.207.203.213)
07:32:10 × dsrt^ quits (~dsrt@76.145.185.103) (Remote host closed the connection)
07:32:29 <dsal> I made this thing out of my clunky file reader: https://www.irccloud.com/pastebin/yS4bux1k/thing.hs
07:34:44 meinside joins (uid24933@id-24933.helmsley.irccloud.com)
07:35:46 <glguy> I didn't end up bothering with digitToInt; we just needed comparisons :)
07:36:22 <xerox> hehe
07:40:30 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
07:47:40 <dsal> Yeah, I can't remember why I did that. I think that was just part of how I was debugging.
07:50:49 zeenk joins (~zeenk@2a02:2f04:a30d:4300::7fe)
07:53:01 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
07:53:29 nschoe joins (~q@141.101.51.197)
07:56:13 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds)
08:00:27 mncheck joins (~mncheck@193.224.205.254)
08:01:47 × ft quits (~ft@p508dbd59.dip0.t-ipconnect.de) (Quit: leaving)
08:05:51 × notzmv quits (~zmv@user/notzmv) (Ping timeout: 265 seconds)
08:07:10 kenran joins (~user@user/kenran)
08:09:09 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
08:10:40 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 268 seconds)
08:11:10 werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net)
08:11:55 × kenran quits (~user@user/kenran) (Ping timeout: 252 seconds)
08:13:45 lortabac joins (~lortabac@2a01:e0a:541:b8f0:9ec2:49f5:ac35:545a)
08:14:09 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds)
08:14:15 troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua)
08:18:13 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
08:22:18 cfricke joins (~cfricke@user/cfricke)
08:25:55 acidjnk_new joins (~acidjnk@p200300d6e7137a767ca9aed60fa8d1f2.dip0.t-ipconnect.de)
08:29:32 michalz joins (~michalz@185.246.204.93)
08:33:24 coot joins (~coot@213.134.171.3)
08:39:47 × azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds)
08:46:35 avicenzi joins (~avicenzi@2a00:ca8:a1f:b004::c32)
08:49:57 zant1 joins (~zant@62.214.20.26)
08:54:18 × razetime_ quits (~quassel@49.207.203.213) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
09:04:47 raehik joins (~raehik@92.40.212.207.threembb.co.uk)
09:07:59 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
09:18:23 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Remote host closed the connection)
09:18:50 × califax quits (~califax@user/califx) (Remote host closed the connection)
09:19:12 × Scraeling quits (~Scraeling@user/scraeling) (Quit: Scraeling)
09:21:05 × raehik quits (~raehik@92.40.212.207.threembb.co.uk) (Ping timeout: 255 seconds)
09:21:15 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 265 seconds)
09:23:42 califax joins (~califax@user/califx)
09:32:03 MajorBiscuit joins (~MajorBisc@145.94.137.174)
09:35:08 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
09:35:20 alexiscott joins (~user@4.red-83-36-45.dynamicip.rima-tde.net)
09:37:38 raehik joins (~raehik@92.40.212.159.threembb.co.uk)
09:38:18 × paulpaul1076 quits (~textual@95-29-5-111.broadband.corbina.ru) (Read error: Connection reset by peer)
09:39:59 Ellenor joins (ellenor@callbox.trd.is)
09:40:05 × tzh quits (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz)
09:43:24 × raehik quits (~raehik@92.40.212.159.threembb.co.uk) (Ping timeout: 260 seconds)
09:44:57 raehik joins (~raehik@92.40.213.222.threembb.co.uk)
09:45:20 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
09:46:41 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
09:51:22 × causal quits (~user@50.35.85.7) (Quit: WeeChat 3.7.1)
09:51:48 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds)
09:51:48 × raehik quits (~raehik@92.40.213.222.threembb.co.uk) (Ping timeout: 268 seconds)
09:54:35 VY2 joins (~user@213.24.126.232)
10:00:17 jakalx parts (~jakalx@base.jakalx.net) (Disconnected: Replaced by new connection)
10:00:21 jakalx joins (~jakalx@base.jakalx.net)
10:03:41 russruss joins (~russruss@my.russellmcc.com)
10:04:41 × russruss quits (~russruss@my.russellmcc.com) (Client Quit)
10:07:22 russruss joins (~russruss@my.russellmcc.com)
10:13:35 mmhat joins (~mmh@p200300f1c73b51dfee086bfffe095315.dip0.t-ipconnect.de)
10:14:05 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 260 seconds)
10:16:13 Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915)
10:16:18 notzmv joins (~zmv@user/notzmv)
10:16:39 × xff0x quits (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) (Ping timeout: 260 seconds)
10:18:02 kavvadias joins (~kavvadias@2001:9e8:630f:d300:9b55:5cee:bc98:2a71)
10:18:50 CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de)
10:18:52 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
10:19:39 aliosablack joins (~chomwitt@2a02:587:7a0c:6a00:1ac0:4dff:fedb:a3f1)
10:23:07 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Ping timeout: 248 seconds)
10:23:10 cybersoul joins (~cybersoul@2405:201:680a:b01d:8ad:2a0c:230c:f77)
10:25:38 Ybombinator joins (~Ybombinat@81.198.69.124)
10:33:17 × zeenk quits (~zeenk@2a02:2f04:a30d:4300::7fe) (Quit: Konversation terminated!)
10:34:22 × acidjnk_new quits (~acidjnk@p200300d6e7137a767ca9aed60fa8d1f2.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
10:41:58 × troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 265 seconds)
10:42:22 raehik joins (~raehik@92.40.169.175.threembb.co.uk)
10:45:25 × kavvadias quits (~kavvadias@2001:9e8:630f:d300:9b55:5cee:bc98:2a71) (Quit: Client closed)
10:48:16 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
10:48:19 johnw joins (~johnw@76-234-69-149.lightspeed.frokca.sbcglobal.net)
10:54:05 <dminuoso> Repa is quite nice for working with 2-dimensional data
10:54:37 <dminuoso> It lets you have unboxed vectors beneath, but with a comfortable high level 2-dimensional index style
10:55:01 <dminuoso> (It nicely extends to arbitrary dimensions too)
10:56:06 × perrierjouet quits (~perrier-j@modemcable048.127-56-74.mc.videotron.ca) (Quit: WeeChat 3.7.1)
10:57:33 perrierjouet joins (~perrier-j@modemcable048.127-56-74.mc.videotron.ca)
10:58:12 × mmhat quits (~mmh@p200300f1c73b51dfee086bfffe095315.dip0.t-ipconnect.de) (Quit: WeeChat 3.7.1)
11:00:45 × raehik quits (~raehik@92.40.169.175.threembb.co.uk) (Ping timeout: 260 seconds)
11:02:08 × VY2 quits (~user@213.24.126.232) (Quit: ERC 5.4 (IRC client for GNU Emacs 28.2))
11:04:00 × Ybombinator quits (~Ybombinat@81.198.69.124) (Ping timeout: 256 seconds)
11:04:08 xff0x joins (~xff0x@ai071162.d.east.v6connect.net)
11:04:34 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
11:07:00 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
11:07:29 Ybombinator joins (~Ybombinat@85.254.75.8)
11:07:42 × AndreasK quits (sid320732@id-320732.uxbridge.irccloud.com) (Quit: Connection closed for inactivity)
11:09:24 × meooow_ quits (~meooow@165.232.184.169) (Remote host closed the connection)
11:09:57 meooow joins (~meooow@2400:6180:100:d0::ad9:e001)
11:14:46 <Ybombinator> "sum (x:xs) = x + sum xs" is a folding function, right?
11:14:52 kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be)
11:16:50 dextaa5 joins (~DV@user/dextaa)
11:17:05 <mauke> foldr
11:17:19 <Ybombinator> ah
11:17:44 <mauke> > foldr (+) 0 [a, b, c]
11:17:46 <lambdabot> a + (b + (c + 0))
11:17:53 Sindai joins (~Sindai@2a01cb0583e8cd000544677d81e0b920.ipv6.abo.wanadoo.fr)
11:18:01 <mauke> > foldl (+) 0 [a, b, c]
11:18:03 <lambdabot> 0 + a + b + c
11:18:50 × dextaa quits (~DV@user/dextaa) (Ping timeout: 260 seconds)
11:18:50 dextaa5 is now known as dextaa
11:19:19 <Ybombinator> yeah thanks
11:19:33 Lycurgus joins (~juan@user/Lycurgus)
11:20:20 × Sindai quits (~Sindai@2a01cb0583e8cd000544677d81e0b920.ipv6.abo.wanadoo.fr) (Quit: Client closed)
11:21:57 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds)
11:25:44 akegalj joins (~akegalj@141-136-183-112.dsl.iskon.hr)
11:29:28 acidjnk_new joins (~acidjnk@p200300d6e7137a76b0b8eea36f8bd0e7.dip0.t-ipconnect.de)
11:32:22 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.7.1)
11:40:27 × aliosablack quits (~chomwitt@2a02:587:7a0c:6a00:1ac0:4dff:fedb:a3f1) (Ping timeout: 248 seconds)
11:42:00 nyr joins (~nyr@91.196.39.241)
11:45:10 × econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity)
11:46:52 × Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5)
11:51:14 × nyr quits (~nyr@91.196.39.241) (Quit: WeeChat 3.7.1)
11:52:15 nyr joins (~nyr@91.196.39.241)
11:52:37 chomwitt joins (~chomwitt@athedsl-351826.home.otenet.gr)
11:54:31 beteigeuze joins (~Thunderbi@a79-169-109-107.cpe.netcabo.pt)
12:00:47 gurkenglas joins (~gurkengla@p548ac72e.dip0.t-ipconnect.de)
12:02:07 merijn joins (~merijn@86-86-29-250.fixed.kpn.net)
12:02:12 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 265 seconds)
12:04:44 × nyr quits (~nyr@91.196.39.241) (Quit: WeeChat 3.7.1)
12:05:40 <dminuoso> Mmm, is there a nice way to build a literal list with elements possibly depending on some ambient condition?
12:05:56 <dminuoso> Some kind of `[a, b ? if foo, c ? if bar]`
12:06:37 <dminuoso> My current solution involves just using a dlist where just conditionally concatenate an emptyDList or a `singleton foo`
12:07:00 <dminuoso> catMaybes is another one, but that feels awkward as well
12:07:23 Guest75 joins (Guest75@2a01:7e01::f03c:92ff:fe5d:7b18)
12:14:04 × alexiscott quits (~user@4.red-83-36-45.dynamicip.rima-tde.net) (Remote host closed the connection)
12:17:53 <Cale> concat [[a], [b | foo], [c | bar]]
12:18:49 doyougnu joins (~doyougnu@cpe-74-69-132-225.stny.res.rr.com)
12:29:35 <dminuoso> Cale: Mmm I like that.
12:29:48 <Lears> dminuoso: I'm not sure what you want with "literal" here, but I always end up writing `mwhen :: Monoid a => Bool -> a -> a` and using it all over the place; something like `[a] <> mwhen foo [b] <> mwhen bar [c]`.
12:31:14 <dminuoso> Lears: Heh I actually use exactly that mwhen in some of my prettyprinter uses
12:31:23 <dminuoso> Didn't occur to me to use it with lists
12:38:13 <jackdk> Lears: I like `fold :: Monoid m => Maybe m -> m` as a similar trick
12:39:06 shriekingnoise joins (~shrieking@186.137.167.202)
12:42:20 <merijn> dminuoso, Lears: Yeah, it's a super useful function, my campaign to get it in base stranded on naming difficulties, though
12:43:00 <merijn> mwhen/mif were some candidates, but I'm not sure
12:43:07 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
12:45:06 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
12:45:36 <Lears> While we're at it, I also like `mfor :: (Foldable f, Monoid b) => f a -> (a -> b) -> b; mfor = flip foldMap`; and `whenA`/`forA` variants on Applicatives, using `Ap` internally. I believe these are the best names in terms of established conventions and clash avoidance.
12:52:09 cfricke joins (~cfricke@user/cfricke)
12:53:47 jakalx joins (~jakalx@base.jakalx.net)
13:00:31 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
13:08:30 × gurkenglas quits (~gurkengla@p548ac72e.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
13:27:47 × califax quits (~califax@user/califx) (Ping timeout: 255 seconds)
13:28:37 × use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:556e:28e8:6695:53e8) (Remote host closed the connection)
13:28:55 use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf)
13:29:32 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection)
13:31:38 × stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection)
13:31:56 zeenk joins (~zeenk@2a02:2f04:a30d:4300::7fe)
13:32:50 <jackdk> I sometimes call `mfor` `paMdolf`. Relude has a `foldMapA` which is often very handy
13:34:05 × jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 255 seconds)
13:35:16 × CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
13:35:26 × FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 255 seconds)
13:37:24 <dminuoso> jackdk: I see, so what you're really after is -XFlippedIdentifiers, where `pamf` is automatically replaced by `flip fmap`
13:37:35 <dminuoso> Wouldn't that be a fun language thing.
13:38:20 <dminuoso> Palindrome identifiers better be commutative
13:38:25 × chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection)
13:39:13 × Chai-T-Rex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection)
13:39:40 Erutuon joins (~Erutuon@user/erutuon)
13:40:08 Chai-T-Rex joins (~ChaiTRex@user/chaitrex)
13:40:17 califax joins (~califax@user/califx)
13:41:21 <opqdonut> lovely
13:45:40 × califax quits (~califax@user/califx) (Quit: ZNC 1.8.2 - https://znc.in)
13:45:47 × Chai-T-Rex quits (~ChaiTRex@user/chaitrex) (Ping timeout: 255 seconds)
13:46:41 × ec_ quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds)
13:48:08 ec_ joins (~ec@gateway/tor-sasl/ec)
13:49:58 <[exa]> > dɐɯɟ (Just 5) negate
13:50:00 <lambdabot> error:
13:50:00 <lambdabot> Variable not in scope: dɐɯɟ :: Maybe a0 -> (a1 -> a1) -> t
13:50:01 <Profpatsch> Player-205[m]: The (999 :: Word8) == 231 is the same as 999 `mod` 256 == 231
13:50:16 <Profpatsch> Because a Word8 can only fit 256
13:50:23 <Profpatsch> 255
13:50:38 <[exa]> I can't wait for `for = dɐɯ`
13:50:43 califax joins (~califax@user/califx)
13:50:46 <int-e> Hecate: I think the idea is that since 999 is too big to fit into a Word8, only the 99 part should be parsed. Which... I guess is a possible design choice, though I would definitely not agree that reads @Word8 "999" == [(99, "9")] is a *good* choice
13:50:56 chexum joins (~quassel@gateway/tor-sasl/chexum)
13:50:57 <Profpatsch> Haskell uses the common behaviour of modular arithmetic for the underlying function
13:51:42 <int-e> (I'd have more sympathy with a parse error, but that's not the choice the library designers made.)
13:53:31 <Profpatsch> int-e: for Enum/Bounded types, the docs say “The calls succ maxBound and pred minBound should result in a runtime error.”
13:53:38 × doyougnu quits (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Ping timeout: 246 seconds)
13:53:43 <Profpatsch> and “fromEnum and toEnum should give a runtime error if the result value is not representable in the result type”
13:53:50 <Hecate> int-e: hence my question about the presence of this pattern elsewhere, I'm quite susoucuiys about it
13:53:54 doyougnu joins (~doyougnu@cpe-74-69-132-225.stny.res.rr.com)
13:53:59 <Profpatsch> So arguably GHC wrapping integer literals is the wrong behaviour
13:55:04 <int-e> Hecate: Right, but that's a question for Player205[m].
13:55:20 <Hecate> aye
13:57:19 × acidjnk_new quits (~acidjnk@p200300d6e7137a76b0b8eea36f8bd0e7.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
13:57:51 Chai-T-Rex joins (~ChaiTRex@user/chaitrex)
13:57:53 werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net)
13:58:43 × ec_ quits (~ec@gateway/tor-sasl/ec) (Remote host closed the connection)
13:58:43 × califax quits (~califax@user/califx) (Remote host closed the connection)
14:00:05 L29Ah joins (~L29Ah@wikipedia/L29Ah)
14:00:37 ec_ joins (~ec@gateway/tor-sasl/ec)
14:02:43 califax joins (~califax@user/califx)
14:02:59 jpds2 joins (~jpds@gateway/tor-sasl/jpds)
14:05:05 <dminuoso> Profpatsch: Indeed, and this is actually common in other parser combinator libraries sadly
14:05:38 <dminuoso> https://hackage.haskell.org/package/attoparsec-0.14.4/docs/Data-Attoparsec-Text.html#v:decimal
14:05:40 <dminuoso> decimal :: Integral a => Parser a
14:05:42 <Profpatsch> dminuoso: It’s highly non-trivial to not get random wrapping
14:05:50 <Profpatsch> like, it’s easy to make a mistake
14:05:50 <dminuoso> It's not.
14:05:57 <dminuoso> I think its very trivial
14:06:06 festive_kurbus joins (~festive_k@user/kurbus)
14:06:36 <Profpatsch> dminuoso: let’s say wrapping behaviour is pervasive simply because it’s the default & the easiest thing to reach for
14:06:44 <Profpatsch> and it looks correct for simple examples
14:06:57 <dminuoso> I think the basic problem lies in the type annotation for this.
14:07:01 <Profpatsch> and it silently corrupts your data :)
14:07:18 <dminuoso> So the main problem in `decimal` from attoparsec, is that the type is incredibly deceiptful
14:07:23 <dminuoso> If instead it read:
14:07:28 <dminuoso> `decimal :: Parser Integer`
14:07:42 <dminuoso> Then it would be dead obvious if you wanted to turn this into a Word8 you either have to check bounds, or accept some overflow behavior.
14:07:46 <Profpatsch> dminuoso: yes, our internal parsers wrap it like this
14:08:05 <Profpatsch> the base problem is that `fromInteger` should not exist
14:08:13 <Profpatsch> It’s a design issue in `Num`
14:08:21 <dminuoso> https://hackage.haskell.org/package/int-cast should be part of base.
14:08:46 <Profpatsch> fromIntegral
14:08:58 <Profpatsch> (fromIntegral and fromInteger both existing is another design problem)
14:09:26 <dminuoso> Profpatsch: another problem with the attoparsec style is that it provides for denial of service vectors
14:09:42 <Profpatsch> dminuoso: It depends
14:09:52 <Profpatsch> if you are parsing Scientific -> Integer then yes
14:09:55 <dminuoso> Since even if you do explicit bounds checks, it will first attempt to parse an arbitrarily long number
14:09:57 <Profpatsch> but if you are going Text -> Integer
14:09:58 <int-e> > read ('"' : repeat ' ') :: Int
14:10:04 <lambdabot> mueval-core: Time limit exceeded
14:10:22 <Profpatsch> then you need the same (or rather: more) memory just for having the Text first
14:10:28 <Profpatsch> so I’d argue it’s not a DoS
14:10:43 <dminuoso> Profpatsch: Which is why my flatparser `readInt` will directly just calculate the number along the way and fail on overflow, rather than going through Integer first.
14:11:04 <dminuoso> Profpatsch: Not necessarily, in megaparsec or attoparsec it could be streamed.
14:11:12 <Profpatsch> unless you parse incrementally, but then you already have a problem in your setup if you can be passed a number that explodes your RAM
14:11:14 × money quits (money@user/polo) ()
14:11:50 <Profpatsch> As I said, parsing numbers is a highly nontrivial thing to do unfortunately :(
14:12:02 <dminuoso> I dont think of it as highly nontrivial.
14:12:02 × Ybombinator quits (~Ybombinat@85.254.75.8) (Ping timeout: 268 seconds)
14:12:10 <dminuoso> Its very trivial, you just need to be explicit about what you want
14:12:21 <Profpatsch> like, if you are parsing a JSON then your json can already blow up your memory
14:12:30 <Profpatsch> unless you have e.g. a http body size restriction
14:12:38 <Profpatsch> same for Text -> Integer
14:12:51 <Profpatsch> But Scientific -> Integer is a different class of exploitable
14:13:02 <Profpatsch> cause the memory blowup is not linear with input size
14:13:32 FinnElija joins (~finn_elij@user/finn-elija/x-0085643)
14:13:37 <dminuoso> Besides, part of why I dont like roundtripping through Integer is that by default you will pay some performance penalties.
14:14:16 <Profpatsch> dminuoso: I agree, I will replace Atto with your library if it ever becomes a performance bottleneck :)
14:14:52 <Profpatsch> Integer is like two orders of magnitude less performant than an unboxed Int64
14:14:52 dminuoso has replaced most of his attoparsec usages with flatparse already :)
14:14:57 <Profpatsch> maybe more
14:15:11 <dminuoso> Profpatsch: Well, depending on usage its probably not a big deal since if you immediately case-of it will disappear anyway
14:15:58 <dminuoso> At any rate, the bigger problem in attoparsec is not going through Integer, its that it will automatically fromIntegral for you.
14:16:00 <Profpatsch> dminuoso: hm, if you want to go back to `Int` again, then you have to either have a branch & throw an error manually, or you are back to wrapping behaviour.
14:16:06 <dminuoso> Yup
14:16:14 <Profpatsch> So either slow or wrong
14:16:18 <dminuoso> well "fsvo" slow.
14:16:27 <dminuoso> It's only going to be a bunch of cpu instructions realistically
14:16:40 × sammelweis quits (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) (Ping timeout: 256 seconds)
14:16:47 <Profpatsch> In a tight parsing loop that’s a lot
14:17:11 <Profpatsch> But then why are you using Haskell in the first place :P
14:18:58 sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10)
14:19:20 <dminuoso> Sure, but if you're already in that tight of a loop and that branch cost becomes relevant, you probably should not be using attoparsec anyway
14:19:32 × festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed)
14:20:06 × cybersoul quits (~cybersoul@2405:201:680a:b01d:8ad:2a0c:230c:f77) (Quit: Leaving)
14:20:06 × doyougnu quits (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Remote host closed the connection)
14:21:13 stiell joins (~stiell@gateway/tor-sasl/stiell)
14:22:29 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
14:27:15 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Ping timeout: 260 seconds)
14:30:50 raehik joins (~raehik@213.86.197.10)
14:44:23 kenran joins (~user@user/kenran)
14:46:59 × kenran quits (~user@user/kenran) (Remote host closed the connection)
14:47:39 × califax quits (~califax@user/califx) (Read error: Connection reset by peer)
14:47:39 × ec_ quits (~ec@gateway/tor-sasl/ec) (Remote host closed the connection)
14:47:39 × stiell quits (~stiell@gateway/tor-sasl/stiell) (Write error: Connection reset by peer)
14:47:39 × Chai-T-Rex quits (~ChaiTRex@user/chaitrex) (Write error: Connection reset by peer)
14:47:39 × jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Write error: Connection reset by peer)
14:51:06 wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com)
14:51:06 × wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host)
14:51:06 wroathe joins (~wroathe@user/wroathe)
14:53:30 × raehik quits (~raehik@213.86.197.10) (Ping timeout: 260 seconds)
14:56:07 azimut joins (~azimut@gateway/tor-sasl/azimut)
14:57:20 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 246 seconds)
14:58:04 danza joins (~francesco@93.176.139.150)
14:59:14 <kuribas> integers in sbcl (CL) are pretty fast
14:59:40 <kuribas> it uses machine integers until an overflow occurs, then switches to bigints
14:59:51 <merijn> kuribas: I mean, so does GHC :p
14:59:59 <kuribas> merijn: then why is it so much slower?
15:00:16 <merijn> Citation Needed?
15:01:18 <kuribas> merijn: above comment by ProfPatch
15:01:26 <kuribas> Profpatsch
15:01:55 <kuribas> <Profpatsch> Integer is like two orders of magnitude less performant than an unboxed Int64
15:01:55 <kuribas>
15:02:09 <kuribas> perhaps when storing them in a vector...
15:02:19 <merijn> It Depends (TM) on a billion things
15:02:19 <kuribas> looping over an unboxed vector is pretty fast.
15:02:23 <[exa]> was the integer boxed?
15:02:35 × notzmv quits (~zmv@user/notzmv) (Ping timeout: 248 seconds)
15:03:11 <merijn> kuribas: I mean, SBCL and GHC use (or at least used) the same bigint implementation :p
15:03:14 <merijn> kuribas: https://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/
15:03:55 <merijn> ah, wait, sbcl doesn't use GMP
15:04:26 <kuribas> merijn: but sbcl uses machine integers until they overflow, then it switches to bigint.
15:04:44 <kuribas> merijn: I suppose ghc always uses bigint for Integer?
15:04:44 <c_wraith> so does Integer, last I checked
15:04:50 <kuribas> right
15:04:51 <merijn> kuribas: GHC uses machine integers and overflows into GMP
15:05:16 <merijn> kuribas: https://hackage.haskell.org/package/ghc-bignum-1.3/docs/src/GHC.Num.Integer.html#Integer
15:06:10 Chai-T-Rex joins (~ChaiTRex@user/chaitrex)
15:06:33 califax joins (~califax@user/califx)
15:07:49 × szkl quits (uid110435@id-110435.uxbridge.irccloud.com) (Quit: Connection closed for inactivity)
15:08:10 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
15:09:10 Sgeo joins (~Sgeo@user/sgeo)
15:11:48 jpds2 joins (~jpds@gateway/tor-sasl/jpds)
15:12:06 ec_ joins (~ec@gateway/tor-sasl/ec)
15:12:53 jakalx joins (~jakalx@base.jakalx.net)
15:16:43 L29Ah parts (~L29Ah@wikipedia/L29Ah) ()
15:18:46 L29Ah joins (~L29Ah@wikipedia/L29Ah)
15:19:41 × jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection)
15:21:36 shapr joins (~user@68.54.166.125)
15:22:46 raehik joins (~raehik@213.86.197.10)
15:22:54 L29Ah parts (~L29Ah@wikipedia/L29Ah) ()
15:24:16 L29Ah joins (~L29Ah@wikipedia/L29Ah)
15:25:22 jpds2 joins (~jpds@gateway/tor-sasl/jpds)
15:26:14 <dolio> What is "pretty fast"?
15:26:39 <dolio> Have you checked that SBCL's integers aren't two orders of magnitude slower than unboxed Int64?
15:27:47 × raehik quits (~raehik@213.86.197.10) (Ping timeout: 264 seconds)
15:30:17 × use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf) (Remote host closed the connection)
15:30:37 use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf)
15:32:52 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
15:33:09 <dminuoso> Here is a cute take on query generation with postgresql-simple and nanolenses: https://gist.github.com/dminuoso/2f30d91630cb5dbf168765ce3bac8a74
15:35:32 gwern joins (~gwern@user/gwern)
15:35:39 stiell joins (~stiell@gateway/tor-sasl/stiell)
15:38:02 <gwern> so I have a (sigh) stdin question. for a cli utility, I want to read any stdin contents if there are any, and otherwise continue processing CLI arguments as normal. even using strict IO.getContents, not unsurprisingly, winds up blocking indefinitely. what do?
15:38:25 <dminuoso> In some of my uses I have to massage queries into CTEs first, so I can have a singular uniform where clause at the end. :)
15:39:26 <dminuoso> gwern: hGetBufNonBlocking perhaps?
15:39:36 <merijn> gwern: You want System.IO
15:39:46 <merijn> gwern: and/or the ByteString/Text versions
15:40:02 <merijn> gwern: Which have all the standard read/write operations on files you are used to in other languages
15:40:23 × sammelweis quits (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) (Quit: No Ping reply in 180 seconds.)
15:40:38 <dminuoso> Indeed, bytestring has hGetNonBlocking directly, which is a bit more comfortable to use than hGetBufNonBlocking (which you likely have to massage into a bytestring anyway)
15:40:54 <gwern> 'hGetBufNonBlocking is identical to hGetBuf, except that it will never block waiting for data to become available, instead it returns only whatever data is available. To wait for data to arrive before calling hGetBufNonBlocking, use hWaitForInput.' https://hackage.haskell.org/package/base-4.17.0.0/docs/System-IO.html#v:hGetBufNonBlocking hm...
15:40:59 <merijn> https://hackage.haskell.org/package/base-4.17.0.0/docs/System-IO.html#g:2
15:41:01 <merijn> https://hackage.haskell.org/package/bytestring-0.11.3.1/docs/Data-ByteString.html#g:27
15:41:09 <merijn> https://hackage.haskell.org/package/text-2.0.1/docs/Data-Text-IO.html
15:41:21 <dminuoso> https://hackage.haskell.org/package/bytestring-0.11.3.1/docs/Data-ByteString.html#v:hGetNonBlocking
15:41:24 <dminuoso> In particular for bytestring
15:41:37 <dminuoso> merijn: I dont think text has a non-blocking interface for this
15:42:00 sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10)
15:42:07 <merijn> dminuoso: Sure, but you can test for data availability
15:42:28 <dminuoso> How do you do that?
15:42:48 <dminuoso> Oh you mean with hGetContents?
15:42:56 <geekosaur> hWaitForInput?
15:43:13 <geekosaur> no, that blocksa
15:43:20 <merijn> handroll something application specific using STM :p
15:43:25 <dminuoso> Im really not sure how you can do any of this without hGetBufNonBlocking
15:43:28 <dminuoso> (directly or indirectly)
15:43:42 jakalx joins (~jakalx@base.jakalx.net)
15:43:43 <dminuoso> The bytestring wrapper is what you would end up buildign anyway, so I would just use that
15:44:39 <merijn> https://hackage.haskell.org/package/base-4.17.0.0/docs/System-IO.html#v:hReady
15:45:01 <dminuoso> Ah! That would work yes.
15:45:40 <merijn> gwern: At any rate, as you can see, plenty of tools besides getContents :)
15:46:06 <gwern> er, I suppose. I'm still staring at all the constructors a Handle apparently requires
15:46:27 <gwern> ('NoBuffering ReadMode nativeNewline' ok... but wtf is a 'dev')
15:47:12 <merijn> gwern: I mean, there is a pre-defined stdin Handle ;)
15:47:30 <merijn> And you're not really supposed to hand make them
15:47:42 <gwern> oh, of course it'd be in an entirely diferent module... https://hackage.haskell.org/package/base-4.14.1.0/docs/GHC-IO-Handle-FD.html#v:stdin -_-
15:47:47 <merijn> % :t System.IO.stdin
15:47:47 <yahb2> System.IO.stdin :: GHC.IO.Handle.Types.Handle
15:48:06 <merijn> gwern: stdin is just in/exported from System.IO
15:48:07 <Guest75> Hello. In my code, I seldom randomly access a list (!!), mostly iterate over it, and also need pattern match (x:xs). At the same time I intercat a lot with Aeson. Should I still prefer List over Vector for my data?
15:48:10 <merijn> together with stdout/stderr
15:48:11 <dminuoso> "Merijn's Amazing Handle Manufactory"
15:49:36 <dminuoso> Guest75: You can stick to vector, and if you want to pattern match on it regularly, you could make yourself a pattern synonym
15:50:01 <gwern> merijn: yes, but I'm not reading System.IO because that's not where 'hGetBufNonBlocking' is documented. and where 'hGetBufNonBlocking' is documented, 'Handle' hyperlinks you to https://hackage.haskell.org/package/base-4.14.1.0/docs/GHC-IO-Handle.html#t:Handle and inside GHC.IO.Handle there is no indication of a predefined 'stdin' (I did C-f but the only mention of 'stdin' didn't seem to have...
15:50:07 <gwern> ...anything to do with a predefined stdin Handle)
15:50:07 <dminuoso> Guest75: Its hard to say in general, though
15:50:13 <byorgey> Guest75: are you saying that your code currently uses lists?
15:50:41 <Guest75> yes. I have written it using lists. and doing (V.toList a) a lot
15:50:53 <byorgey> Guest75: is it too slow? Or is the performance acceptable?
15:51:11 <Guest75> I think acceptable. I didn't measure
15:51:24 <byorgey> ok, then if I were you I wouldn't bother updating to use Vector
15:51:35 <Guest75> aha. thanks
15:51:56 <Guest75> OTOH I should always prefer Text over String right? :-)
15:52:09 <byorgey> It depends =)
15:52:28 <Guest75> Does string support unicode? :/
15:52:29 <dminuoso> gwern: though keep in mind, that hReady could result in a TOCTOU race
15:52:36 <byorgey> But in general, yes, Text is a better default
15:52:42 <byorgey> yes, String supports unicode
15:52:45 <byorgey> because Char does
15:52:49 <Guest75> aha
15:52:58 <dminuoso> Guest75: which if you end up using blocking hGetContents will leave you unhappy
15:53:05 <dminuoso> gwern: sorry.
15:54:00 <Guest75> dminuoso: that's for sterams, or something.... Like stdin/stdout I believe
15:54:14 <dminuoso> Guest75: I meant another person, sorry.
15:54:25 <Guest75> ah np
15:54:25 ubert1 joins (~Thunderbi@2a02:8109:abc0:6434:ca01:21c9:7b00:2bcf)
15:54:36 <dminuoso> 16:52:36 byorgey | But in general, yes, Text is a better default
15:54:41 <dminuoso> I wish I could say that with your confidence.
15:55:05 <dminuoso> While I *want* it to be a better default, the frequency by which you have to pack your text back to satisfy other folks interfaces..
15:55:15 <dminuoso> Or unpack rather, I suppose.
15:57:24 Guest75 is still trying to remember the order of TL.decodeUtf8 TL.pack
15:58:19 gwern certainly spends a ridiuculous amount of time, code, and computer time packing and unpacking strings into various types
15:58:31 <gwern> for example, right now...
15:58:42 <gwern> '• Couldn't match type ‘GHC.Word.Word8’ with ‘Char’ Expected: String' hello darkness my old friend
16:00:18 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:9ec2:49f5:ac35:545a) (Quit: WeeChat 2.8)
16:01:45 <shapr> ghci 8.10.7 on termux on Android doesn't want to load .so files. I can't tell if it's user error or a limitation of ghci on Android. Any hints where I could learn more?
16:04:12 × opticblast quits (~Thunderbi@secure-165.caltech.edu) (Quit: opticblast)
16:04:23 <shapr> That is, on x86 this works: ghci -L. -lchallenge_ristretto_ffi
16:04:26 <maerwald> uhm, d_type returns trash on armv7
16:04:27 opticblast joins (~Thunderbi@secure-165.caltech.edu)
16:05:23 <shapr> maerwald: meaning, I shouldn't expect this to work on aarch64?
16:05:41 <maerwald> no, totally unrelated
16:05:48 raehik joins (~raehik@213.86.197.10)
16:05:55 <geekosaur> shapr, I make no promises but termux abuses interfaces everywhere to work at all and ghci using its own loader instead of dlopen and friends probably breaks it
16:06:07 <maerwald> ghcup is broken on armv7 because d_type values are absolute nonsense
16:06:15 <maerwald> but it doesn't look like memory corruption either
16:06:39 <maerwald> the dirent struct has d_type clearly defined
16:07:54 × beteigeuze quits (~Thunderbi@a79-169-109-107.cpe.netcabo.pt) (Ping timeout: 255 seconds)
16:08:03 <shapr> Hm, I'll see if GHC will do the right thing compiling source with FFI calls.
16:13:10 festive_kurbus joins (~festive_k@user/kurbus)
16:13:45 beteigeuze joins (~Thunderbi@a79-169-109-107.cpe.netcabo.pt)
16:16:14 <gwern> looks like `stdin <- fmap E.decodeUtf8 $ Data.ByteString.hGetNonBlocking System.IO.stdin 999999` using 'import System.IO (stdin) / import qualified Data.ByteString (hGetNonBlocking) / import Data.Text.Encoding as E (decodeUtf8)' works
16:17:24 × merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 248 seconds)
16:18:11 × beteigeuze quits (~Thunderbi@a79-169-109-107.cpe.netcabo.pt) (Ping timeout: 260 seconds)
16:18:46 <gwern> dminuoso: yeah, the race condition is fine here because my usecase is something like "$ echo 'https://en.wikipedia.org/wiki/Subvocalization' | changeTag.hs psychology/inner-monologue" - given how long it takes ghci to boot up, all stdin inputs should be available eons before ghci ever gets around to hGetNonBlocking, and since it's intended for my interactive use, in the unusual case where the...
16:18:52 <gwern> ...race condition drops inputs and bypasses other checks like '>=2 arguments total', I will notice either by the logging output omitting a particular URL or eventually because that URL didn't get tagged right
16:21:19 <dminuoso> gwern: I was thinking of things like fork rather.
16:23:11 <gwern> (oh. hm, there's some recursion here but no OS-level fork() or anything so I shouldn't have to worry about anything like that)
16:24:32 × Kaiepi quits (~Kaiepi@108.175.84.104) (Ping timeout: 246 seconds)
16:26:14 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.7.1)
16:28:01 × raehik quits (~raehik@213.86.197.10) (Ping timeout: 252 seconds)
16:29:05 beteigeuze joins (~Thunderbi@bl14-81-220.dsl.telepac.pt)
16:29:06 × jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection)
16:31:24 × danza quits (~francesco@93.176.139.150) (Ping timeout: 268 seconds)
16:31:30 Kaiepi joins (~Kaiepi@108.175.84.104)
16:31:52 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
16:32:17 machinedgod joins (~machinedg@d198-53-218-113.abhsia.telus.net)
16:32:29 jpds2 joins (~jpds@gateway/tor-sasl/jpds)
16:34:19 × nschoe quits (~q@141.101.51.197) (Ping timeout: 248 seconds)
16:35:35 × beteigeuze quits (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Ping timeout: 264 seconds)
16:44:16 <sm> making that a stack script would speed it up (recompiles as needed)
16:44:29 danza joins (~francesco@93.176.139.150)
16:46:39 Tuplanolla joins (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi)
16:55:25 <carbolymer> is there a dark version of hackage? my floaters are pissing me off
16:56:05 <shapr> does that help?
16:56:52 troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua)
17:03:27 × shapr quits (~user@68.54.166.125) (Remote host closed the connection)
17:06:43 × kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Quit: ERC (IRC client for Emacs 27.1))
17:07:42 <maerwald[m]> dminuoso: https://github.com/haskell/ghcup-hs/issues/415#issuecomment-1343005271
17:07:51 <maerwald[m]> Any ideas?
17:09:17 tzh joins (~tzh@c-24-21-73-154.hsd1.or.comcast.net)
17:09:56 bontaq joins (~user@ool-45779fe5.dyn.optonline.net)
17:10:08 <maerwald[m]> Maybe some endiannes bug
17:10:22 <maerwald[m]> But doesn't happen on aarch64
17:10:54 × festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed)
17:15:34 festive_kurbus joins (~festive_k@user/kurbus)
17:15:37 × mbuf quits (~Shakthi@49.205.85.230) (Remote host closed the connection)
17:16:48 pagnol joins (~user@213-205-209-87.ftth.glasoperator.nl)
17:18:47 Guest141 joins (~Guest14@76.136.124.61)
17:19:07 × Guest141 quits (~Guest14@76.136.124.61) (Client Quit)
17:22:29 × MajorBiscuit quits (~MajorBisc@145.94.137.174) (Ping timeout: 260 seconds)
17:22:47 <pagnol> what is this called? for all x, f (g x) = x
17:24:28 <monochrom> f is the left inverse of g, g is the right inverse of f. I may have "left" and "right" missplaced.
17:26:56 × ubert1 quits (~Thunderbi@2a02:8109:abc0:6434:ca01:21c9:7b00:2bcf) (Quit: ubert1)
17:29:29 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
17:31:39 <c_wraith> there are lots of other names for more specialized cases, but I'm not sure that matters.
17:36:05 × AlexZenon quits (~alzenon@178.34.151.8) (Ping timeout: 255 seconds)
17:36:24 jakalx joins (~jakalx@base.jakalx.net)
17:36:37 × festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed)
17:36:46 × Alex_test quits (~al_test@178.34.151.8) (Ping timeout: 268 seconds)
17:37:39 bazoo joins (~bazoo@93.51.40.51)
17:40:42 AlexZenon joins (~alzenon@178.34.151.8)
17:41:29 Alex_test joins (~al_test@178.34.151.8)
17:42:41 <bazoo> Is it possible in Haskell to declare an integer type parametrized over its min and max values so that it's checked at compile time?
17:44:00 <mauke> no
17:45:50 <bazoo> Not even with almost-dependent-types extensions?
17:45:52 <geekosaur> checking such at compile time requires that you carry around compile-time proofs that it is within the value limits, else it requires runtime checking
17:46:12 <geekosaur> as yet dependent types aren't even remotely supported enough to do this
17:46:23 <c_wraith> You can fake it if you're fine with only having literals
17:46:41 <c_wraith> If you ever need a non-literal, you need runtime checking
17:46:56 <bazoo> I  guess it would require both compile time and runtime checks, am I right? I guess it's what happens when you have a fixed vector and you apply fromList, for instance, right?
17:47:15 <c_wraith> though if you want to go a different direction, you can get a lot of that sort of checking at compile time from liquid haskell
17:48:46 <bazoo> LiquidHaskell seems interesting but I would love to keep inside GHC
17:49:28 <geekosaur> you're looking at the wrong language, really. this is idris stuff, not ghc
17:51:31 festive_kurbus joins (~festive_k@user/kurbus)
17:51:50 thyriaen joins (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1)
17:53:45 beteigeuze joins (~Thunderbi@85.247.81.220)
17:54:43 <mauke> if you could declare such a type, you couldn't use the usual Num operators with it
17:55:22 <mauke> like, imagine a + b where a, b :: BoundedInt 1 10
17:55:27 <mauke> the result type would be wrong
17:57:07 × danza quits (~francesco@93.176.139.150) (Ping timeout: 268 seconds)
18:02:11 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
18:03:19 × coot quits (~coot@213.134.171.3) (Quit: coot)
18:03:34 × pavonia quits (~user@user/siracusa) (Quit: Bye!)
18:04:51 econo joins (uid147250@user/econo)
18:05:04 × kritzefitz quits (~kritzefit@debian/kritzefitz) (Ping timeout: 260 seconds)
18:08:16 CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de)
18:09:08 <bazoo> mauke it kinda makes sense actually
18:16:57 <dminuoso> maerwald[m]: I cant make heads or tails of it. It cant be an endianness bug, because d_type is an `unsigned char` in glibc.
18:19:00 <dminuoso> It seems that all the dir types are just rubbish. Im feeling a memory corruption here.
18:19:06 <dminuoso> Or a general memory bug.
18:19:07 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
18:19:56 × razetime quits (~quassel@49.207.203.213) (Ping timeout: 268 seconds)
18:20:40 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Remote host closed the connection)
18:20:53 <dminuoso> If you restart ghci, do you consistently get the same dir types?
18:24:17 <dminuoso> My gut feeling says there's a severe bug in GHC code generation here.
18:24:35 <dminuoso> maerwald[m]: try removing `c_freeDirEnt` as an experiment.
18:25:34 <dminuoso> Though not even that makes sense. Mmm
18:31:05 × califax quits (~califax@user/califx) (Ping timeout: 255 seconds)
18:31:38 danza joins (~francesco@4.red-79-153-154.dynamicip.rima-tde.net)
18:34:10 <geekosaur> what version of ghc? could this be related to the ARM types thing in 9.2?
18:34:31 califax joins (~califax@user/califx)
18:35:12 <dminuoso> Wrong ARM version though
18:35:24 <geekosaur> true
18:35:24 <dminuoso> 9.2.1 received ARMv8 native code, but this is an ARMv7 problem
18:36:10 <dminuoso> Given that the dir entry names are read off correctly, either the offset of the dir_type is wrong, or there's some severe code generation bug.
18:36:30 <dminuoso> (Heh, or both)
18:36:45 <dminuoso> I would probably look into the generated assembly here
18:38:10 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
18:38:28 ft joins (~ft@p508dbd59.dip0.t-ipconnect.de)
18:46:20 wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com)
18:46:20 × wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host)
18:46:20 wroathe joins (~wroathe@user/wroathe)
18:51:02 <EvanR> bazoo, if you try to do what you said in haskell, you will learn a lot xD
18:51:21 <EvanR> probably worth it
18:51:59 <EvanR> haskells type system can technically express a lot but it won't necessarily be ergonomic
18:52:21 hochata joins (~user@2806:104e:1b:16dd:2b68:28db:d39:1f54)
18:52:53 acidjnk_new joins (~acidjnk@p200300d6e7137a16f8a8efad5ebd7081.dip0.t-ipconnect.de)
18:53:22 <geekosaur> it still won'[t work with anything but constants. and forget about negative numbers
18:53:39 <geekosaur> (unless you want to represent them as a positive number plus a type level Bool)
18:54:12 bobbingbob joins (~dfadsva@2604:3d09:207f:f650::7b3a)
18:54:37 × hochata quits (~user@2806:104e:1b:16dd:2b68:28db:d39:1f54) (Client Quit)
18:55:15 hochata joins (~user@2806:104e:1b:16dd:2b68:28db:d39:1f54)
18:55:23 thegeekinside joins (~thegeekin@189.217.82.244)
18:56:57 × thegeekinside quits (~thegeekin@189.217.82.244) (Remote host closed the connection)
18:59:13 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Remote host closed the connection)
19:01:14 <EvanR> constant type level numbers is an example of where there is special support for egonomics
19:01:15 jle`` joins (~jusle@user/jle/x-3894663)
19:01:26 codaraxis__ joins (~codaraxis@user/codaraxis)
19:01:31 <jle``> i forgot the name of the thing that does 'traverse' but in reverse, and you get it for free from a Representable instance
19:02:06 <EvanR> but you can technically construct a whole system of arithmetic to express concepts like intervals and what happens when intervals collide
19:02:18 <jle``> ah yeah it's Distributive
19:03:08 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
19:03:25 gmg joins (~user@user/gehmehgeh)
19:03:56 × azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds)
19:04:33 × akegalj quits (~akegalj@141-136-183-112.dsl.iskon.hr) (Quit: leaving)
19:05:15 × wroathe quits (~wroathe@user/wroathe) (Ping timeout: 260 seconds)
19:05:30 × codaraxis quits (~codaraxis@user/codaraxis) (Ping timeout: 260 seconds)
19:07:11 waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340)
19:07:27 azimut joins (~azimut@gateway/tor-sasl/azimut)
19:10:07 coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba)
19:14:31 <monochrom> I'm an egomaniac. I love egonomics. >:)
19:16:24 <dolio> Study of Egon Spengler?
19:16:28 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
19:16:37 <EvanR> and this is why IRC lack of message editing is a feature
19:20:35 × waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 264 seconds)
19:22:09 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
19:29:44 <Guillaum[m]> I would like to do something like: "acquireResource >> doSomething >> async (doATask `finally` releaseResource) >> doSomethingElse". Said otherwise, I want to aquire a resource, start a thread, and do a computation which releases the resource at the end of the computation. However I want to be sure the resource is released. In the current implementation, if something happen before `finally` is setup (so any exception INSIDE the async but
19:29:44 <Guillaum[m]> before the finally, or outside the async (before it is even started), I will lose my resource.
19:33:01 waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340)
19:34:49 nschoe joins (~q@2a01:e0a:8e:a190:c70e:2102:82d3:a45a)
19:34:49 × nschoe quits (~q@2a01:e0a:8e:a190:c70e:2102:82d3:a45a) (Client Quit)
19:37:24 jakalx parts (~jakalx@base.jakalx.net) (Error from remote client)
19:38:28 × festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed)
19:39:15 jakalx joins (~jakalx@base.jakalx.net)
19:40:23 kritzefitz joins (~kritzefit@debian/kritzefitz)
19:42:46 <EvanR> the point of async is so you can trust the spawn and unspawn part of the process, instead of second guessing your forkIO code
19:43:53 festive_kurbus joins (~festive_k@user/kurbus)
19:44:13 <EvanR> something happening "between" async and finally is the async libraries responsibility
19:45:19 <EvanR> nevermind I see this is a large "should be a bracket" thing
19:45:25 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
19:45:57 <EvanR> you don't even release the resource on problem with the first doSomething
19:47:23 × waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 260 seconds)
19:47:36 <EvanR> If I read into this you want to release a resource early if possible, instead of putting a bracket around the entire thing. You can do that by building idempotence into your cleanup action. Make it ok to call twice
19:49:04 emad joins (~emad@102.40.212.34)
19:49:09 codaraxis___ joins (~codaraxis@user/codaraxis)
19:49:14 × emad quits (~emad@102.40.212.34) (Remote host closed the connection)
19:52:42 × codaraxis__ quits (~codaraxis@user/codaraxis) (Ping timeout: 256 seconds)
19:53:25 <bazoo> EvanR thanks, but I wonder at this point if it's possible at all. geekosaur anything but constants means that values for such a type must be known at compile time?
19:53:45 <geekosaur> yes
19:54:07 <geekosaur> you need runtime witnnesses of some kind for non-constant values
19:54:34 × Xeroine quits (~Xeroine@user/xeroine) (Remote host closed the connection)
19:54:41 <EvanR> bazoo, possible and reasonably possible might be very far apart here
19:55:09 <EvanR> if you remove reasonable, you can imagine some really out there logic for what you want to happen
19:55:26 <EvanR> at compile time, maybe you don't know things like future user input, but you can still check the logic of working with what you eventually read
19:55:54 Xeroine joins (~Xeroine@user/xeroine)
19:56:02 <EvanR> e.g. x + (y + z) still equal (x + y) + z even if you don't know what they are yet.
19:56:22 <EvanR> every such step of logic can be encoded as a type class
19:56:51 <zzz> what's a more canonical way of doing `[(a -> a)] -> a -> a` than `foldr1 (.) [...]`?
19:57:18 <EvanR> foldr (.) id
19:58:19 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
20:00:15 <EvanR> if you want to get gratuitous, appEndo . foldMap Endo
20:02:39 × mixfix41 quits (~sdenynine@user/mixfix41) (Ping timeout: 260 seconds)
20:02:56 <dsal> appendo sounds like one of the elf characters from Disenchantment
20:03:14 <zzz> i remember doing something elegant for this but maybe it's a false memory
20:03:15 shapr joins (~user@68.54.166.125)
20:05:13 <zzz> what about `f <$> [...] ? a`?
20:05:23 <zzz> where i want a -> a
20:05:32 <EvanR> what is ?
20:05:48 <zzz> something
20:05:51 <zzz> i dont know
20:06:38 <EvanR> also might be silly to ask... which order do you want to apply the functions in
20:06:51 <zzz> i was just signaling that f is constant
20:07:03 <zzz> dont care about order
20:07:33 <dsal> :t fix . fold
20:07:34 <lambdabot> (Foldable t, Monoid c) => t (c -> c) -> c
20:07:46 <EvanR> oh nice
20:07:47 <dsal> :t foldMap fix
20:07:48 <lambdabot> (Foldable t, Monoid m) => t (m -> m) -> m
20:08:07 <dsal> I assume those functions do the same thing.
20:09:17 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
20:09:26 <zzz> oh i think that was it!
20:09:41 <dsal> Really? I'm just in "throw out a bad idea" mode.
20:09:52 <zzz> ahah i love bad ideas
20:09:59 <dsal> We should hang out.
20:10:22 <zzz> that sounds like a bad idea
20:10:27 <dsal> Yeah, love it.
20:10:28 <zzz> i'm in
20:12:06 <zzz> than again maybe that asn'tit
20:12:09 <monochrom> You never know whether a bad idea becomes a good idea. I'm in.
20:12:12 <zzz> *wasn't it
20:12:33 <EvanR> buy bad idea coin today
20:12:55 × CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
20:12:56 × hochata quits (~user@2806:104e:1b:16dd:2b68:28db:d39:1f54) (Remote host closed the connection)
20:13:27 <dsal> I missed the initial `a`
20:13:29 <dsal> :t foldMap iterate
20:13:30 <lambdabot> Foldable t => t (a -> a) -> a -> [a]
20:13:49 <dsal> But then you want a single entry. Which entry?
20:13:53 <dsal> :t fold . foldMap iterate
20:13:56 <lambdabot> (Foldable t, Foldable ((->) a)) => t (a -> a) -> [a]
20:14:13 <monochrom> foldMap fix [f, g, h] = fix f <> fix g <> fix h = probably not what you want
20:14:18 <dsal> :t (fold .) . foldMap iterate
20:14:19 <lambdabot> (Monoid c, Foldable t) => t (c -> c) -> c -> c
20:15:03 <EvanR> I missed the part where `a' was a monoid to be monoided
20:15:14 <zzz> i regret having started this
20:15:34 <monochrom> Yeah, if fix f = foo :: X, we require X to be a Monoid instance.
20:16:06 <monochrom> At any rate, first of all we require "fix f" to make sense at all. (Usually it doesn't.)
20:24:30 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Remote host closed the connection)
20:27:05 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
20:27:36 × festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed)
20:28:05 × FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 255 seconds)
20:29:06 FinnElija joins (~finn_elij@user/finn-elija/x-0085643)
20:29:31 waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340)
20:34:10 money joins (money@user/polo)
20:37:09 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
20:41:38 × bazoo quits (~bazoo@93.51.40.51) (Ping timeout: 260 seconds)
20:42:01 <EvanR> it makes sense if and only if f is broken
20:42:38 <EvanR> such as error
20:43:00 × hueso quits (~root@user/hueso) (Ping timeout: 268 seconds)
20:44:06 <Guillaum[m]> EvanR: Thank you for your answer. I'll try to come with a more detailled version of my problem because that's not something that a "huge" bracket can solve right now.
20:45:40 <EvanR> for some reason I had the vague idea that a resource acquired by some thread or process should be ultimately responsible for releasing it, even if it crashes (or a child uncontrolled crashes)
20:45:48 pavonia joins (~user@user/siracusa)
20:46:11 <dminuoso> EvanR: who should be responsbile for releasing it? the resource?
20:46:23 <dminuoso> (that's what it says grammatically)
20:46:24 <EvanR> the same thread or process
20:46:42 <EvanR> Agreed I made no literal sense
20:46:57 stef204 joins (~stef204@user/stef204)
20:47:02 <dminuoso> Not entirely sure what "the thread is responsible" even means
20:47:40 <EvanR> all actions are executed by some thread
20:47:46 <dminuoso> Are you suggesting every resource acquired should be registered as a finalizer to the thread?
20:47:50 mmhat joins (~mmh@p200300f1c73b51dfee086bfffe095315.dip0.t-ipconnect.de)
20:47:56 <dminuoso> (to the thread responsible for acquisition I mean)
20:48:07 <EvanR> no
20:48:36 <EvanR> not specifically talking about a mechanism to do it, or a blanket global policy everything has to do
20:48:46 <dminuoso> In the sense of ResourceT?
20:48:59 <dminuoso> Or how would it differ from ResourceT?
20:49:08 <EvanR> but guillaum is acquiring a resource in thread 1, then attempting to release it in, at least, a child thread
20:49:40 <EvanR> sounds it just sounds complicated
20:49:45 <EvanR> so it just sounds complicated
20:51:03 <dminuoso> It will be brittle because you would need a lot of code regions masked
20:51:32 <dminuoso> Guillaum[m]: But what you *can* do is use message passing to signal that you're done with the resource
20:51:49 <EvanR> looks like ResourceT has a way to share a resource among many threads and use reference counting to finally release it
20:52:00 <dminuoso> So one thread creates and finally destroys it, and in between it waits on say an MVar
20:52:15 <dminuoso> And the consumer thread puts into the MVar if its done
20:52:27 × avicenzi quits (~avicenzi@2a00:ca8:a1f:b004::c32) (Ping timeout: 252 seconds)
20:52:28 <dminuoso> Yeah
20:52:37 <dminuoso> resourcet seems like the saner approach
20:52:44 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
20:53:19 <Guillaum[m]> More details if you want. I'm creating a job scheduling mechanism. I have a "main" thread which schedules jobs. It is a loop which checks redis, and if there is something on redis, starts an async to execute a task, and restart checking redis. I have a number of available tokens, so I won't schedule more tasks than available tokens. However, a task can "suspend" itself (i.e. wait), hence can release a token, so another task is scheduled.
20:53:19 <Guillaum[m]> Eventually, the task will end its wait (so use another token), and at the end of the process, the task should release the final token.
20:54:43 <EvanR> sounds like a job for an MVar or TVar with number of free tokens in it
20:55:10 × pagnol quits (~user@213-205-209-87.ftth.glasoperator.nl) (Ping timeout: 260 seconds)
20:55:26 <EvanR> on crash thread puts the token back
20:55:38 × Cale quits (~cale@cpef48e38ee8583-cm30b7d4b3fc20.cpe.net.cable.rogers.com) (Read error: Connection reset by peer)
20:56:22 × bobbingbob quits (~dfadsva@2604:3d09:207f:f650::7b3a) (Quit: Leaving)
20:56:37 <Guillaum[m]> EvanR: actually that's a TVar with the number of free tokens. And the code is as such: forever $ do { takeToken; task <- getATaskFromRedis; async (runTask task `finally` releaseToken) }
20:57:13 <EvanR> getATaskFromRedis could crash
20:57:24 <Guillaum[m]> Yes, that's the problem here
20:57:44 <EvanR> the task of getting and doing a task... is it's own task xD
20:58:58 <dsal> So, I'm looking at recursion schemes and am somewhat confused by this: hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b
20:59:13 <dsal> How does this work when not a~b ?
20:59:19 jmdaemon joins (~jmdaemon@user/jmdaemon)
20:59:20 <EvanR> a dedicated worker thread that continually gets tasks and makes them (reliably) available to the rest of the program might simplify that
20:59:33 <dsal> This `b` seems to come out of nowhere.
21:00:00 <EvanR> with a mechanism to log problems and attempt to restore the worker if it fails
21:00:37 <EvanR> as a self contained subpiece of the whole application
21:01:18 <EvanR> if you had that, then just getting the next available task "can't fail"
21:01:32 <EvanR> from the perspective of your code there
21:02:08 <dsal> If edwardk were around, he could probably explain it to someone who could explain it to me.
21:02:30 × use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf) (Remote host closed the connection)
21:02:48 use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf)
21:04:09 <EvanR> note having an f b to pass into that function doesn't mean you had a `b' to begin with
21:04:43 <dsal> Yeah, but my understanding is that the result of the second thing is given to the first thing.
21:04:48 <EvanR> and to get an f b from an f a, you can use fmap
21:05:08 <dsal> Oh. Right.
21:05:25 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
21:05:44 <monochrom> Oh! That does it.
21:06:24 <dsal> I'm still a bit confused. I guess I just need to make something work around.
21:06:55 <dsal> I'd expect that first thing to be `f a -> a` since it's ostensibly the result of the other thing, but it's magicaller than that.
21:06:58 <monochrom> The source code goes "hylo f g = h where h = f . fmap h . g", if it helps.
21:07:35 <monochrom> I feel like there is some Löb going on there.
21:07:54 <monochrom> But type-wise, yeah fmap bridges the gap from f a to f b.
21:08:17 <EvanR> yeah, "but to use fmap, I need an function a -> b". Which is what hylo is
21:08:48 <monochrom> I guess hence h needs itself :)
21:09:19 <EvanR> thanks to types I can answer the question an have no idea what's going on
21:09:33 <Guillaum[m]> EvanR: I've started to think about a refactor actually, but I was wondering if there was an easy solution for the problem as it is currently designed without too much rewrite.
21:09:57 <iqubic> dsal: You need to get from (f a -> f b) and you have hylo :: (f b -> b) -> (a -> f a) -> a -> b. Notice that if you run hylo, you get (a -> b), which lets you fmap properly.
21:10:42 <dsal> So it's just like hylo (fmap a2b) (a2somef) a ?
21:10:59 dsal should really be asking ghci
21:11:45 <iqubic> Well, hylo is the fuction you are trying to create, so you'd have to do it recursively
21:12:05 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
21:12:19 <dsal> No, hylo is the function I'm trying to use.
21:12:43 <EvanR> to do what exactly
21:13:54 <dsal> For example, I've got some code that takes an (Int, Int), expands it to an [(Int, Int)] and then collapses that to some monoid.
21:14:37 <dsal> So ignoring the signature, something like hylo length expansionThing (3,3)
21:14:48 <EvanR> what's a and b
21:15:01 <dsal> a is (Int, Int) and b is Int
21:15:28 <EvanR> cool
21:15:49 <EvanR> so yeah fmap a2b doesn't sound necessary or correct there
21:16:08 <dsal> No, I realized that when I got to ghci.
21:16:19 <dsal> It's the wrong direction.
21:17:08 <EvanR> f b -> b is like... takes the list of tree heights and returns how cells you can go before hitting a too high tree?
21:17:15 <EvanR> how many*
21:17:24 <dsal> Yeah.
21:18:09 <EvanR> well there's that
21:18:12 <dsal> I wrote a thing that feels like a hylomorphism, except it's just monoids. At least part of it seems like it should work with hylo except the type signature isn't what I'd expect.
21:18:17 × stef204 quits (~stef204@user/stef204) (Quit: WeeChat 3.7.1)
21:18:25 <EvanR> use that as the first argument
21:18:26 Cale joins (~cale@cpef48e38ee8583-cm30b7d4b3fc20.cpe.net.cable.rogers.com)
21:18:46 <dsal> For a simple case, I'm trying `sum`
21:19:28 <dsal> hylo sum :: (Functor f, Foldable f, Num b) => (a -> f a) -> a -> b
21:19:37 huskle joins (~huskle@250.79-105-213.static.virginmediabusiness.co.uk)
21:21:24 <huskle> here, i have more code
21:21:25 <huskle> https://paste.tomsmeding.com/zWqd6p7J
21:21:30 <EvanR> hylo sum rayNorthFrom (2,4)
21:21:44 <huskle> look at my code! look at my code!!
21:22:04 <dsal> hylo sum (\x -> [1 .. x]) 2 -- this stack overflows.
21:22:20 × gdd quits (~gdd@129.199.146.230) (Ping timeout: 246 seconds)
21:22:30 <huskle> its the best code ever!
21:22:45 <EvanR> given how we implemented hylo I'm not that surprised xD
21:22:46 <dsal> hylo sum Identity 5 -- this just never terminates
21:23:03 <EvanR> maybe if you used lazy naturals
21:23:40 <dsal> hylo sum (const [1, 2, 3]) 5 -- still blows up. I clearly have no idea what I'm doing.
21:24:03 <dsal> Maybe I should understand the anamorphism first.
21:24:18 <EvanR> hylo f g = h where h = f . fmap h . g
21:24:37 <dolio> You're asking for the sum of an infinite tree.
21:24:54 <dsal> Yeah, I'm not sure how finite emerges here.
21:25:00 eggplantade joins (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43)
21:25:02 <dolio> 2 ==> [1,2] ==> [[1],[1,2]] ==> ...
21:25:09 <dsal> ooooh
21:25:32 <dsal> OK, this makes a bit more sense now.
21:25:36 <huskle> https://paste.pics/KAJNC
21:25:42 <huskle> this is the graph of the output
21:27:09 <huskle> its a amplitude modulated parametric sin wave, where the amplitude modulation is parametric noise which is smoothly differentiable in its parameters
21:27:27 <huskle> you can smoothly shift the frequency, phase, or any of the noise shifts!
21:27:34 <EvanR> sum [sum [sum [sum [...
21:27:40 <huskle> so you can do gradient descent on them as basis elements!
21:28:19 × mmhat quits (~mmh@p200300f1c73b51dfee086bfffe095315.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
21:28:29 <huskle> and they are trivially initialisable from fft, as the noises average to unity
21:28:38 <huskle> then you can do k-hard thresholding
21:28:54 <huskle> its the best thing EVER
21:30:09 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
21:30:33 × eggplantade quits (~Eggplanta@2600:1700:38c5:d800:30d2:fcaf:3b1c:ad43) (Ping timeout: 256 seconds)
21:31:51 <huskle> it even has a song! https://www.youtube.com/watch?v=2oe2sxBZ6nY
21:32:23 <EvanR> Busta Rhymes DANGEROUS
21:34:14 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 255 seconds)
21:34:45 euandreh joins (~Thunderbi@179.214.113.107)
21:35:13 <dsal> I guess recursion-schemes fails me again because my problem isn't quite recursive in the way this helps.
21:35:18 <jean-paul[m]> is https://medium.com/@zw3rk/the-haskell-cabal-and-cross-compilation-e9885fd5e2f pretty much the story for Cabal and cross-compilation?
21:36:18 <huskle> EvanR: my whole entire Unit is dangerous...
21:36:19 gmg joins (~user@user/gehmehgeh)
21:36:46 <EvanR> there may be a way to rephrase the problem to be recursive?
21:36:59 <EvanR> but it feels like stretching at this point
21:37:07 × huskle quits (~huskle@250.79-105-213.static.virginmediabusiness.co.uk) (Quit: Connection closed)
21:37:11 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
21:37:18 <dsal> Yeah, that's kind of the problem I run into each time I try to use recursion-schemes.
21:38:30 <dsal> My current solution is fine. It's just got `(Semigroup s1, Semigroup s2) => (Word8 -> [Word8] -> s1) -> (s1 -> s2) -> Grid -> s2` and I was hoping there were something fancier I could use than foldMapping a foldMap, but the turtles stop there.
21:38:57 <geekosaur> jean-paul[m], the real problem is ghc doesn't really support cross-compilation that well, so neither cabal nor stack can support it very well either
21:39:18 <dsal> At each point, we expand the points of view and then collapse that down to the appropriate semigroup, which kind of feels like it matches, but that only happens once.
21:39:41 <jean-paul[m]> What does it mean that it does not support it "that well"? It has _some_ support...
21:40:58 × gmg quits (~user@user/gehmehgeh) (Client Quit)
21:41:04 <jean-paul[m]> reflex-platform does some stuff for aarch64 and the Haskell parts seem to work okay (at least at some simple level). But if I try to add, say, pkgconfig-depends to a .cabal file then cabal runs the wrong pkg-config to try to resolve it.
21:41:11 <EvanR> notHylo :: (f b -> b) -> (a -> f a) -> (a -> b) -> a -> b
21:41:39 <EvanR> notHylo h g f = h . fmap f . g
21:42:08 mmhat joins (~mmh@p200300f1c73b51d2ee086bfffe095315.dip0.t-ipconnect.de)
21:42:41 <EvanR> Functor f =>
21:44:10 <EvanR> since the tree height is already what you need... it's more like h . g xD
21:44:12 <geekosaur> jean-paul[m], probably best asked in #hackage (which for some reason is the cabal channel)
21:44:49 <dsal> EvanR: Yeah, that's kind of it. But I'm doing folds, so it's really just… foldMap
21:44:58 <geekosaur> but I think those simple cases are the limit of what ghc can handle and it would mishandle the pkg-config output
21:45:01 gdd joins (~gdd@2001:470:1f13:187:e8a5:fbff:fe29:42f5)
21:45:26 <jean-paul[m]> geekosaur: Ok, thanks
21:46:07 <dsal> I could try it on day 7, but my day7 is also foldMap.
21:46:39 × phma quits (~phma@host-67-44-208-200.hnremote.net) (Read error: Connection reset by peer)
21:47:01 Topsi joins (~Topsi@dyndsl-095-033-225-177.ewe-ip-backbone.de)
21:47:17 phma joins (phma@2001:5b0:215d:cc28:414c:6f3a:6804:56b7)
21:48:33 hueso joins (~root@user/hueso)
21:48:37 EvanR_ joins (~EvanR@user/evanr)
21:50:20 × EvanR quits (~EvanR@user/evanr) (Ping timeout: 246 seconds)
21:51:49 EvanR_ is now known as EvanR
21:52:09 × euandreh quits (~Thunderbi@179.214.113.107) (Quit: euandreh)
21:54:25 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
22:01:27 <EvanR> downloading the dwarf fortress binary, and it not loading due to binary incompatibilities, or on OSX, loading but showing no graphics and not responding to input or signals
22:01:56 <EvanR> makes me wonder about viability for haskell static everything in games xD
22:02:00 × coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot)
22:02:55 <EvanR> is it just a given any program for PC must be continually recompiled and rereleased by a human
22:03:11 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
22:03:26 <Rembane> This is so that computers cannot take over the world.
22:03:34 <EvanR> built in self destruct
22:03:52 <Rembane> Indeed. Like cells killing themselves when things go weird.
22:05:01 <dsal> I don't mind computers taking over the world. I've got other stuff to do.
22:05:41 <Rembane> If they take over the world the only thing you're allowed to do is to update Javascript dependencies.
22:06:30 <dsal> What if I just stop feeding them?
22:06:45 <Rembane> I think that's the background story to the Matrix
22:07:09 <Rembane> So I guess that if you get yourself really sweet sunglasses and black shiny clothes you should be good.
22:07:19 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
22:07:36 EvanR climbs up and updates "days since the matrix reference" to 0
22:07:50 <c_wraith> EvanR: did the Haskell game have the same installation problems for you?
22:08:03 <c_wraith> Defect Process. that's the one.
22:08:08 <EvanR> oh never played it
22:09:57 × troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 268 seconds)
22:10:07 <c_wraith> 'cause if the author hadn't posted on r/haskell, I'd never have known it was written in Haskell. It's just a game, from an outside POV
22:11:11 <EvanR> yeah the concern I have is not about a program working at a point in time, but working in a wide range of times before and after, ok not before but after, it's built
22:11:30 <EvanR> so it's hard to test
22:12:34 <EvanR> I don't know if there's any difference with haskell really vs C++
22:14:48 <c_wraith> I've got a friend working on a game in C++ and fennel (a lua-based lisp), and she has reported the majority of her problems come from getting various C++ builds to work, especially as she goes between windows and linux. It's not easy.
22:16:05 <monochrom> It is still nice to know that some games actually sold on Steam are written in Haskell. Or even written in something other than C++ at all.
22:16:14 <monochrom> Helps break stereotypes.
22:16:48 <EvanR> that's actually mindblowing kind of
22:17:17 <dminuoso> `is_block_mergeable >>= \case True -> ... False -> ...`
22:17:22 <c_wraith> https://incoherentsoftware.com/defect-process/docs/ there's a high-level design doc, if you're interested
22:17:22 <dminuoso> Would you consider this an acceptable style?
22:17:37 <monochrom> Yes.
22:17:44 <c_wraith> dminuoso: I do that sometimes. linters hate me, but I think it's better than if, inside a do block.
22:17:53 <monochrom> One of 10 acceptable styles. :)
22:18:20 <dminuoso> heh
22:18:20 <monochrom> I also accept "x <- is_block_mergeable; if x then ... else ..."
22:18:25 <mauke> >>= ([..., ...] !!) . fromEnum
22:18:45 <monochrom> haha now that's cute but not on my accept list :)
22:18:46 <dminuoso> I dislike the then/else parts of the if-then-else construct. Case-of has always read more natural to me mmm
22:18:51 × Tuplanolla quits (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) (Quit: Leaving.)
22:18:55 <c_wraith> I agree
22:19:24 <monochrom> Customers who dislike then-else may like: MultiwayIf >:)
22:19:41 <c_wraith> of course, these days there's also >>= bool (...) (...)
22:19:46 dminuoso prefers `case () of _ | -> ... ` over MultiwayIf
22:19:49 <dminuoso> Maybe Im strange
22:20:04 <EvanR> LambdaCase is cool, should be in vanilla
22:20:16 <dminuoso> Isnt it part of GHC202whenever?
22:20:18 <mauke> @pl if_ c t f = (f : t : []) !! fromEnum c
22:20:18 <lambdabot> if_ = flip (flip . ((!!) .) . flip (:) . return) . fromEnum
22:20:41 <monochrom> GHC2021 is vanillin >:)
22:21:07 <c_wraith> :t bool -- this has been in base for quite a while now.
22:21:08 <lambdabot> a -> a -> Bool -> a
22:21:20 <dminuoso> monochrom: So only one thing out of the hundred extensions we desire?
22:21:44 <mauke> @pl if_ t f c = (f : t : []) !! fromEnum c
22:21:44 <lambdabot> if_ = flip flip fromEnum . (((.) . (!!)) .) . flip (:) . return
22:21:46 <EvanR> boolM :: m a -> m a -> m Bool -> m a
22:21:50 <EvanR> I hate this
22:22:03 <EvanR> Monad m =>
22:22:49 <c_wraith> EvanR: that one seems below the Fairbairn threshold
22:23:02 <monochrom> Oh, just sparking another controversy similar to "natural" vs "synthetic".
22:23:09 <c_wraith> of course.
22:25:18 tomokojun joins (~tomokojun@37.19.221.173)
22:25:42 <mauke> https://www.okmij.org/ftp/Haskell/bothTrue.txt if Oleg does it, it can't be bad
22:27:12 <monochrom> w00t comp.lang.functional
22:27:19 <c_wraith> hah. "without pattern matching" is sure a funny target.
22:27:23 <monochrom> Life was simpler back then.
22:28:14 <monochrom> unsafePtrToInt -_- hahaha
22:29:08 <EvanR> it says unsafe. Which by one account means you need to guarantee something to use it safely. But what xD
22:29:15 <monochrom> In GHC it would be reallyUnsafePtrEquality
22:29:37 <c_wraith> I think reallyUnsafePtrEquality would probably work correctly for that. Usually.
22:29:43 × michalz quits (~michalz@185.246.204.93) (Remote host closed the connection)
22:30:13 <monochrom> I.e., "evaluate/seq to WHNF, but this is Bool so we know it's pointer to the True singleton or pointer to the False singleton, so just compare pointer equality..."
22:30:44 <monochrom> Excluded middle at its finest.
22:31:17 <Lears> That code requires hugs, and after reading it, so do I.
22:31:28 monochrom hugs Lears
22:31:29 coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba)
22:31:38 monochrom hugs hugs, too.
22:31:58 <monochrom> Did you know: Hugs still has the monopoly over OOHaskell >:)
22:32:10 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
22:32:20 <EvanR> dminuoso, I just upgraded my ghc to 9.2.5. LambdaCase still doesn't work (in ghci) without enabling it somehow xD
22:32:30 <monochrom> OK you may hate OO but it has a subset Extensible Records which you have always wanted >:)
22:32:41 fserucas joins (~fserucas@laubervilliers-657-1-66-228.w90-63.abo.wanadoo.fr)
22:33:06 × fserucas quits (~fserucas@laubervilliers-657-1-66-228.w90-63.abo.wanadoo.fr) (Client Quit)
22:33:15 <EvanR> OO would have really simplified by solution to today's advent of code. My Grid is passed to literally everything in the file, cluttering everything. No I doubt a monad would help
22:34:17 <monochrom> Ah, LambdaCase is not in GHC2021 yet.
22:34:18 <mauke> inb4 configuration pearl
22:34:27 Lycurgus joins (~juan@user/Lycurgus)
22:34:29 <monochrom> This is why GHC2022 or even GHC2023 is a good idea.
22:34:47 <mauke> "just teleport values through the type system, bro"
22:34:56 <EvanR> is configuration pearl = reflection
22:35:13 <c_wraith> it is a less disturbing version of reflection
22:35:13 <monochrom> I think configuration pearl = Reader
22:35:17 <c_wraith> but reflection is a lot faster
22:35:51 <mauke> https://okmij.org/ftp/Haskell/tr-15-04.pdf
22:36:08 <EvanR> implicit configurations
22:36:13 <EvanR> is the AOL keyword
22:36:15 <monochrom> Oh, that one.
22:36:19 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
22:36:42 <monochrom> 500 milliolegs :)
22:36:53 <c_wraith> the reflection library does the same thing in interface, but with an incredibly dirty internal implementation
22:36:56 <mauke> yeah, the one with type-level representations of foreign pointers
22:37:24 causal joins (~user@50.35.85.7)
22:37:26 <EvanR> yeah I have a pretty good idea of how that would work for my use case. I have no idea how Object Oriented Programming In Haskell would work so I like it more xD
22:37:32 <c_wraith> Just unsafeCoerce the => to a -> !
22:38:37 <mauke> https://hackage.haskell.org/package/reflection-2.1.6/docs/src/Data.Reflection.html#Reifies
22:39:46 <geekosaur> you might look at OOHaskell like monochrom suggested
22:39:58 <geekosaur> sadly it's been decades since it worked with ghc
22:40:05 <mauke> @where oohaskell
22:40:06 <lambdabot> http://arxiv.org/abs/cs/0509027
22:40:08 <geekosaur> I think 6.8 broke it
22:40:29 <EvanR> I remember this paper
22:42:09 <monochrom> Hrm, just needs HList? Then I misremembered.
22:42:37 <monochrom> In that case, actually should be a walk in the park in today's GHC, what with DataKinds and TypeInType etc.
22:42:47 <monochrom> and type families etc.
22:43:41 <monochrom> I mean Oleg's original code would not compile, but why stick to that, you can do a modernized encoding using the same idea, and it even has a chance to be more elegant.
22:44:15 <EvanR> of the myriad OO features developed in this paper, "my class file lets me pretend I have globals it's great" isn't one of them xD
22:44:44 <EvanR> which is an actual "point" of OOP I was once told, which was at the time news to me
22:45:21 <monochrom> I am OK with pretended global.
22:45:25 <c_wraith> Oh, if all you want is globals, just unsafePerformIO a ref into a top-level binding. :P
22:45:34 <c_wraith> "just"
22:45:47 <EvanR> a top level IVar would actually work
22:45:51 <monochrom> I am already OK with pretended state, so why not.
22:46:00 <geekosaur> once told by whom? someone who can't untangle OOP-the-current-popular-paradigm from 1960s bad practices?
22:46:01 <EvanR> it's a read only Grid
22:46:21 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
22:46:29 <EvanR> by my boss. Who's a pretty cool dude!
22:46:46 <c_wraith> (this messages sponsored by "not getting fired")
22:46:51 <EvanR> lol
22:47:53 <EvanR> this is stupid but I'm going to try the top level IVar thing
22:47:55 <monochrom> You know what, I think it's ambiguous whether it is "the point is to have globals" or it is "the point is not to have globals".
22:48:11 × zant1 quits (~zant@62.214.20.26) (Ping timeout: 268 seconds)
22:51:44 <c_wraith> EvanR: don't forget to NOINLINE it
22:52:32 <EvanR> right...
22:52:55 <glguy> You can always foreign import a C global
22:53:48 <monochrom> haha
22:54:39 <glguy> and StablePoiners are storable, so you can use that to have global boxed haskell values
22:54:57 <monochrom> And ironically the C global is a void* so the Haskell side treats it as a StablePtr so it stores a Haskell value that C doesn't understand? :)
22:55:03 <monochrom> haha
22:56:16 <dminuoso> EvanR: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html
22:56:22 <dminuoso> I guess LambdaCase is not part of GHC2021
23:03:36 × thyriaen quits (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1) (Remote host closed the connection)
23:07:03 <EvanR> The NOINLINE pragma does exactly what you'd expect: it stops the named function from being inlined by the compiler. You shouldn't ever need to do this, unless you're very cautious about code size.
23:07:43 <c_wraith> You shouldn't need to do it.. which is why you shouldn't unsafePerformIO at the top level.
23:08:04 × werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 248 seconds)
23:08:31 <EvanR> I shouldn't do this
23:08:44 <c_wraith> For some definitions of "shouldn't", absolutely.
23:08:53 <EvanR> bwahahaha
23:12:24 hpc . o O ( acme-shouldnt - a package documented exactly like acme-dont, but it's a lie and it runs the code anyway )
23:15:28 gurkenglas joins (~gurkengla@p548ac72e.dip0.t-ipconnect.de)
23:15:32 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
23:16:21 × coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot)
23:18:54 <EvanR> post mortem, program still works but doesn't really look much cleaner after all, and same number of lines if you ignore all the setup code
23:19:55 × Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5)
23:22:20 × lbseale quits (~quassel@user/ep1ctetus) (Quit: No Ping reply in 180 seconds.)
23:22:36 lbseale joins (~quassel@user/ep1ctetus)
23:26:56 <EvanR> https://i.imgur.com/qw89Knk.png
23:28:28 × pja quits (~pja@217.155.153.10) (Ping timeout: 260 seconds)
23:28:39 <monochrom> More lines and shorter lines vs fewer lines and longer lines :)
23:29:14 <iqubic> Why are south and east defined differently from north and west?
23:32:53 <EvanR> you're totally right
23:33:05 <EvanR> I should have centered my array at (0,0) xD
23:33:34 <EvanR> there's an odd number of rows and columns in the input data
23:38:38 money_ joins (~money@user/polo)
23:42:06 <iqubic> What are the differences between IArrays, MArrays and UArrays in the Array package?
23:43:19 <c_wraith> Doesn't it... say?
23:44:36 <c_wraith> like, the first sentence on each relevant module haddock page says what's going on in that module.
23:46:43 <hpc> honestly, it's really easy in haskell to go "i only need the type signatures" and ignore all the descriptions
23:47:16 <c_wraith> the types actually do say almost all of it too. But they're a bit less obvious.
23:48:18 <iqubic> I'm thinking using some sort of "Array (V2 Int) a" for storing 2D arrays, but I'm not sure what kind of Array would be the best.
23:50:01 <c_wraith> First decide if you want mutable or not. Then decide how you want the a values stored
23:50:18 <monochrom> At this point the fastest way to know is to try all 3 and benchmark them all.
23:51:14 <geekosaur> this kinda sounds like an Array of Vector, though; shouldn't Vector be used for both dimensions? (Doesn't it have optimizations for that?)
23:51:40 <monochrom> Oh! Then 4 options to try. \∩/
23:53:15 <hpc> just wait until you start asking yourself "is this row-major or column-major"
23:53:53 <monochrom> Oh haha I forgot that.
23:54:11 <monochrom> Still, benchmarking is faster than waiting for telepathy to happen.
23:54:36 <iqubic> hpc: That's the thing I want to avoid by using an Array with (V2 Int) as the index
23:55:11 <geekosaur> oh, that's different still
23:55:26 <c_wraith> It's not different from what I was saying
23:55:32 <geekosaur> hm, does V2 have an Ix instance
23:55:35 <c_wraith> yes
23:55:38 <monochrom> You mean s/avoid/avoid being aware/
23:55:42 <hpc> iqubic: technically the decision is still there and you just let the libraries decide, but yeah it's nice to have a meaningful index :P
23:55:45 <c_wraith> It's the same Ix logic as (,) has
23:56:36 <monochrom> "What's best?" and "I want to avoid being aware" sound like contradictions to each other.
23:56:50 <iqubic> I know. I'll thinking about this on my own
23:57:18 <monochrom> But what's new anyway. I want to earn a salary and do no work, too, as much as the next person.
23:58:12 <hpc> ah, but the next person by what ordering? :P
23:58:21 <monochrom> hahaha

All times are in UTC on 2022-12-08.