Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,721 events total
2021-07-27 23:18:58 <Axman6> lechner: there will be times where the type system frustrates you, and you will ask yourself questions that begin "Why can't I just..." but then you'll remember that the compiler is your friend and wants to help you, and you also need to work to help it understand your needs. It's like a good relationship
2021-07-27 23:19:08 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 23:19:28 <Axman6> (Yes, writing perl, python and ruby is like having a relationship where you throw abuse at your partner and expect it to do what you mean)
2021-07-27 23:19:59 × Null_A quits (~null_a@2601:645:8700:2290:5520:ed9a:24da:3d0c) (Remote host closed the connection)
2021-07-27 23:20:15 Null_A joins (~null_a@2601:645:8700:2290:5520:ed9a:24da:3d0c)
2021-07-27 23:20:19 <Axman6> DigitalKiwi: Either (Soon Book) (Maybe Never)
2021-07-27 23:21:31 mr-red joins (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4)
2021-07-27 23:21:56 × drd quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Ping timeout: 252 seconds)
2021-07-27 23:27:02 <Cajun> well the compiler does its best to help, sometimes it just isnt very good at it lol
2021-07-27 23:27:37 <lechner> it's the thought that counts
2021-07-27 23:27:53 pesada joins (~agua@2804:18:4a:f76c:1:0:5e60:e39)
2021-07-27 23:28:27 × mr-red quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Quit: ZNC 1.8.2 - https://znc.in)
2021-07-27 23:28:39 <Axman6> exactly, you shouldn't expect perfection from your partner. Sometimes they will mess up and delete your source code when it doesn't type check
2021-07-27 23:29:28 <cheater> hmm... a compiler that deletes code that's too stupid... that's an interesting design idea
2021-07-27 23:29:34 <hpc> i read that windows defender did that to someone the other day with a tool they wrote to generate license keys for some software they sold
2021-07-27 23:29:44 <hpc> so not even outside the realm of possibility lol
2021-07-27 23:29:46 <Axman6> cheater: that was an actual GHC bug
2021-07-27 23:29:53 <cheater> nice
2021-07-27 23:30:05 <cheater> but did it commit and force push the git?
2021-07-27 23:30:16 <cheater> because if not, then it's just half measures
2021-07-27 23:30:16 <Axman6> it might have been before git...
2021-07-27 23:30:18 <DigitalKiwi> well if you weren't so careless GHC wouldn't have thrown it out!
2021-07-27 23:31:32 <DigitalKiwi> https://gitlab.haskell.org/ghc/ghc/-/issues/163
2021-07-27 23:31:35 <Cajun> how about if you abuse unsafePerformIO to get around immutability it throws it out
2021-07-27 23:32:07 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-07-27 23:32:10 × pbrisbin quits (~patrick@174-083-170-200.res.spectrum.com) (Ping timeout: 240 seconds)
2021-07-27 23:32:36 × agua quits (~agua@2804:14c:8793:8e2f:24cc:893e:e794:aea7) (Ping timeout: 276 seconds)
2021-07-27 23:36:25 Matthias1 joins (~Matthias1@2603-8001-b545-4900-d18f-7add-ad3c-4ebe.res6.spectrum.com)
2021-07-27 23:36:34 × Matthias1 quits (~Matthias1@2603-8001-b545-4900-d18f-7add-ad3c-4ebe.res6.spectrum.com) (Client Quit)
2021-07-27 23:38:59 × argento quits (~argent0@168-227-96-51.ptr.westnet.com.ar) (Ping timeout: 252 seconds)
2021-07-27 23:40:38 <lechner> Hi, is there a naming convention for function variables, other than starting with a lowercase letter?
2021-07-27 23:41:41 <monochrom> I hate camel case but I respect that it's a community choice so I play along.
2021-07-27 23:41:46 <Axman6> make the name meaningful is there is a meaningful name, otherwise use a well used placeholder - x and xs are common because they can usually represent anything
2021-07-27 23:41:51 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 23:42:39 aegon joins (~mike@174.127.249.180)
2021-07-27 23:42:47 <geekosaur> for a generic function variable, something like f / g / h
2021-07-27 23:43:26 <monochrom> And yeah, supposedly generic entities shouldn't take your time choosing "meaningful" names. Save it for really specific entities.
2021-07-27 23:43:47 <Axman6> there are conventions for type variable names, and sometimes using that same name for the variables with that type can be useful (but also confusing to those who are very new)
2021-07-27 23:44:32 <lechner> i use meaningful names but they can get long, and because of the JSON i have I'm getting drawn into the East Coast underscore_style
2021-07-27 23:45:50 <Axman6> Jed Wesley-Smith's talk 'Why "Names Don't Matter" matters' is pretty good on the topic IIRC https://www.youtube.com/watch?v=ZSNg6KNzydQ (I'm a bit biased though)
2021-07-27 23:46:24 <Axman6> you can control the names that are generated in your json and have it convery to snake case if you need that
2021-07-27 23:46:38 cjb joins (~cjb@user/cjb)
2021-07-27 23:47:03 <Cajun> functions also tend to have some way of denoting what it uses, like mapM (monadic), foldl' (its strict), etc
2021-07-27 23:49:10 <janus> % :t replicateM
2021-07-27 23:49:10 <yahb> janus: Applicative m => Int -> m a -> m [a]
2021-07-27 23:49:14 <janus> and they can lie about it :P
2021-07-27 23:50:02 <Axman6> It's like conferate statues in the US, a relic of the past that should be changed
2021-07-27 23:51:17 dajoer joins (~david@user/gvx)
2021-07-27 23:51:19 <monochrom> BTW I avoid using the word "isomorphism" and its derivatives.
2021-07-27 23:51:38 finsternis joins (~X@23.226.237.192)
2021-07-27 23:51:54 <dsal> replicate'M
2021-07-27 23:52:08 <Axman6> yeah the cool kids use s'morphism these days
2021-07-27 23:52:14 <dsal> @hoogle replicate'M
2021-07-27 23:52:14 <lambdabot> No results found
2021-07-27 23:52:16 <dsal> boo
2021-07-27 23:52:19 <Axman6> sounds less like an apple product
2021-07-27 23:52:35 <Axman6> @hoogle m'Lady
2021-07-27 23:52:35 <lambdabot> No results found
2021-07-27 23:52:45 <dsal> "meaningful names" are often pretty terrible and distracting.
2021-07-27 23:52:45 <monochrom> It can be a very precise and meaningful word, but only when me and my audience have already established context regarding what structure is being preserved.
2021-07-27 23:53:57 <monochrom> If I am just explaining to a beginner that "Bool->X" and "(X,X)" represent the same thing, I stay informal and say "equivalent" in the daily English sense, or at most I go "bijective".
2021-07-27 23:54:08 <Axman6> "One-to-one correspondy boi"
2021-07-27 23:54:33 <monochrom> There is absolutely no need to encourage beginners to cargo-cult the word "ismorphism".
2021-07-27 23:55:02 <lechner> can the scrutinee be an expression?
2021-07-27 23:55:15 <dsal> Sure, yeah.
2021-07-27 23:55:31 <monochrom> If you take a poll in the Haskell community, I bet you that you will find that most people reply "I say 'isomorphism' because, only because, I hear other people say it, I don't really know why".
2021-07-27 23:55:33 <DigitalKiwi> replicate'm? damn near killed'em
2021-07-27 23:55:56 <Axman6> XD
2021-07-27 23:56:09 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-07-27 23:57:23 <lechner> Can something like this tool_folder <- getTool (tool config) tempdir really be turned into something like case (getTool (tool config) tempdir) of ?
2021-07-27 23:57:38 <Axman6> no
2021-07-27 23:57:45 <Axman6> well, it depends which monad you're working in
2021-07-27 23:57:58 <Axman6> there's a lot of missing context around that <-
2021-07-27 23:58:10 <dsal> You can lambdacase it.
2021-07-27 23:58:12 <lechner> yeah
2021-07-27 23:58:55 <dsal> But `x <- a` isn't an expression, it's a fancy way to write `x >>= \a -> ...`
2021-07-27 23:59:11 × Deide quits (~Deide@user/deide) (Quit: Seeee yaaaa)
2021-07-27 23:59:16 <lechner> i know i did not use the right term
2021-07-27 23:59:55 <dsal> With LambdaCase you can write `getTool (tool config) tempDir >>= \case ...`
2021-07-28 00:00:15 <lechner> now you are talking
2021-07-28 00:00:27 <lechner> that could be my first >>=
2021-07-28 00:01:17 <c_wraith> the haskell spec calls `x <- a` a statement in its grammar. Which is funny. Haskell has statements, but only inside of special expressions.
2021-07-28 00:01:34 <monochrom> do { mt <- getTool (tool config) tempdir; case mt of ... }
2021-07-28 00:02:07 <lechner> that's what i have now, and i'll probably keep it
2021-07-28 00:02:14 <lechner> just learning
2021-07-28 00:02:18 <dsal> Yeah, LambdaCase is occasionally nice.
2021-07-28 00:02:26 <dsal> Not using `do` is pretty often an improvement.
2021-07-28 00:02:27 <lechner> what a great language
2021-07-28 00:02:41 <lechner> what have i been doing all these years?
2021-07-28 00:03:22 <monochrom> I don't teach the do-notation in my class. This has improved student learning.
2021-07-28 00:03:35 × Null_A quits (~null_a@2601:645:8700:2290:5520:ed9a:24da:3d0c) (Remote host closed the connection)
2021-07-28 00:03:50 <monochrom> You can bet that if you remove a cargo-culting opportunity you improve learning.
2021-07-28 00:03:54 <dsal> @don't do { x <- a; f a }
2021-07-28 00:03:55 <lambdabot> Unknown command, try @list
2021-07-28 00:03:58 <dsal> @undo do { x <- a; f a }
2021-07-28 00:03:58 <lambdabot> a >>= \ x -> f a
2021-07-28 00:04:29 <dsal> Isn't that just `f <$> a` ?
2021-07-28 00:04:57 <dsal> I need to take a break from computers for a bit.
2021-07-28 00:05:07 <monochrom> I take it that you mean "f x" not "f a"
2021-07-28 00:05:09 <Axman6> We definitely need toi add @don't to lambdabot

All times are in UTC.