Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 763 764 765 766 767 768 769 770 771 772 773 .. 5022
502,152 events total
2020-10-21 02:03:46 <texasmynsted> The lets look like something I should be able to remove. https://gist.github.com/mmynsted/b6df6c87056ab5582f82b8b329e39cac
2020-10-21 02:04:48 × conal quits (~conal@ip-66-115-176-174.creativelink.net) (Quit: Computer has gone to sleep.)
2020-10-21 02:07:43 × lagothrix quits (~lagothrix@unaffiliated/lagothrix) (Killed (tepper.freenode.net (Nickname regained by services)))
2020-10-21 02:07:48 lagothrix joins (~lagothrix@unaffiliated/lagothrix)
2020-10-21 02:09:06 × shatriff_ quits (~vitaliish@176.52.219.10) (Remote host closed the connection)
2020-10-21 02:09:23 shatriff joins (~vitaliish@176.52.219.10)
2020-10-21 02:09:31 <dsal> `(,) bad good` is a funny way to write `(bad, good)`
2020-10-21 02:09:54 × shatriff quits (~vitaliish@176.52.219.10) (Remote host closed the connection)
2020-10-21 02:10:12 shatriff joins (~vitaliish@176.52.219.10)
2020-10-21 02:10:43 × shatriff quits (~vitaliish@176.52.219.10) (Remote host closed the connection)
2020-10-21 02:11:02 shatriff joins (~vitaliish@176.52.219.10)
2020-10-21 02:11:15 <dsal> `f (_, v) = V.toList $ V.map redirectMapToPair v` looks a lot like `V.toList . map redirectrMapToPair . snd`
2020-10-21 02:11:28 <dsal> But why are you making a pair if you just want the second part? Just don't make the tuple.
2020-10-21 02:11:31 × shatriff quits (~vitaliish@176.52.219.10) (Remote host closed the connection)
2020-10-21 02:11:51 shatriff joins (~vitaliish@176.52.219.10)
2020-10-21 02:12:19 × shatriff quits (~vitaliish@176.52.219.10) (Remote host closed the connection)
2020-10-21 02:13:37 <dsal> Something like: `loadUrlMap bs = V.toList . V.map f <$> decodeByNameWith myOptions bs where f (RedirectMap _ good) = good`
2020-10-21 02:13:42 <dsal> But I don't know what all that stuff does.
2020-10-21 02:15:21 <texasmynsted> ah well. because I am applying f to the Right of an Either. The Right of the Either has a tuple where I only want the snd bit, which is a vector...
2020-10-21 02:15:54 <texasmynsted> I will try your suggestions. I think they are more readable in any case
2020-10-21 02:17:39 × urodna quits (~urodna@unaffiliated/urodna) (Quit: urodna)
2020-10-21 02:17:53 × alp quits (~alp@2a01:e0a:58b:4920:b909:f1ee:7d69:ad6b) (Ping timeout: 272 seconds)
2020-10-21 02:18:01 Stanley00 joins (~stanley00@unaffiliated/stanley00)
2020-10-21 02:18:08 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2020-10-21 02:18:25 <texasmynsted> THank you
2020-10-21 02:18:30 × theDon quits (~td@94.134.91.48) (Ping timeout: 265 seconds)
2020-10-21 02:18:33 etherealemb joins (602910b8@096-041-016-184.res.spectrum.com)
2020-10-21 02:19:46 <dsal> > let f (_, v) = show v in f <$> Right (1,2)
2020-10-21 02:19:48 <lambdabot> Right "2"
2020-10-21 02:19:54 geowiesnot joins (~user@87-89-181-157.abo.bbox.fr)
2020-10-21 02:19:58 <dsal> > show . snd <$> Right (1,2)
2020-10-21 02:20:01 <lambdabot> Right "2"
2020-10-21 02:20:08 theDon joins (~td@94.134.91.5)
2020-10-21 02:20:28 <dsal> (of course if you don't want the tuple, it's easier to just never have one)
2020-10-21 02:20:37 <etherealemb> Which Haskell GraphQL framework would you guys suggest?
2020-10-21 02:21:23 <dsal> > fmap show <$> Right (1,2)
2020-10-21 02:21:25 <lambdabot> Right (1,"2")
2020-10-21 02:22:25 × tromp quits (~tromp@dhcp-077-249-230-040.chello.nl) (Ping timeout: 240 seconds)
2020-10-21 02:25:10 conal joins (~conal@ip-66-115-176-174.creativelink.net)
2020-10-21 02:25:46 <texasmynsted> Okay I updated the gist with a comment, taking your suggestions. The ones I undestood.
2020-10-21 02:26:04 <dsal> Oh, if that's vector, V.map is just fmap. And V.toList is in Foldable. You don't need the V. My brain keeps trying to remove stuff you don't need there. You may not even need Either. heh
2020-10-21 02:26:36 <dsal> IMO, you should really use `where` instead of `let`. I don't think `let` is helping you here.
2020-10-21 02:26:52 <texasmynsted> okay
2020-10-21 02:27:10 <dsal> What is `decodeByNameWith` ? I think that's part of what's confusing me. I'm making assumptions.
2020-10-21 02:27:22 × xerox_ quits (~xerox@unaffiliated/xerox) (Ping timeout: 260 seconds)
2020-10-21 02:27:43 burg_philo joins (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net)
2020-10-21 02:27:53 × burg_philo quits (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net) (Client Quit)
2020-10-21 02:28:01 × etherealemb quits (602910b8@096-041-016-184.res.spectrum.com) (Remote host closed the connection)
2020-10-21 02:28:15 burg_philo joins (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net)
2020-10-21 02:30:28 hackage eve 0.1.9.0 - An extensible event framework https://hackage.haskell.org/package/eve-0.1.9.0 (ChrisPenner)
2020-10-21 02:30:48 emb joins (602910b8@096-041-016-184.res.spectrum.com)
2020-10-21 02:31:49 <texasmynsted> oh that is from cassava
2020-10-21 02:31:52 <texasmynsted> decodeByNameWith :: FromNamedRecord a => DecodeOptions -> ByteString -> Either String (Header, Vector a)
2020-10-21 02:32:05 jedws joins (~jedws@121.209.161.98)
2020-10-21 02:32:40 <texasmynsted> it gives me the pair on the happy path and I do do not need the Header
2020-10-21 02:33:08 <dsal> Ah, OK. Yeah. I thought something like that was happening, but it was kind of weird with the pair you were processing.
2020-10-21 02:33:34 × Unhammer quits (~Unhammer@gateway/tor-sasl/unhammer) (Remote host closed the connection)
2020-10-21 02:33:47 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-10-21 02:34:13 Unhammer joins (~Unhammer@gateway/tor-sasl/unhammer)
2020-10-21 02:34:27 <dsal> `fmap.fmap` will let you give an `(a -> b)` to make that a `Either String (Header, Vector a) -> Either String (Header, Vector b)`
2020-10-21 02:34:39 <dsal> But you might as well throw away the header.
2020-10-21 02:35:03 × falafel quits (~falafel@71-34-132-121.clsp.qwest.net) (Remote host closed the connection)
2020-10-21 02:35:48 falafel joins (~falafel@71-34-132-121.clsp.qwest.net)
2020-10-21 02:36:25 × burg_philo quits (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net) (Ping timeout: 240 seconds)
2020-10-21 02:36:29 <dsal> You could also write: `good :: RedirectMap -> String; good (RedirectMap _ g) = g` and then `loadUrlMap = toList . ((fmap.fmap) good) . decodeByNameWith myOptions`
2020-10-21 02:37:11 <dsal> I probalby missed something there, but that might be a bit easier to read. Unless you don't like doublefmaps, but (I put too many parens in). In either case, separating out the function for getting goodness from RedirectMap makes it a good deal cleaner.
2020-10-21 02:38:20 <dsal> This would be easier if I started up a GHCI
2020-10-21 02:39:14 Kaiepi joins (~Kaiepi@nwcsnbsc03w-47-55-225-82.dhcp-dynamic.fibreop.nb.bellaliant.net)
2020-10-21 02:39:18 × emb quits (602910b8@096-041-016-184.res.spectrum.com) (Remote host closed the connection)
2020-10-21 02:39:33 × Kaiepi quits (~Kaiepi@nwcsnbsc03w-47-55-225-82.dhcp-dynamic.fibreop.nb.bellaliant.net) (Remote host closed the connection)
2020-10-21 02:39:47 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-10-21 02:39:54 Kaiepi joins (~Kaiepi@nwcsnbsc03w-47-55-225-82.dhcp-dynamic.fibreop.nb.bellaliant.net)
2020-10-21 02:40:41 crestfallen joins (~jvw@135-180-15-188.fiber.dynamic.sonic.net)
2020-10-21 02:41:41 christo joins (~chris@81.96.113.213)
2020-10-21 02:44:19 <dsal> You could also avoid having to write `decodeByNameWith myOptions` and then worrying about the `snd`ing by making `decode :: FromNamedRecord a => ByteString -> Either String (Vector a); decode = fmap snd . decodeByNameWith myOptions`.
2020-10-21 02:45:00 × crestfallen quits (~jvw@135-180-15-188.fiber.dynamic.sonic.net) (Client Quit)
2020-10-21 02:45:46 burg_philo joins (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net)
2020-10-21 02:48:47 <sm[m]> how best to configure stack ghci --ghci-options "-interactive-print=Text.Pretty.Simple.pPrint" --package pretty-simple as my default ?
2020-10-21 02:49:42 <sm[m]> I can put :set -package pretty-simple and :set -interactive-print=Text.Pretty.Simple.pPrint in ~/.ghci, but it only works in projects where I have installed the pretty-simple package, unlike stack's --package which installs it if missing
2020-10-21 02:50:12 × ddellacosta quits (~dd@86.106.121.168) (Ping timeout: 256 seconds)
2020-10-21 02:50:34 <sm[m]> I wondered if there's a way other than alias stack-ghci='stack ghci --ghci-options "-interactive-print=Text.Pretty.Simple.pPrint" --package pretty-simple'
2020-10-21 02:53:08 <sm[m]> by the way, this is from https://github.com/cdepillabout/pretty-simple readme and seems pretty great - auto pretty printing of values in ghci
2020-10-21 02:54:00 × wroathe_ quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: leaving)
2020-10-21 02:54:19 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2020-10-21 02:56:28 hackage selections 0.3.0.0 - Combinators for operating with selections over an underlying functor https://hackage.haskell.org/package/selections-0.3.0.0 (ChrisPenner)
2020-10-21 02:57:14 × burg_philo quits (~igloo@pool-100-33-61-227.nycmny.fios.verizon.net) (Ping timeout: 260 seconds)
2020-10-21 03:00:28 hackage lens-filesystem 0.1.0.0 - Lens interface for your filesystem; still a bit experimental https://hackage.haskell.org/package/lens-filesystem-0.1.0.0 (ChrisPenner)
2020-10-21 03:00:50 <texasmynsted> actually what I need is a mapping of bad url to good url. So the (bad, good) pair is what I am after. A list of them.
2020-10-21 03:01:45 <texasmynsted> The strange part is that cassava is giving me (Header, Vector), I then drop the Header, and parse out the Vector to get the bad/good pair.
2020-10-21 03:02:26 <texasmynsted> :-) Lots of good advice. Thank you so much dsal!
2020-10-21 03:02:54 <dsal> Oh. That's just `Map.fromList`
2020-10-21 03:04:20 thiross joins (~user@161.129.40.8)
2020-10-21 03:05:12 × dansho quits (~dansho@ip68-108-167-185.lv.lv.cox.net) (Quit: Leaving)
2020-10-21 03:06:33 thiross parts (~user@161.129.40.8) ()
2020-10-21 03:08:00 <dsal> I got super distracted by a twitch stream...
2020-10-21 03:08:25 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2020-10-21 03:10:59 <dsal> So if you have `(a -> (k,v))` and you want `(Either String (Header, Vector a)` -> `Either String (Map k v))` then that's something like `fmap (Map.fromList . toList . fmap convert)` (But, again, I don't have a ghci so my faulty brain is guessing.
2020-10-21 03:11:00 <dsal> )
2020-10-21 03:12:07 tromp joins (~tromp@dhcp-077-249-230-040.chello.nl)
2020-10-21 03:14:44 × AlterEgo- quits (~ladew@124-198-158-163.dynamic.caiway.nl) (Ping timeout: 258 seconds)

All times are in UTC.