Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,623 events total
2021-07-27 09:35:42 <ixlun> Right, that's perfect, I'll try and convert that to Vector code and see how I get on. Thanks for the help tomsmeding !
2021-07-27 09:36:26 <tomsmeding> ixlun: FYI the name is because the person I wrote it for used 'fog' as a nick :p
2021-07-27 09:36:52 <ixlun> Haha, I was wondering if there was some subtle joke with the name
2021-07-27 09:40:20 cfricke joins (~cfricke@user/cfricke)
2021-07-27 09:40:27 × cfricke quits (~cfricke@user/cfricke) (Client Quit)
2021-07-27 09:51:25 × azeem quits (~azeem@176.200.241.36) (Ping timeout: 265 seconds)
2021-07-27 09:51:34 dunkeln joins (~dunkeln@94.129.69.87)
2021-07-27 09:52:45 lortabac joins (~lortabac@2a01:e0a:541:b8f0:5a6e:2d28:b93b:2c96)
2021-07-27 09:52:45 azeem joins (~azeem@176.200.241.36)
2021-07-27 09:54:43 × mikoto-chan quits (~mikoto-ch@ip-193-121-10-50.dsl.scarlet.be) (Quit: mikoto-chan)
2021-07-27 09:55:20 × troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset)
2021-07-27 09:59:07 troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua)
2021-07-27 09:59:28 × SoF quits (~skius@user/skius) (Quit: Ping timeout (120 seconds))
2021-07-27 09:59:49 SoF joins (~skius@user/skius)
2021-07-27 10:00:32 jippiedoe joins (~david@2a02-a44c-e14e-1-19ba-6ff5-814d-2f81.fixed6.kpn.net)
2021-07-27 10:00:42 × haritz quits (~hrtz@user/haritz) (Remote host closed the connection)
2021-07-27 10:00:50 haritz joins (~hrtz@2a02:8010:65b5:0:6009:6384:e3cb:2220)
2021-07-27 10:00:51 × haritz quits (~hrtz@2a02:8010:65b5:0:6009:6384:e3cb:2220) (Changing host)
2021-07-27 10:00:51 haritz joins (~hrtz@user/haritz)
2021-07-27 10:01:47 × mastarija quits (~mastarija@31.217.8.174) (Ping timeout: 245 seconds)
2021-07-27 10:01:52 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-07-27 10:02:17 geekosaur joins (~geekosaur@xmonad/geekosaur)
2021-07-27 10:02:59 texasmynsted_ joins (~texasmyns@99.96.221.112)
2021-07-27 10:03:27 × dunkeln quits (~dunkeln@94.129.69.87) (Ping timeout: 245 seconds)
2021-07-27 10:04:42 × texasmynsted quits (~texasmyns@99.96.221.112) (Ping timeout: 240 seconds)
2021-07-27 10:05:18 × tomsmeding quits (~tomsmedin@2a03:b0c0:0:1010::767:3001) (Remote host closed the connection)
2021-07-27 10:05:34 dunkeln joins (~dunkeln@94.129.69.87)
2021-07-27 10:05:36 × chomwitt quits (~chomwitt@athedsl-32041.home.otenet.gr) (Ping timeout: 258 seconds)
2021-07-27 10:05:37 tomsmeding joins (~tomsmedin@tomsmeding.com)
2021-07-27 10:09:03 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 10:14:19 <pmk> I have a function f :: t -> Either a String and I would like to do something like "<" ++ f x ++ ">". I am not sure how to map (++) through Either. I've tried (++) <$> Right "<" <*> f x <*> Right ">" but the second (<*>) rightly complains since its first argument is not a function. I probably could write a function to do it with do notation but is there an idiomatic way to accomplish this using Applicative?
2021-07-27 10:14:53 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 252 seconds)
2021-07-27 10:15:30 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-27 10:16:57 × jippiedoe quits (~david@2a02-a44c-e14e-1-19ba-6ff5-814d-2f81.fixed6.kpn.net) (Ping timeout: 268 seconds)
2021-07-27 10:17:56 × burnsidesLlama quits (~burnsides@dhcp168-022.wadham.ox.ac.uk) (Remote host closed the connection)
2021-07-27 10:18:01 __monty__ joins (~toonn@user/toonn)
2021-07-27 10:18:21 <sshine_> > let f x = pure (show x) :: Either a String; between l r m = l <> m <> r in between "<" ">" <$> f 42
2021-07-27 10:18:23 <lambdabot> Right "<42>"
2021-07-27 10:19:36 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:5a6e:2d28:b93b:2c96) (Ping timeout: 276 seconds)
2021-07-27 10:20:13 <pmk> Thanks sshine_!
2021-07-27 10:20:26 <deejaytee> Using <&> from Data.Functor, you can preserve infix placement if you *really* want to :P
2021-07-27 10:20:31 <deejaytee> e.g. ("<" ++) <$> Right "a" <&> (++ ">")
2021-07-27 10:20:38 <sshine_> > concat <$> sequence [Right "<", Right "42", Right ">"]
2021-07-27 10:20:40 <lambdabot> Right "<42>"
2021-07-27 10:22:10 <sshine_> :t sequence
2021-07-27 10:22:12 <lambdabot> (Traversable t, Monad m) => t (m a) -> m (t a)
2021-07-27 10:22:31 <sshine_> > sequence [Just "hello", Nothing, Just "world"]
2021-07-27 10:22:33 <lambdabot> Nothing
2021-07-27 10:22:41 × dunkeln quits (~dunkeln@94.129.69.87) (Ping timeout: 252 seconds)
2021-07-27 10:22:45 <sshine_> > sequence [Just "hello", Just " ", Just "world"]
2021-07-27 10:22:46 <lambdabot> Just ["hello"," ","world"]
2021-07-27 10:22:47 Kaipi joins (~Kaiepi@nwcsnbsc03w-47-54-173-93.dhcp-dynamic.fibreop.nb.bellaliant.net)
2021-07-27 10:23:12 <sshine_> > concat ["hello", " ", "world"]
2021-07-27 10:23:15 <lambdabot> "hello world"
2021-07-27 10:23:23 <sshine_> > fmap concat (Just ["hello", " ", "world"])
2021-07-27 10:23:25 <lambdabot> Just "hello world"
2021-07-27 10:23:37 <sshine_> :t fmap concat . sequence
2021-07-27 10:23:39 <lambdabot> (Traversable t, Monad f) => t (f [a]) -> f [a]
2021-07-27 10:23:48 <dexterfoo> Is there something like memcpy for Data.Vector.Unboxed.Mutable?
2021-07-27 10:24:03 <sshine_> :t fmap concat . sequence :: [Either a String] -> Either a [String]
2021-07-27 10:24:04 <lambdabot> error:
2021-07-27 10:24:04 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
2021-07-27 10:24:05 <lambdabot> Expected type: [Either a1 String] -> Either a1 [String]
2021-07-27 10:24:11 <sshine_> er :)
2021-07-27 10:24:21 <pmk> hehe :)
2021-07-27 10:24:46 × Kaiepi quits (~Kaiepi@nwcsnbsc03w-47-54-173-93.dhcp-dynamic.fibreop.nb.bellaliant.net) (Ping timeout: 265 seconds)
2021-07-27 10:24:47 Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de)
2021-07-27 10:24:49 <pmk> I think fmap concat . sequence is what I was looking for (or pretty close to it). Thanks!
2021-07-27 10:25:03 <sshine_> :t fmap concat . sequence :: [Either a String] -> Either a String -- there
2021-07-27 10:25:04 <lambdabot> [Either a String] -> Either a String
2021-07-27 10:25:37 × Gurkenglas quits (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) (Read error: Connection reset by peer)
2021-07-27 10:25:56 Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de)
2021-07-27 10:26:09 sshine_ is now known as sshine
2021-07-27 10:26:17 × royo quits (~royo@user/royo) (Remote host closed the connection)
2021-07-27 10:26:33 pesada joins (~agua@177.79.68.96)
2021-07-27 10:28:11 euouae joins (~euouae@user/euouae)
2021-07-27 10:28:15 <euouae> Hello
2021-07-27 10:28:22 dunkeln joins (~dunkeln@94.129.69.87)
2021-07-27 10:28:54 <euouae> How do I use haddock to comment individual arguments? I am not sure how to format it. For example, now I use this style: https://paste.tomsmeding.com/jDqAB5mL
2021-07-27 10:29:15 <euouae> Notice that I have to place :: on a newline so that -> always matches up. If I don't do this, my editor does not enter the right amount of spaces (I have to tab it myself)
2021-07-27 10:29:17 × agua quits (~agua@2804:14c:8793:8e2f:39e9:c5a8:c532:7498) (Ping timeout: 268 seconds)
2021-07-27 10:31:47 royo joins (~royo@user/royo)
2021-07-27 10:31:47 <tomsmeding> euouae: looks like the "standard style", for as far as there's one https://hackage.haskell.org/package/base-4.14.0.0/docs/src/System.IO.html#line-458
2021-07-27 10:32:10 <euouae> do you know which formatter follows that style?
2021-07-27 10:32:12 × azeem quits (~azeem@176.200.241.36) (Ping timeout: 245 seconds)
2021-07-27 10:32:19 tomsmeding doesn't use a formatter
2021-07-27 10:32:20 <euouae> The one formatter I just tried replaces my -- ^ with newlines and --
2021-07-27 10:32:21 <euouae> -- |
2021-07-27 10:32:35 <euouae> You don't? Oh I love them!
2021-07-27 10:32:37 <tomsmeding> can you post what its output is?
2021-07-27 10:32:46 <tomsmeding> does it put the -- | before the argument instead of after it?
2021-07-27 10:32:53 <euouae> https://paste.tomsmeding.com/U2AKRT6Q
2021-07-27 10:33:03 <tomsmeding> that looks horrible to me :p
2021-07-27 10:33:31 azeem joins (~azeem@62.18.161.85)
2021-07-27 10:33:48 <euouae> I agree
2021-07-27 10:33:52 <euouae> It's not too great
2021-07-27 10:33:57 <tomsmeding> so I guess your question is: which formatter preserves "-> Int -- ^ documentation" formatting for function arguments
2021-07-27 10:34:15 <euouae> What I can say is that I prefer a formatter over custom stylistic stuff
2021-07-27 10:36:36 <tomsmeding> but it's all opinion anyway
2021-07-27 10:36:41 <tomsmeding> which formatting is "nicest"

All times are in UTC.