Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,859 events total
2025-10-08 15:38:01 × poscat quits (~poscat@user/poscat) (Remote host closed the connection)
2025-10-08 15:38:18 poscat joins (~poscat@user/poscat)
2025-10-08 15:41:45 humasect joins (~humasect@dyn-192-249-132-90.nexicom.net)
2025-10-08 15:48:19 × humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Quit: Leaving...)
2025-10-08 15:50:59 trickard_ is now known as trickard
2025-10-08 15:54:28 × poscat quits (~poscat@user/poscat) (Remote host closed the connection)
2025-10-08 15:54:36 ft joins (~ft@p4fc2a207.dip0.t-ipconnect.de)
2025-10-08 15:54:45 poscat joins (~poscat@user/poscat)
2025-10-08 15:55:42 Googulator45 joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 15:55:42 × Googulator quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 15:55:50 <haskellbridge> <sm> bwe: 100%, removing such partial code from your program is the best when possible
2025-10-08 15:58:03 Googulator45 is now known as Googulator
2025-10-08 16:00:43 × Googulator quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 16:00:51 Googulator joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 16:05:21 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 256 seconds)
2025-10-08 16:05:58 <__monty__> But the all the warnings about head and tail et al. are so noisy : (
2025-10-08 16:07:22 <haskellbridge> <sm> for this reason ? Suppress them if you must
2025-10-08 16:08:14 tromp joins (~textual@2001:1c00:3487:1b00:b551:deec:8ee1:7922)
2025-10-08 16:27:27 Tuplanolla joins (~Tuplanoll@91-159-187-167.elisa-laajakaista.fi)
2025-10-08 16:30:27 × Googulator quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 16:30:39 Googulator joins (~Googulato@193-226-241-224.pool.digikabel.hu)
2025-10-08 16:35:39 × Googulator quits (~Googulato@193-226-241-224.pool.digikabel.hu) (Quit: Client closed)
2025-10-08 16:35:46 Googulator joins (~Googulato@193-226-241-224.pool.digikabel.hu)
2025-10-08 16:48:37 ttybitnik joins (~ttybitnik@user/wolper)
2025-10-08 16:55:37 × Googulator quits (~Googulato@193-226-241-224.pool.digikabel.hu) (Quit: Client closed)
2025-10-08 16:55:38 Googulator60 joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 16:59:03 CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db)
2025-10-08 17:00:47 Googulator65 joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 17:01:10 × Googulator60 quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 17:04:12 × MelodyOwO quits (~MelodyOwO@user/MelodyOwO) (Quit: Leaving.)
2025-10-08 17:15:37 Googulator10 joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 17:15:39 × Googulator65 quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 17:22:04 <EvanR> unless the objective is to crash your program in a potentially hard to explain way
2025-10-08 17:22:46 <EvanR> every use of tail or last etc has to come with a possibly invisible proof that the list isn't empty
2025-10-08 17:23:08 <EvanR> which is often not that hard to come up with, it's just that it's invisible
2025-10-08 17:23:57 <EvanR> in your case control F for last and check for proof
2025-10-08 17:26:25 × tomboy64 quits (~tomboy64@user/tomboy64) (Ping timeout: 264 seconds)
2025-10-08 17:27:39 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-08 17:28:39 tomboy64 joins (~tomboy64@user/tomboy64)
2025-10-08 17:30:16 <__monty__> Sometimes I don't have proof but there's also absence of proof of the contrary.
2025-10-08 17:31:27 <EvanR> ain't that something
2025-10-08 17:32:01 <EvanR> murphy's law corrolary, if you don't have the proof then it will crash
2025-10-08 17:32:16 × tromp quits (~textual@2001:1c00:3487:1b00:b551:deec:8ee1:7922) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-10-08 17:34:07 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-10-08 17:34:28 <__monty__> I don't mind spending time on cases that aren't actually partial but there's lots of cases that are.
2025-10-08 17:35:41 <tomsmeding> intentionally partial, you mean?
2025-10-08 17:36:19 <EvanR> this is all avoided if you can structure it so the compiler checks all the cases for you
2025-10-08 17:36:26 <__monty__> What I really mean is that the lists often end up never being empty where I call head.
2025-10-08 17:36:48 <EvanR> yeah ideally you can prove it
2025-10-08 17:36:56 <tomsmeding> doesn't that amount to an (unstated) proof that it isn't actually partial
2025-10-08 17:37:04 <tomsmeding> i.e. the opposite of what you're saying :p
2025-10-08 17:37:36 <EvanR> implicitly at some point dealing with non empty lists and so the restriction of head on that domain is total
2025-10-08 17:39:35 tromp joins (~textual@2001:1c00:3487:1b00:b551:deec:8ee1:7922)
2025-10-08 17:40:25 <__monty__> tomsmeding: Does it? I'm pretty sure I said I don't have proof of either case (yet). The yet falling into place when it errors.
2025-10-08 17:41:19 <EvanR> crashing is empirical proof it's partial
2025-10-08 17:41:43 <tomsmeding> __monty__: "the lists often end up never being empty where I call head" -- based on what?
2025-10-08 17:42:39 <haskellbridge> <sm> If you don't want to remove partial code from your program yet, I would say at least handle the unexpected case with an error message admitting programmer error and naming the function
2025-10-08 17:43:04 <haskellbridge> <sm> (and package)
2025-10-08 17:43:20 <EvanR> [] -> error "I've been bad. So very very bad. __FILE__ __LINE__"
2025-10-08 17:43:41 <tomsmeding> if this is to be public library code, yes
2025-10-08 17:45:00 <haskellbridge> <sm> I would say in your own private code too, you'll thank yourself later
2025-10-08 17:45:28 <haskellbridge> <sm> except throwaway stuff, fine
2025-10-08 17:45:29 <__monty__> tomsmeding: Based on experience. I don't tend to go around willy nilly asking for heads to be chopped off.
2025-10-08 17:45:39 <geekosaur> I have one place where I use `head` and I know it'll always be nonempty, but the library code it's coming from doesn't yet use `NonEmpty` to prove it
2025-10-08 17:45:41 × Googulator10 quits (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu) (Quit: Client closed)
2025-10-08 17:45:41 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-08 17:45:45 Googulator48 joins (~Googulato@2a01-036d-0106-03fa-5967-6f2a-1e2d-f05a.pool6.digikabel.hu)
2025-10-08 17:45:52 <EvanR> I ask for heads to show their papers please
2025-10-08 17:46:05 <geekosaur> (were the list to be emoty, the library would refuse to start up and therefore my code won't be run)
2025-10-08 17:46:13 <geekosaur> *empty
2025-10-08 17:46:33 <__monty__> But that's what `head` should do for me, sm!
2025-10-08 17:46:55 <EvanR> it can't really
2025-10-08 17:47:13 <tomsmeding> yes it can and it does because it takes HasCallStack
2025-10-08 17:47:16 <haskellbridge> <sm> it would be nice if that was automatic, yes. (Except, you don't always want production code leaking such details)
2025-10-08 17:47:16 <EvanR> unless you change the type signature to have a call stack constrain---
2025-10-08 17:47:17 <__monty__> And that's a wart, IMO.
2025-10-08 17:47:23 <EvanR> :t head
2025-10-08 17:47:24 <lambdabot> [a] -> a
2025-10-08 17:47:27 <tomsmeding> % :t head
2025-10-08 17:47:27 <yahb2> <interactive>:1:1: warning: [GHC-63394] [-Wx-partial] ; In the use of ‘head’ ; (imported from Prelude, but defined in GHC.Internal.List): ; "This is a partial function, it throws an err...
2025-10-08 17:47:33 <tomsmeding> ...
2025-10-08 17:47:35 <tomsmeding> %% :t head
2025-10-08 17:47:35 <yahb2> https://paste.tomsmeding.com/xLob5lz5
2025-10-08 17:50:15 <EvanR> head :: GHC.Internal.Stack.Types.HasCallStack => [a] -> a
2025-10-08 17:50:21 <EvanR> sweet
2025-10-08 17:50:25 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-10-08 17:50:44 <tomsmeding> that does beg the question why bwe got "*** Exception: Prelude.last: empty list" without anything else
2025-10-08 17:50:49 <tomsmeding> % :t last
2025-10-08 17:50:49 <yahb2> last :: GHC.Internal.Stack.Types.HasCallStack => [a] -> a
2025-10-08 17:50:56 <tomsmeding> % last []
2025-10-08 17:50:56 <yahb2> *** Exception: Prelude.last: empty list ; ; HasCallStack backtrace: ; error, called at libraries/ghc-internal/src/GHC/Internal/List.hs:2036:3 in ghc-internal:GHC.Internal.List ; errorEmptyList...
2025-10-08 17:51:28 <tomsmeding> or maybe they did but just didn't find that callstack helpful enough, which is fair enough :p
2025-10-08 17:51:40 <__monty__> So it already shows where the naughty instance is? And we're all just fantasizing that it's hard to pinpoint still?
2025-10-08 17:51:49 <haskellbridge> <sm> tomsmeding I think monty was wishing that it would report where the bad partial code is (package, module, line number etc.)
2025-10-08 17:51:55 <tomsmeding> __monty__: it shows where the naughty instance is, but not how the program got there
2025-10-08 17:52:12 <tomsmeding> and if the instance is in some kind of often-utility function, sometimes that still tells you very little
2025-10-08 17:52:19 <haskellbridge> <sm> such information is famously elusive in GHC's various back/stack traces
2025-10-08 17:52:22 <__monty__> That's good enough for me, so I'm happier now than I was 20 minutes ago.
2025-10-08 17:52:30 <tomsmeding> %% last []
2025-10-08 17:52:31 <yahb2> https://paste.tomsmeding.com/dg8lKLH8

All times are in UTC.