Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-18 12:43:06 TerraDOOM joins (53fbe65d@c83-251-230-93.bredband.comhem.se)
2021-04-18 12:43:28 Major_Biscuit joins (~Major_Bis@82-169-100-198.biz.kpn.net)
2021-04-18 12:43:39 <TerraDOOM> is this a place I can ask questions?
2021-04-18 12:44:55 <[exa]> yes, you just tested it.
2021-04-18 12:45:06 <TerraDOOM> fair point
2021-04-18 12:45:06 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-04-18 12:45:11 × star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Ping timeout: 240 seconds)
2021-04-18 12:45:31 <merijn> >.>
2021-04-18 12:46:22 <TerraDOOM> anyway, I'm trying to apply a function created by composing an infinite list, and can't really figure out how to do it lazily
2021-04-18 12:47:21 <TerraDOOM> `recDice3 = foldl (flip (.)) id (map (mapEvery update) [2..])` this is the definition I've got, update is simply Int -> Int
2021-04-18 12:48:01 <TerraDOOM> oh right, `mapEvery` is just map but applies to only the nth element
2021-04-18 12:48:22 <TerraDOOM> or only every nth* I should say
2021-04-18 12:48:24 <merijn> Maybe your mapEvery isn't "productive" enough? Hard to say without seeing its implementation
2021-04-18 12:49:18 <TerraDOOM> is there ``` for multiline formatting or anything of the sort?
2021-04-18 12:49:58 <[exa]> nope, all ascii. But `this` or ⌜this⌝ is a nice way to mark code in ascii too
2021-04-18 12:50:00 <__monty__> Isn't the problem foldl's "strict"ness?
2021-04-18 12:50:04 × ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 252 seconds)
2021-04-18 12:50:16 <TerraDOOM> I tried foldr, didn't work
2021-04-18 12:50:20 <TerraDOOM> `
2021-04-18 12:50:20 <TerraDOOM> mapEvery :: (a -> a) -> Int -> [a] -> [a]
2021-04-18 12:50:21 <TerraDOOM> mapEvery f n xs = take (n-1) xs ++ case drop (n-1) xs of
2021-04-18 12:50:21 <TerraDOOM>                                      y : ys -> f y : mapEvery f n ys
2021-04-18 12:50:22 <TerraDOOM>                                      [] -> []
2021-04-18 12:50:22 <TerraDOOM> `
2021-04-18 12:50:32 <TerraDOOM> didn't work the way I wanted it to but oh well
2021-04-18 12:50:52 <[exa]> TerraDOOM: also, if sharing code samples with more than 1 line, please pastebin them instead, it's better if there are more than 2-3 discussions going on
2021-04-18 12:51:00 <TerraDOOM> will do, sorry
2021-04-18 12:51:00 <[exa]> </irc_primer>
2021-04-18 12:51:21 <[exa]> np now I guess
2021-04-18 12:52:38 × Major_Biscuit quits (~Major_Bis@82-169-100-198.biz.kpn.net) (Ping timeout: 252 seconds)
2021-04-18 12:53:31 <[exa]> TerraDOOM: btw you might want to check `iterate` and similar functions, looks like you're trying to that with your foldl
2021-04-18 12:54:03 × olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Remote host closed the connection)
2021-04-18 12:55:26 × gnumonic quits (~gnumonic@c-73-170-91-210.hsd1.ca.comcast.net) (Ping timeout: 240 seconds)
2021-04-18 12:56:39 <TerraDOOM> what're the similar functions? `iterate` looks to be pretty close to what I need, but I can't fully see how it'd work out in this case
2021-04-18 12:59:05 Major_Biscuit joins (~Major_Bis@82-169-100-198.biz.kpn.net)
2021-04-18 13:01:06 × kristijonas quits (~kristijon@78-56-32-39.static.zebra.lt) (Ping timeout: 240 seconds)
2021-04-18 13:01:44 <TerraDOOM> for some extra context, I'm just trying to implement a naive, brute force "solution" for project euler problem 641, mainly to check my actual solution for correctness
2021-04-18 13:02:46 kristijonas joins (~kristijon@78-56-32-39.static.zebra.lt)
2021-04-18 13:05:37 <TerraDOOM> actually I think I can make iterate work how I want it to, nvm
2021-04-18 13:07:55 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-04-18 13:09:24 <xsperry> > let mapEvery n f = map (\(i, x) -> if i `mod` n == 0 then f x else x) . zip [1..] in mapEvery 2 (*10) [1..5]
2021-04-18 13:09:26 <lambdabot> [1,20,3,40,5]
2021-04-18 13:10:14 × whataday quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection)
2021-04-18 13:11:21 whataday joins (~xxx@2400:8902::f03c:92ff:fe60:98d8)
2021-04-18 13:12:57 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 268 seconds)
2021-04-18 13:16:18 ddellacosta joins (~ddellacos@86.106.143.131)
2021-04-18 13:16:26 <TerraDOOM> xsperry: that definition also works, but the issue remains. I'm pretty sure the problem is that it has to compose the whole infinite list before attempting to apply the result
2021-04-18 13:19:37 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-18 13:19:42 urodna joins (~urodna@unaffiliated/urodna)
2021-04-18 13:19:53 × nut quits (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Remote host closed the connection)
2021-04-18 13:20:43 × ddellacosta quits (~ddellacos@86.106.143.131) (Ping timeout: 252 seconds)
2021-04-18 13:20:47 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-18 13:24:51 × nut quits (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Remote host closed the connection)
2021-04-18 13:25:41 × Major_Biscuit quits (~Major_Bis@82-169-100-198.biz.kpn.net) (Ping timeout: 240 seconds)
2021-04-18 13:26:18 qwerty2o joins (~qwerty2o@188.64.207.157)
2021-04-18 13:27:05 × nisstyre quits (wes@python-zero/conduct-committee/nisstyre) (Ping timeout: 250 seconds)
2021-04-18 13:29:19 nisstyre joins (wes@python-zero/conduct-committee/nisstyre)
2021-04-18 13:32:57 Major_Biscuit joins (~Major_Bis@82-169-100-198.biz.kpn.net)
2021-04-18 13:34:20 gzj joins (~gzj@unaffiliated/gzj)
2021-04-18 13:36:55 nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr)
2021-04-18 13:38:02 Guest78317 joins (~laudiacay@67.176.215.84)
2021-04-18 13:42:06 × coot quits (~coot@37.30.50.130.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 240 seconds)
2021-04-18 13:42:56 × Guest78317 quits (~laudiacay@67.176.215.84) (Ping timeout: 260 seconds)
2021-04-18 13:44:22 ep1ctetus joins (~epictetus@ip72-194-54-201.sb.sd.cox.net)
2021-04-18 13:46:38 Alleria joins (~textual@zrcout.mskcc.org)
2021-04-18 13:47:01 Alleria is now known as Guest72361
2021-04-18 13:47:08 × gzj quits (~gzj@unaffiliated/gzj) (Remote host closed the connection)
2021-04-18 13:47:11 × Major_Biscuit quits (~Major_Bis@82-169-100-198.biz.kpn.net) (Ping timeout: 240 seconds)
2021-04-18 13:47:27 gzj joins (~gzj@unaffiliated/gzj)
2021-04-18 13:48:21 ddellacosta joins (~ddellacos@86.106.143.131)
2021-04-18 13:48:28 × TerraDOOM quits (53fbe65d@c83-251-230-93.bredband.comhem.se) (Quit: Connection closed)
2021-04-18 13:53:10 × ddellacosta quits (~ddellacos@86.106.143.131) (Ping timeout: 252 seconds)
2021-04-18 13:53:10 × qwerty2o quits (~qwerty2o@188.64.207.157) (Ping timeout: 252 seconds)
2021-04-18 13:54:29 × unlink_ quits (~unlink2@p57b853bf.dip0.t-ipconnect.de) (Remote host closed the connection)
2021-04-18 13:57:08 unlink2 joins (~unlink2@p57b853bf.dip0.t-ipconnect.de)
2021-04-18 13:59:05 × drbean_ quits (~drbean@TC210-63-209-202.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin2 - https://znc.in)
2021-04-18 14:05:02 × unlink2 quits (~unlink2@p57b853bf.dip0.t-ipconnect.de) (Remote host closed the connection)
2021-04-18 14:05:26 lambdaman joins (~lambdaman@s66-183-152-156.bc.hsia.telus.net)
2021-04-18 14:06:11 unlink2 joins (~unlink2@p57b853bf.dip0.t-ipconnect.de)
2021-04-18 14:06:13 × geowiesnot quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 240 seconds)
2021-04-18 14:07:10 rond_ joins (5940206b@89-64-32-107.dynamic.chello.pl)
2021-04-18 14:07:40 <gentauro> wz1000: I already mentioned that -> http://blog.stermon.com/articles/2019/02/04/haskell-usage-of-malloc-free-is-safe.html
2021-04-18 14:08:12 <gentauro> wz1000: the point with Safe Haskell is that as long as you expose your IO effects in the signatures, you are good to go
2021-04-18 14:08:45 <gentauro> then the consumer of you library package will have to make a decision to `trust` or `not-trust` it. I find that approach acceptable
2021-04-18 14:09:41 × lambdaman quits (~lambdaman@s66-183-152-156.bc.hsia.telus.net) (Ping timeout: 240 seconds)
2021-04-18 14:10:55 × Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 268 seconds)
2021-04-18 14:12:14 <maerwald> I'm more interested in how my binary behaves than I am about libraries. At least when it's about "safety".
2021-04-18 14:12:50 <maerwald> I think the approach there is backwards, but maybe that's just a definition disagreement
2021-04-18 14:14:41 <wz1000> gentauro: I don't get it, if you can write `unsafePerformIO` in SafeHaskell, what guarantees are you getting?
2021-04-18 14:16:19 × danvet quits (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa) (Ping timeout: 260 seconds)
2021-04-18 14:18:16 <gentauro> wz1000: if you write `unsafePerformIO` in Haskell, you can mark you module as `trustworthy`, but never `safe`
2021-04-18 14:18:47 <gentauro> then I as a consumer can say: "hmmm, I find wz1000 work trustable" and I therefore trust you package
2021-04-18 14:19:18 gentauro normally, you would spend time going through the code and check yourself
2021-04-18 14:19:52 <wz1000> gentauro: but you are forgetting about GHC bugs
2021-04-18 14:19:59 <wz1000> https://gist.github.com/708c43a3ed4438c4850966479cf0be16
2021-04-18 14:20:06 <gentauro> the point is, if Safe Haskell is removed, then we could just rename everything to `npm` cos we would be as bad as them
2021-04-18 14:20:32 <wz1000> but we are as bad as them already
2021-04-18 14:20:33 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-04-18 14:20:44 <wz1000> and nobody is seriously attempting to make us any better
2021-04-18 14:21:36 × gzj quits (~gzj@unaffiliated/gzj) (Remote host closed the connection)

All times are in UTC.