2025/09/26

Newest at the top

2025-09-26 05:15:54 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-09-26 05:14:06 +0200a_fantom(~fantom@90.244.165.186) (Quit: Connection error?!)
2025-09-26 05:10:43 +0200sroso(~sroso@user/SrOso) SrOso
2025-09-26 05:05:25 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-09-26 05:00:07 +0200merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-09-26 04:55:21 +0200werneta(~werneta@syn-071-083-160-242.res.spectrum.com) werneta
2025-09-26 04:51:49 +0200vanishingideal(~vanishing@user/vanishingideal) vanishingideal
2025-09-26 04:49:43 +0200vanishingideal(~vanishing@user/vanishingideal) (Ping timeout: 240 seconds)
2025-09-26 04:44:43 +0200 <Leary> It can still be a fine one-liner: `_singular = prism pure \case{ [x] -> Right x; xs -> Left xs }`
2025-09-26 04:38:09 +0200 <dcpagan> Would have been nice to generically compose my prism with _Cons and _Empty; I thought I was clever with that one-liner.
2025-09-26 04:36:50 +0200vanishingideal(~vanishing@user/vanishingideal) vanishingideal
2025-09-26 04:35:06 +0200vanishing(~vanishing@user/vanishingideal) (Ping timeout: 248 seconds)
2025-09-26 04:32:50 +0200 <dibblego> you can review [Review, Prism, Iso, Equality]
2025-09-26 04:32:22 +0200 <dibblego> i.e. Traversal is not Review
2025-09-26 04:32:02 +0200 <dibblego> no, you cannot review a traversal, which can be seen in this diagram: https://hackage.haskell.org/package/lens
2025-09-26 04:30:49 +0200 <dibblego> ok yes that works on the head of a single-element list
2025-09-26 04:29:18 +0200 <dcpagan> So I can't review Traversals?
2025-09-26 04:28:54 +0200 <dcpagan> h:t -> if null t then Right h else Left (h:t)
2025-09-26 04:28:52 +0200 <dcpagan> [] -> Left []
2025-09-26 04:28:50 +0200 <dcpagan> _singular = prism (:[]) $ \case
2025-09-26 04:28:48 +0200 <dcpagan> _singular :: Prism' [a] a
2025-09-26 04:28:46 +0200 <dcpagan> This works:
2025-09-26 04:26:27 +0200 <dibblego> you could use preview, but it will always return Nothing, by single element do you mean the head of the list? You cannot have that Prism, but you can have the Traversal
2025-09-26 04:24:04 +0200jrm(~jrm@user/jrm) jrm
2025-09-26 04:23:48 +0200jrm(~jrm@user/jrm) (Quit: ciao)
2025-09-26 04:22:49 +0200Square2(~Square@user/square) (Ping timeout: 264 seconds)
2025-09-26 04:21:12 +0200astroanax(~astroanax@2001:19f0:7402:f82:5400:1ff:fec4:f7d7) (Ping timeout: 256 seconds)
2025-09-26 04:21:01 +0200peterbecich(~Thunderbi@syn-172-222-149-049.res.spectrum.com) (Ping timeout: 264 seconds)
2025-09-26 04:19:42 +0200arandombit(~arandombi@user/arandombit) arandombit
2025-09-26 04:19:42 +0200arandombit(~arandombi@2603:7000:4600:ffbe:ddc9:88a6:9e65:4919) (Changing host)
2025-09-26 04:19:41 +0200arandombit(~arandombi@2603:7000:4600:ffbe:ddc9:88a6:9e65:4919)
2025-09-26 04:19:23 +0200inline(~inline@ip-005-146-196-132.um05.pools.vodafone-ip.de) (Ping timeout: 265 seconds)
2025-09-26 04:18:56 +0200annamalai(~annamalai@2409:4042:d8e:423e::9e8a:bb11) annamalai
2025-09-26 04:16:39 +0200Square2(~Square@user/square) Square
2025-09-26 04:15:46 +0200 <dcpagan> How does review work with prisms?
2025-09-26 04:15:22 +0200 <dcpagan> `_single # 1` does not work.
2025-09-26 04:14:57 +0200 <dcpagan> However, I cannot review on it.
2025-09-26 04:14:48 +0200 <dcpagan> It works on my code: It works on my code: https://github.com/DCPagan/Exercism-Haskell/blob/master/go-counting/src/Counting.hs#L57-L58
2025-09-26 04:13:56 +0200inline(~inline@ip-005-146-196-132.um05.pools.vodafone-ip.de) Inline
2025-09-26 04:13:33 +0200 <dcpagan> _single = _Cons . aside _Empty . _1
2025-09-26 04:13:31 +0200 <dcpagan> _single :: (Cons s s a a, AsEmpty s) => Traversal' s a
2025-09-26 04:13:15 +0200 <dcpagan> I want to define a prism that matches a list with a single element, and then get that element.
2025-09-26 04:03:40 +0200arandombit(~arandombi@user/arandombit) (Ping timeout: 244 seconds)
2025-09-26 04:02:31 +0200peterbecich(~Thunderbi@syn-172-222-149-049.res.spectrum.com) peterbecich
2025-09-26 03:59:23 +0200arandombit(~arandombi@user/arandombit) arandombit
2025-09-26 03:59:23 +0200arandombit(~arandombi@2603:7000:4600:ffbe:ddc9:88a6:9e65:4919) (Changing host)
2025-09-26 03:59:23 +0200arandombit(~arandombi@2603:7000:4600:ffbe:ddc9:88a6:9e65:4919)
2025-09-26 03:57:33 +0200qqe(~qqq@185.54.23.100)
2025-09-26 03:56:28 +0200arandombit(~arandombi@user/arandombit) (Ping timeout: 255 seconds)
2025-09-26 03:41:07 +0200humasect(~humasect@dyn-192-249-132-90.nexicom.net) humasect