Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 316 317 318 319 320 321 322 323 324 325 326 .. 5022
502,152 events total
2020-09-30 04:34:57 hackage homura-stopwatch 0.2.0 - https://hackage.haskell.org/package/homura-stopwatch-0.2.0 (ncaq)
2020-09-30 04:34:59 <bobajett> :-)
2020-09-30 04:35:03 × filwisher quits (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net) (Ping timeout: 265 seconds)
2020-09-30 04:35:10 <Axman6> nailed it
2020-09-30 04:35:14 <Axman6> NEXT!
2020-09-30 04:35:59 <sim590> bobajett: It seems like you want subwords that don't contain a 0.
2020-09-30 04:36:07 × adam_wespiser quits (~adam_wesp@209.6.42.110) (Ping timeout: 240 seconds)
2020-09-30 04:36:57 <bobajett> yes please, I've been trying to use span and dropWhile and I just can't come up with some recursive function to solve it.
2020-09-30 04:37:05 × Turmfalke quits (~user@unaffiliated/siracusa) (Quit: Bye!)
2020-09-30 04:37:33 <Axman6> :t groupBy
2020-09-30 04:37:35 <lambdabot> (a -> a -> Bool) -> [a] -> [[a]]
2020-09-30 04:37:44 <MarcelineVQ> span is a pretty good choice tho
2020-09-30 04:37:57 × falafel_ quits (~falafel@2605:e000:1527:d491:f090:20fe:cddf:2a1a) (Remote host closed the connection)
2020-09-30 04:38:02 <Axman6> might be useful - but there are also likely to be simpler solutions
2020-09-30 04:38:47 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-09-30 04:43:07 mnrmnaugh joins (~mnrmnaugh@unaffiliated/mnrmnaugh)
2020-09-30 04:43:53 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds)
2020-09-30 04:44:37 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-09-30 04:44:50 <MarcelineVQ> looking at the definition of span could be instructive, there's a really neat trick that recursion allows you to do that it uses
2020-09-30 04:47:06 <MarcelineVQ> Which is that we can use the result of our own function in its definition, see how span is used in span?
2020-09-30 04:47:09 <MarcelineVQ> @src span
2020-09-30 04:47:09 <lambdabot> span _ xs@[] = (xs, xs)
2020-09-30 04:47:09 <lambdabot> span p xs@(x:xs') | p x = let (ys,zs) = span p xs' in (x:ys,zs)
2020-09-30 04:47:09 <lambdabot> | otherwise = ([],xs)
2020-09-30 04:48:53 alp joins (~alp@2a01:e0a:58b:4920:b51a:42ee:4512:fdae)
2020-09-30 04:49:08 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 260 seconds)
2020-09-30 04:49:47 × jrqc quits (~rofl@96.78.87.197) (Ping timeout: 240 seconds)
2020-09-30 04:54:21 mmohammadi9812 joins (~mmohammad@5.238.179.190)
2020-09-30 04:55:25 jrqc joins (~rofl@96.78.87.197)
2020-09-30 04:57:03 <sim590> > filter (all (/=0)) $ groupBy (\ a b -> a*b /= 0) [0,0,1,2,0,0,3,0]
2020-09-30 04:57:06 <lambdabot> [[1,2],[3]]
2020-09-30 04:57:58 p0a joins (~user@unaffiliated/p0a)
2020-09-30 04:58:10 <p0a> Hello I was just reading the release notes for GHC 9.0.1
2020-09-30 04:58:28 × aarvar quits (~foewfoiew@50.35.43.33) (Ping timeout: 272 seconds)
2020-09-30 04:58:41 <p0a> I noticed that the LinearTypes extension is now included. I read a bit about it and I think I sort of get the basic idea behind it
2020-09-30 04:59:22 <p0a> there's something in the motivation (on github/ghc-proposals) I don't understand: they mention that the type system itself can not discriminate between open-close and close-open file operations
2020-09-30 04:59:22 machinedgod joins (~machinedg@d67-193-126-196.home3.cgocable.net)
2020-09-30 04:59:31 day_ joins (~Unknown@unaffiliated/day)
2020-09-30 04:59:37 zacts joins (~zacts@dragora/developer/zacts)
2020-09-30 04:59:39 <p0a> i.e. you can open a file and then close it, but you shouldn't be able to close a file and then operate on it
2020-09-30 04:59:59 <p0a> I don't understand how LinearTypes solves this problem. Can someone explain? Thanky ou
2020-09-30 05:00:13 <c_wraith> It doesn't.
2020-09-30 05:00:25 <p0a> okay. :)
2020-09-30 05:00:34 <c_wraith> uniqueness types would, but linearity is insufficient.
2020-09-30 05:01:10 <p0a> https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0111-linear-types.rst#motivation reads weird then
2020-09-30 05:01:17 <dolio> I don't think uniqueness types would solve that case.
2020-09-30 05:01:41 <c_wraith> *maybe* you could do an entire CPS-transformed IO system such that linearity would matter, but... ugh.
2020-09-30 05:02:20 <c_wraith> I really don't want to do IO with explicit continuations.
2020-09-30 05:02:46 <dolio> Anyhow, the way you'd solve it with linearity is something like: change all file operations to operate on linear handles, and return a new handle as a result if appropriate. Closing consumes a handle but doesn't give you a new one.
2020-09-30 05:02:49 × day quits (~Unknown@unaffiliated/day) (Ping timeout: 258 seconds)
2020-09-30 05:02:49 day_ is now known as day
2020-09-30 05:02:55 × Orbstheorem quits (~roosember@hellendaal.orbstheorem.ch) (Ping timeout: 240 seconds)
2020-09-30 05:03:02 <c_wraith> and I'm not feeling charitable towards using OverloadedSyntax to make do notation work around CPS
2020-09-30 05:03:23 <p0a> dolio: I don't see how linearity is involved in this scheme
2020-09-30 05:03:38 <c_wraith> dolio: linear haskell only adds linear functions, not values.
2020-09-30 05:03:57 <davean> The whole LinearTypes GHC proposal baffles me
2020-09-30 05:04:15 <p0a> we've been had
2020-09-30 05:04:26 <dolio> The handle arguments are linear.
2020-09-30 05:04:47 × jedws quits (~jedws@121.209.139.222) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-09-30 05:05:25 <dolio> p0a: You are only allowed to use any handle once (and must use it once). Each operation consumes a handle and produces a new handle as a result, except close which just consumes the handle.
2020-09-30 05:06:01 <c_wraith> dolio: but how is that enforced? Are you assuming a world where (>>=) has linear annotations?
2020-09-30 05:06:04 <p0a> dolio: so the part where linearity kicks in is ensuring that the interface does not allow you to mix and match the operations in such a way that you operate in a closed handle
2020-09-30 05:06:13 × Jonno_FTW quits (~come@api.carswap.me) (Ping timeout: 264 seconds)
2020-09-30 05:06:21 <p0a> dolio: because it'd require you to operate twice in the same handle
2020-09-30 05:06:25 darjeeling_ joins (~darjeelin@112.16.171.8)
2020-09-30 05:06:37 <dolio> c_wraith: Yeah. They have some kind of linear monad notion, too.
2020-09-30 05:06:44 Jonno_FTW joins (~come@api.carswap.me)
2020-09-30 05:06:46 <dolio> I'm not really familiar with the details.
2020-09-30 05:07:03 <c_wraith> I really don't think that works, in the end...
2020-09-30 05:07:16 <c_wraith> If for no other reason, it destroys the ability to abstract over monads.
2020-09-30 05:07:19 <dolio> p0a: Right.
2020-09-30 05:07:34 <c_wraith> Because you want IO to be linear, but [] can't be linear...
2020-09-30 05:08:06 <dolio> Linear monads are a separate type class. And IO isn't linear, I think, but there's a LIO maybe. Like I said, I don't know the details.
2020-09-30 05:08:23 <dolio> They use some kind of do overloading for linear monads.
2020-09-30 05:08:23 <c_wraith> I just don't see it actually improving anything.
2020-09-30 05:08:47 <dolio> Well, I'm not saying it'll be good. I'm just saying what it would be. :)
2020-09-30 05:08:50 <p0a> It sounds good to me c_wraith
2020-09-30 05:09:33 <dolio> How good it is remains to be seen.
2020-09-30 05:09:45 <p0a> I wonder what happens with concurrency and that idea though
2020-09-30 05:10:20 × puffnfresh quits (~puffnfres@180-150-38-83.b49626.bne.nbn.aussiebb.net) (Quit: authenticating)
2020-09-30 05:10:36 puffnfresh joins (~puffnfres@180-150-38-83.b49626.bne.nbn.aussiebb.net)
2020-09-30 05:11:04 <p0a> Maybe that is not an issue. I actually have not written any concurrent programs so I wouldn't know
2020-09-30 05:11:54 <sim590> Axman6: it's great. It works now with my build + install instruction.
2020-09-30 05:14:12 <Axman6> great
2020-09-30 05:14:25 <MarcelineVQ> p0a: fwiw linear arrows restrict how you use arguments not results. foo :: a -* (a, b) says that if `foo` is used I promise to use the argument `a` exactly once, it does not say anyting at all about what we're allowed to do with the (a,b)
2020-09-30 05:14:31 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-09-30 05:15:03 <MarcelineVQ> To that end boop : a -* (a,Int); boop x = (x,0) is entirely valid, and what dolio is probably referring to when he says return a new handle
2020-09-30 05:15:16 falafel joins (~falafel@2605:e000:1527:d491:a806:37fa:6971:2798)
2020-09-30 05:16:56 <p0a> MarcelineVQ: I don't think returning a new handle is important (it could be the same handle, we wouldn't know anyway), other than to have something to continue operating on
2020-09-30 05:17:07 <p0a> I.e. I don't know if being 'new' is important. Could be the same
2020-09-30 05:17:42 jedws joins (~jedws@121.209.139.222)
2020-09-30 05:17:43 <p0a> a simple interface would be f :: Int %1 -> Int and g :: Int -> Bool where f x = x + 1 and g x = x == 0.
2020-09-30 05:17:55 <p0a> (Sorry, I should've written g :: Int %1 -> Bool)
2020-09-30 05:18:00 × hive-mind quits (~hivemind@rrcs-67-53-148-69.west.biz.rr.com) (Ping timeout: 256 seconds)
2020-09-30 05:18:44 <p0a> so you can't do \x -> (f x, g x)
2020-09-30 05:19:17 <dolio> The important part is how the API forces the user to work, not the implementation of the API.
2020-09-30 05:19:39 <p0a> That's true I just wrote the implementation of f and g as an example. The types were what mattered
2020-09-30 05:19:59 <p0a> f would be 'operate on file' and g would be 'close the file'
2020-09-30 05:20:00 xxasiaj joins (bcc0ac95@ipbcc0ac95.dynamic.kabel-deutschland.de)
2020-09-30 05:20:10 <dolio> If the result of a linear function arrow is unrestricted, I'm not exactly sure how it'd be accomplished. I guess CPS.

All times are in UTC.