Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 987 988 989 990 991 992 993 994 995 996 997 .. 18030
1,802,903 events total
2021-07-17 16:38:11 × smichel17 quits (~smichel17@c-73-68-217-18.hsd1.ma.comcast.net) (Quit: smichel17)
2021-07-17 16:40:10 <maerwald> can you derive LabelOptic with deriving via for an inner type?
2021-07-17 16:41:05 × retro_ quits (~retro@97e2ba5d.skybroadband.com) (Ping timeout: 268 seconds)
2021-07-17 16:41:42 × retroid_ quits (~retro@97e2ba5d.skybroadband.com) (Ping timeout: 268 seconds)
2021-07-17 16:42:24 retroid_ joins (~retro@97e2ba5d.skybroadband.com)
2021-07-17 16:42:50 <oso> xpost from #haskell-beginners:
2021-07-17 16:42:52 <oso> I'm passing around a type synonym for Int, but in reality the only constraint it needs to follow is that it's hashable. what constructor do i use for this? my brain says go from `type UID = Int` to `data UID a = Hashable a` but that's very not correct, and google isn't helping much
2021-07-17 16:43:21 <oso> nvm sorry got an answer there
2021-07-17 16:48:56 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-17 16:49:57 lavaman joins (~lavaman@98.38.249.169)
2021-07-17 16:50:11 × Guest14 quits (~Guest14@76-236-222-208.lightspeed.tukrga.sbcglobal.net) (Quit: Client closed)
2021-07-17 16:51:02 × favonia quits (~favonia@user/favonia) (Ping timeout: 255 seconds)
2021-07-17 16:51:26 favonia joins (~favonia@user/favonia)
2021-07-17 16:52:47 × cheater quits (~Username@user/cheater) (Remote host closed the connection)
2021-07-17 16:53:50 machinedgod joins (~machinedg@24.105.81.50)
2021-07-17 16:54:37 <glguy> oso, if you just need to know that something is hashable you'd use it like: stuff :: Hashable a => a -> b -> c
2021-07-17 16:54:39 × lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 268 seconds)
2021-07-17 16:54:39 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-07-17 16:55:19 <glguy> If a parameter is the uid parameter you can document that like: stuff :: Hashable uid => uid {- ^ the UID -} -> etc
2021-07-17 16:55:35 <oso> I was trying to do that while also using types to keep my signatures from becoming unwieldy, but first i'll just worry about getting the code working
2021-07-17 16:55:43 × keutoi quits (~keutoi@157.48.202.216) (Quit: leaving)
2021-07-17 16:55:53 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 268 seconds)
2021-07-17 16:55:58 burnsidesLlama joins (~burnsides@dhcp168-011.wadham.ox.ac.uk)
2021-07-17 16:56:05 cheater joins (~Username@user/cheater)
2021-07-17 16:56:22 <glguy> the documentation for parameters goes in the haddock comments rather than type synonyms
2021-07-17 16:56:43 <oso> mmk
2021-07-17 16:57:00 × chris_ quits (~chris@81.96.113.213) (Remote host closed the connection)
2021-07-17 16:57:52 burnside_ joins (~burnsides@dhcp168-011.wadham.ox.ac.uk)
2021-07-17 16:57:55 smichel17 joins (~smichel17@2601:193:8300:4b9::600)
2021-07-17 16:58:06 × burnsidesLlama quits (~burnsides@dhcp168-011.wadham.ox.ac.uk) (Read error: Connection reset by peer)
2021-07-17 17:00:31 × arjun quits (~user@user/arjun) (Ping timeout: 250 seconds)
2021-07-17 17:01:33 × mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Read error: Connection reset by peer)
2021-07-17 17:02:18 mikoto-chan joins (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be)
2021-07-17 17:05:40 <dsal> oso: It's tempting to put constraints in the type definitions, but if you take a look at, for example, `Data.Map.Strict` you'll see the type definition is just `data Map k a`. You'd think k would always have to be ordered, but that's not the case. You can create and work on maps that have unorderable keys when you don't do things that require ordering. e.g.:
2021-07-17 17:05:42 <dsal> > M.elems $ (* 2) <$> M.singleton id 3
2021-07-17 17:05:43 <lambdabot> [6]
2021-07-17 17:07:10 <dsal> The idea is that you only have to constrain things where they actually need to be constrained. The Functor instance, e.g., doesn't care about the keys at all, so why should it require they're ordered?
2021-07-17 17:08:00 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-07-17 17:09:25 × Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)
2021-07-17 17:11:52 waleee joins (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd)
2021-07-17 17:12:32 dyeplexer joins (~dyeplexer@user/dyeplexer)
2021-07-17 17:13:45 <oso> got it working \o/
2021-07-17 17:13:47 <oso> thank you
2021-07-17 17:15:07 tzh joins (~tzh@c-24-21-73-154.hsd1.or.comcast.net)
2021-07-17 17:16:22 nate1 joins (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net)
2021-07-17 17:21:49 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-17 17:22:00 mnrmnaugh joins (~mnrmnaugh@pool-96-252-87-182.bstnma.fios.verizon.net)
2021-07-17 17:26:35 × Null_A quits (~null_a@2601:645:8700:2290:b55a:33c2:1e1d:f229) (Remote host closed the connection)
2021-07-17 17:27:45 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 255 seconds)
2021-07-17 17:28:36 Sgeo joins (~Sgeo@user/sgeo)
2021-07-17 17:41:25 Pickchea joins (~private@user/pickchea)
2021-07-17 17:42:19 shapr joins (~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-07-17 17:43:14 × mcfrdy quits (~mcfrdy@user/mcfrdy) (Ping timeout: 255 seconds)
2021-07-17 17:44:09 × mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 258 seconds)
2021-07-17 17:44:25 mcfrdy joins (~mcfrdy@45.67.96.126)
2021-07-17 17:44:26 × mcfrdy quits (~mcfrdy@45.67.96.126) (Changing host)
2021-07-17 17:44:26 mcfrdy joins (~mcfrdy@user/mcfrdy)
2021-07-17 17:46:09 <hololeap> so, I figured out a way to make a function with an arbitrary number of arguments using type families and type-level lists. but, I have to wonder ... has someone already made this and put it on hackage?
2021-07-17 17:47:04 lavaman joins (~lavaman@98.38.249.169)
2021-07-17 17:47:46 <texasmynsted> wait, why do you want a function with an arbitrary number of arguments?
2021-07-17 17:48:31 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
2021-07-17 17:49:03 <c_wraith> usually to cover for a lack of other expressiveness
2021-07-17 17:49:09 <c_wraith> printf is a common example
2021-07-17 17:49:12 <texasmynsted> Seems to me ideally a function should have exactly one argument
2021-07-17 17:49:19 <c_wraith> We can't write the type it actually has in Haskell
2021-07-17 17:49:25 <c_wraith> Because it's a dependent type
2021-07-17 17:49:51 <c_wraith> So varargs lets us do it anyway and fail at runtime if the programmer got it wrong
2021-07-17 17:50:07 <texasmynsted> printf solves a problem in a particular way that I think could be solved better, differently
2021-07-17 17:50:18 <c_wraith> differently? sure. Better? Not really.
2021-07-17 17:50:21 <hololeap> the motivation was because I had a typeclass with a function, and I encountered some outliers that needed extra arguments passed to that function
2021-07-17 17:50:47 <texasmynsted> c_wraith: I am not convinced
2021-07-17 17:50:48 <hololeap> I'd have to write up a blog post or something to get into all the details
2021-07-17 17:50:57 <Rembane> hololeap: Do it! :D
2021-07-17 17:51:08 <texasmynsted> yes, that would be a good read
2021-07-17 17:51:15 <c_wraith> printf is *really* good at doing exactly what it's intended for. Compactly specifying output formatted for monospace devices.
2021-07-17 17:51:33 <texasmynsted> like regular expressions?
2021-07-17 17:51:42 <c_wraith> honestly, it's more useful
2021-07-17 17:52:01 <c_wraith> regular expressions have to involve things like capturing group to really be useful, and those complicate APIs tremendously
2021-07-17 17:52:05 <c_wraith> printf has no such problems
2021-07-17 17:52:20 <texasmynsted> Right. I think regular expressions work great but are terrible and the problem is better solved differently
2021-07-17 17:52:46 <EvanR> compare and contrast serious uses of printf with the expanded version, replicate that across a code base like 50 times and compare xD
2021-07-17 17:53:12 <EvanR> also, printf for debugging
2021-07-17 17:53:25 <EvanR> debugging would be harsher without it
2021-07-17 17:53:56 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds)
2021-07-17 17:54:27 <EvanR> I'm more interested with this case of some function sometimes needing more arguments
2021-07-17 17:56:04 <texasmynsted> I am still going with functions should have exactly one argument
2021-07-17 17:56:30 <hololeap> I mean... they do, technically.
2021-07-17 17:57:24 Null_A joins (~null_a@2601:645:8700:2290:b55a:33c2:1e1d:f229)
2021-07-17 17:57:38 <texasmynsted> yes
2021-07-17 17:58:02 <EvanR> if the difference is between argument type (A,B) and (A,B,C) it's about argument type and not number
2021-07-17 17:58:23 <texasmynsted> Okay now we are getting somewhere
2021-07-17 18:00:32 MorrowM joins (~Morrow@bzq-110-168-31-106.red.bezeqint.net)
2021-07-17 18:00:36 × azeem quits (~azeem@dynamic-adsl-94-34-31-95.clienti.tiscali.it) (Ping timeout: 265 seconds)
2021-07-17 18:00:57 × johnw quits (~johnw@76-234-69-149.lightspeed.frokca.sbcglobal.net) (Ping timeout: 245 seconds)
2021-07-17 18:01:47 × Morrow quits (~Morrow@bzq-110-168-31-106.red.bezeqint.net) (Ping timeout: 258 seconds)
2021-07-17 18:03:07 azeem joins (~azeem@176.201.25.252)
2021-07-17 18:05:26 × flukiluke_ quits (~flukiluke@168.138.23.5) (Ping timeout: 265 seconds)
2021-07-17 18:05:49 flukiluke joins (~flukiluke@2603:c023:c000:6c7e:8945:ad24:9113:a962)
2021-07-17 18:06:15 × elcaro quits (~anonymous@45.32.191.75) (Ping timeout: 252 seconds)
2021-07-17 18:07:09 elcaro joins (~anonymous@45.32.191.75)

All times are in UTC.