Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,408 events total
2021-07-25 03:38:04 <eltonpin1> Do you mean something like "automatically close a file once it goes out of scope"?
2021-07-25 03:38:22 × eltonpin1 quits (~1ntEgr8@2601:c8:c000:3090:20d2:58dd:3f51:cdf0) (Quit: WeeChat 3.1)
2021-07-25 03:38:38 eltonpinto joins (~1ntEgr8@2601:c8:c000:3090:20d2:58dd:3f51:cdf0)
2021-07-25 03:38:41 <Guest5> yes
2021-07-25 03:39:10 <davean> Guest5: many systems are structured with "with" functions
2021-07-25 03:39:21 <davean> Guest5: for example, bracket enables that, its pretty normal
2021-07-25 03:40:27 <eltonpinto> https://hackage.haskell.org/package/regions
2021-07-25 03:41:00 <Guest5> Neat, thanks!
2021-07-25 03:41:09 <davean> I'd say the morn usual form is ? -> (a -> m b) -> m b
2021-07-25 03:41:22 × spiunx quits (~spiun@2a01:4b00:86a9:fb00:8779:c06f:3ad1:b557) (Remote host closed the connection)
2021-07-25 03:41:32 <davean> Theres many levels of complexity to flexability of it though, like the regions package, and others
2021-07-25 03:43:10 <davean> withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r for example
2021-07-25 03:47:35 × xff0x_ quits (~xff0x@2001:1a81:5200:1d00:97a8:d110:8021:86ce) (Ping timeout: 255 seconds)
2021-07-25 03:48:30 xff0x_ joins (~xff0x@2001:1a81:5200:1d00:ce05:e9a7:78b7:c1fe)
2021-07-25 03:52:59 × favonia quits (~favonia@user/favonia) (Ping timeout: 255 seconds)
2021-07-25 03:53:17 favonia joins (~favonia@user/favonia)
2021-07-25 03:57:52 × HarveyPwca quits (~HarveyPwc@2601:246:c180:a570:29df:3b00:ad0e:3a06) (Quit: Leaving)
2021-07-25 04:01:36 justsomeguy joins (~justsomeg@user/justsomeguy)
2021-07-25 04:02:26 × machinedgod quits (~machinedg@s72-38-105-27.static.comm.cgocable.net) (Ping timeout: 255 seconds)
2021-07-25 04:05:09 adanwan joins (~adanwan@gateway/tor-sasl/adanwan)
2021-07-25 04:05:52 × adanwan quits (~adanwan@gateway/tor-sasl/adanwan) (Remote host closed the connection)
2021-07-25 04:06:05 adanwan joins (~adanwan@gateway/tor-sasl/adanwan)
2021-07-25 04:08:00 × adanwan_ quits (~adanwan@gateway/tor-sasl/adanwan) (Remote host closed the connection)
2021-07-25 04:08:58 × LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-07-25 04:17:03 Topsi1 joins (~Tobias@dyndsl-095-033-017-171.ewe-ip-backbone.de)
2021-07-25 04:19:32 × Topsi quits (~Tobias@dyndsl-091-249-083-202.ewe-ip-backbone.de) (Ping timeout: 255 seconds)
2021-07-25 04:33:39 × pera quits (~pera@user/pera) (Ping timeout: 258 seconds)
2021-07-25 04:33:55 × Guest5 quits (~Guest5@50.47.115.102) (Ping timeout: 246 seconds)
2021-07-25 04:39:19 vonfry joins (~user@119.135.206.182)
2021-07-25 04:39:31 × vonfry quits (~user@119.135.206.182) (Remote host closed the connection)
2021-07-25 04:43:51 Guest5 joins (~Guest5@50.47.115.102)
2021-07-25 04:45:06 × Null_A quits (~null_a@2601:645:8700:2290:1:e11e:d55b:188f) (Remote host closed the connection)
2021-07-25 04:50:11 × eltonpinto quits (~1ntEgr8@2601:c8:c000:3090:20d2:58dd:3f51:cdf0) (Quit: WeeChat 3.1)
2021-07-25 04:50:43 × Guest5 quits (~Guest5@50.47.115.102) (Ping timeout: 246 seconds)
2021-07-25 04:53:51 slice joins (~slice@user/slice)
2021-07-25 04:57:21 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-25 05:03:58 wei2912 joins (~wei2912@112.199.250.21)
2021-07-25 05:08:06 × slice quits (~slice@user/slice) (Quit: zzz)
2021-07-25 05:13:12 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-07-25 05:13:59 × favonia quits (~favonia@user/favonia) (Ping timeout: 255 seconds)
2021-07-25 05:14:48 favonia joins (~favonia@user/favonia)
2021-07-25 05:20:05 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 265 seconds)
2021-07-25 05:22:52 eltonpinto joins (~eltonpint@169.109.136.34.bc.googleusercontent.com)
2021-07-25 05:24:03 eltonpin1 joins (~1ntEgr8@2601:c8:c000:3090:20d2:58dd:3f51:cdf0)
2021-07-25 05:24:23 × eltonpin1 quits (~1ntEgr8@2601:c8:c000:3090:20d2:58dd:3f51:cdf0) (Client Quit)
2021-07-25 05:26:36 <Cajun> so one thing thats always peeved me with vectors is making recursive pattern matching functions with them. with lists its easy, but with a vector it feels dirty in a way; it needs -XViewPatterns and even then it feels like it adds an operation to make the benefits of vector (O(1) access) worthless. is there a better way of dealing with recursive
2021-07-25 05:26:37 <Cajun> functions on vectors, or are we stuck with ViewPatterns?
2021-07-25 05:27:29 fef joins (~thedawn@user/thedawn)
2021-07-25 05:27:58 <Cajun> and to add on, how can this be done with Repa arrays?
2021-07-25 05:28:20 <davean> whats the problem you have with ViewPatterns here?
2021-07-25 05:28:47 × justsomeguy quits (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.2)
2021-07-25 05:28:51 <Cajun> just wondering if thats the only option or if there is a more "natural" (without extensions) way of pattern matching on them
2021-07-25 05:30:11 <davean> I mean you can use guards if you want to avoid patterns, but I don't advocate that
2021-07-25 05:30:45 <davean> ViewPatterns don't give you anything special
2021-07-25 05:31:22 <davean> It all really depends on what your actual technical complaint is
2021-07-25 05:31:31 <davean> For style questions, thats all up to you
2021-07-25 05:31:41 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-07-25 05:31:53 <davean> I might think you've got no taste because of the style you pick, but uh, I mean I can't say you're objectively wrong
2021-07-25 05:32:45 <Cajun> im not sure if GHC would optimize it out, but its need for applying some function (like an uncons of some kind) every single time vs the default list's special syntax is what i was getting at, but its also a stylistic complain (to a way lesser degree)
2021-07-25 05:33:07 <davean> I mean, think of waht that code actually means
2021-07-25 05:33:17 <davean> But like, guards do create binds
2021-07-25 05:33:43 <davean> You can look at the core, but yah, I mean it also depends on the type of Vector here for the exact details of what happens
2021-07-25 05:33:52 <davean> clearly "head" of a boxed vector doesn't create anything
2021-07-25 05:34:14 <davean> Things get iffier with one based on Storable instances
2021-07-25 05:34:34 <davean> I know enough to debate you both ways on this, since your problem isn't realyl clear :)
2021-07-25 05:34:55 <davean> The curse of knowlege is most things become more situational
2021-07-25 05:34:56 <Cajun> i was just wondering if there was an easier way of doing it, the other more "real" question is how can this even be done on Repa arrays
2021-07-25 05:35:12 <davean> I have no idea about Repa arrays, never used Repa seriously
2021-07-25 05:35:23 <davean> tried it once or two years, years back
2021-07-25 05:38:16 <Cajun> it seems overly clunky to attempt to pattern match on them, and im not even sure if thats the intended use of them or if they are strictly "bulk operations only" for stuff like image representation. im a complete beginner in terms of Repa
2021-07-25 05:38:46 <davean> I know enough about Vector to talk about that, Repa, eh, uh
2021-07-25 05:40:23 <davean> Cajun: why are you pattern matching down vectors anyway?
2021-07-25 05:40:33 <davean> That seems unnatural
2021-07-25 05:41:24 <davean> Oh right, there was a reason I don't use Repa
2021-07-25 05:41:33 <Cajun> well thats what feels natural coming from the default List, is that just not the intended use case?
2021-07-25 05:41:53 <davean> I mean you can pattern match down them if you have reason to
2021-07-25 05:42:06 <davean> I just don't know many things that Vector is the optimal data structure for where I'd want to
2021-07-25 05:42:22 <davean> I'd usually want a map or a fold in places where vector is appropriate
2021-07-25 05:42:51 <davean> Its nothing hard and fact, I just don't think I've ever actualyl wanted to recurse down - cons and uncons occasionally, but not recurse specificly
2021-07-25 05:43:02 <davean> I'm very much not saying you're wrong
2021-07-25 05:43:37 <davean> I'm saying you're probably using vector in a way I haven't choosen to and I'd like to know what lead you there
2021-07-25 05:44:34 <Cajun> well Vector just seems like the default List but with more emphasis on performance, so it would be nice to get the best of both worlds (easy recursive functions from default lists and performance from vectors)
2021-07-25 05:44:53 <davean> But its not, it has fundimentally different characturistics
2021-07-25 05:45:18 <davean> Like you can't edit the front of a vector, and reuse the tail in constant time
2021-07-25 05:45:43 <davean> this is sorta the core of why I don't tend to use vector for things I recurse down - I'm usually either producing something from all the data, or I'm transforming all the data
2021-07-25 05:45:57 <davean> also you get constant time length, which changes what you can do how
2021-07-25 05:45:59 <Cajun> is this just not the intended use case for vectors?
2021-07-25 05:46:03 <davean> but again, you can recurse down it all you want
2021-07-25 05:46:25 <davean> I don't know - you keep not telling me what you're actually trying to do, so how can I answer?
2021-07-25 05:46:40 <davean> You're litterly asking me about something you're not telling me about
2021-07-25 05:47:17 <davean> I will say, taking the tail of a vector is constructive, unlike of a list where it isn't
2021-07-25 05:47:46 <davean> constructive but O(1)
2021-07-25 05:47:56 <Cajun> well its not about anything specific, its just that whenever i go to use them i hit a brick wall of weird pattern matching. also, what do you mean by "constructive"?
2021-07-25 05:48:07 <davean> I mean it produces new data
2021-07-25 05:48:24 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 258 seconds)
2021-07-25 05:48:30 <davean> as for pattern matching:
2021-07-25 05:48:46 <davean> f v | h <- head v = something with the head h
2021-07-25 05:49:14 <davean> with some vectors head isn't constructive (With some it is, varies by the vector type and optimizations)
2021-07-25 05:49:41 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-07-25 05:49:55 <davean> I can't really say anything about list vs. vector though because they're so fundimentally different that they're just not alike

All times are in UTC.