Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,676 events total
2021-07-27 19:45:11 <Clint> transliterating them to hanzi?
2021-07-27 19:45:18 <monochrom> Yes.
2021-07-27 19:45:24 Clint nods.
2021-07-27 19:45:45 <Cale> FirstName・LastName
2021-07-27 19:45:53 <lechner> doesn't the last name come first?
2021-07-27 19:46:05 <monochrom> No.
2021-07-27 19:46:23 <Cale> I guess that's why the dot
2021-07-27 19:46:42 <lechner> sorry, i got confused with my chinese name. yours is for transliteration
2021-07-27 19:46:46 <Cale> Well, apart from the fact that it would be awkward to figure out where one name ends and the other begins
2021-07-27 19:47:09 <lechner> it does not matter
2021-07-27 19:47:24 <lechner> for one person
2021-07-27 19:48:44 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 250 seconds)
2021-07-27 19:48:51 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 19:48:53 <lechner> is using too many $ must be a beginner's mistake
2021-07-27 19:49:14 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-27 19:49:44 × Obo quits (~roberto@70.pool90-171-81.dynamic.orange.es) (Ping timeout: 252 seconds)
2021-07-27 19:50:01 <geekosaur> it's often recommended not to use $ at all until you get used to haskell
2021-07-27 19:50:42 <lechner> too many brackets. i wear glasses
2021-07-27 19:51:55 <lechner> but i am not using a single . ! i was so excited about them. also, the pure parts of my programs are tiny. monad in. monad out.
2021-07-27 19:52:19 <yushyin> the general opinion here seems to be that $ is overused and that it is better to use parentheses more often
2021-07-27 19:52:52 <Cale> I dunno, there are places where you definitely want to use $ -- particularly if the argument is long enough that it's annoying to find the matching closing parens
2021-07-27 19:52:53 <monochrom> The correct way to get rid of parenthesis is to defeat the point of Fortran and go back to 3-address instructions: let tmp1 = f x; tmp2 = g tmp1; tmp3 = h tmp2 in k tmp3
2021-07-27 19:53:24 <Cale> But I'll tend not to chain $'s myself, unless I'm trying to blend in with an existing code style
2021-07-27 19:53:40 <Cale> I'll always use composition and then a single $ when I use it
2021-07-27 19:53:57 <monochrom> and roll back 60 years of progress in languages and compilers.
2021-07-27 19:54:28 <Cale> monochrom: Or RPN
2021-07-27 19:54:44 alx741 joins (~alx741@181.196.69.4)
2021-07-27 19:54:53 <DigitalKiwi> don't be silly everyone knows there's no $ in haskell! /s
2021-07-27 19:55:07 <Cale> I wish I hadn't lost all my silly dc snippets
2021-07-27 19:55:37 <Cale> I remember at one point working out how to do maps and folds over the stack in dc :)
2021-07-27 19:55:44 <yushyin> pure $ whatever comes next -- is a common pattern for me
2021-07-27 19:56:12 <Cale> I also never use pure unless it's important that my definition is Applicative polymorphic
2021-07-27 19:56:29 <lechner> i actually understood that
2021-07-27 19:56:32 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 250 seconds)
2021-07-27 19:56:35 <lechner> vs return
2021-07-27 19:56:39 <monochrom> Backus and Knuth worked so hard to find algorithms that can parse (a+b)*c+d so that if you see that formula in math books you can just copy that and it's valid code. Now entitled millenials trash that and want to go back to 3-address instructions.
2021-07-27 19:56:43 <geekosaur> showing your age :þ
2021-07-27 19:56:43 <Cale> When I see "pure" in code, I take it as a sign that Applicative is being used in some nontrivial way, and if it's not, I'm mildly annoyed :)
2021-07-27 19:57:15 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-27 19:58:05 <geekosaur> bet you hate "monad of no return"
2021-07-27 19:58:25 <Cale> I'm less concerned about that
2021-07-27 19:58:33 <lechner> others have told me prefer "pure"
2021-07-27 19:58:38 <lechner> to
2021-07-27 19:59:00 <Cale> I *would* be opposed to return :: Applicative f => a -> f a though
2021-07-27 20:00:01 <Cale> It just helps make typechecking in your head that much easier to have that little cue
2021-07-27 20:00:16 <monochrom> I use pure when the context uses liftA2 or >>= etc so they are on the same page.
2021-07-27 20:00:23 <Cale> Yeah, that's fair
2021-07-27 20:00:36 <Cale> I might use pure in cases where I'm also using (<*>) immediately adjacent to it
2021-07-27 20:00:36 drd joins (~drd@93-39-151-19.ip76.fastwebnet.it)
2021-07-27 20:00:53 <Rembane> I always use pure, I blame Purescript.
2021-07-27 20:01:17 <Cale> Like, maybe I know the thing is a monad, but I'm still using Applicative syntax to combine a bunch of stuff, in that case, pure seems okay.
2021-07-27 20:01:18 <DigitalKiwi> Cale: lol so that tweet you sent earlier from d6 (who i follow on twitter) finally showed up in my feed...only after someone else had quoted tweeted it and d6 retweeted *that*...
2021-07-27 20:01:25 <Cale> hah
2021-07-27 20:01:28 <geekosaur> quite a few people say "just use pure" these days
2021-07-27 20:01:45 <yushyin> i roll a dice before every use. even is pure, odd is return
2021-07-27 20:01:46 <Cale> geekosaur: I'm aware, but I think it does lose something
2021-07-27 20:01:55 LukeHoersten joins (~LukeHoers@user/lukehoersten)
2021-07-27 20:02:02 pschorf joins (~user@208.127.190.222)
2021-07-27 20:02:28 <Cale> Also, I'm of the mindset that "return" is also a pretty good name for what it is most of the time
2021-07-27 20:02:30 <maerwald> I use `pure`
2021-07-27 20:02:38 Deide joins (~Deide@217.155.19.23)
2021-07-27 20:02:38 × Deide quits (~Deide@217.155.19.23) (Changing host)
2021-07-27 20:02:38 Deide joins (~Deide@user/deide)
2021-07-27 20:02:50 × mr-red quits (~drd@93-39-151-19.ip76.fastwebnet.it) (Ping timeout: 258 seconds)
2021-07-27 20:02:58 <Cale> i.e. it makes an action which does nothing except to return the given value as its result
2021-07-27 20:03:01 <monochrom> I prefer "impurify" >:)
2021-07-27 20:03:14 <Cale> haha
2021-07-27 20:04:08 <monochrom> class Monad m => Animate m where anthropomorphize :: a -> m a
2021-07-27 20:04:21 <Cale> Of course, people who just came from imperative programming sometimes find "return" a bit jarring, because it doesn't have the control effects that they're used to.
2021-07-27 20:05:07 × juhp quits (~juhp@128.106.188.220) (Ping timeout: 245 seconds)
2021-07-27 20:05:26 Obo joins (~roberto@70.pool90-171-81.dynamic.orange.es)
2021-07-27 20:05:28 <Cale> Imagine being used to having all your stuff implicitly wrapped in callCC
2021-07-27 20:06:49 juhp joins (~juhp@128.106.188.220)
2021-07-27 20:06:53 chris_ joins (~chris@81.96.113.213)
2021-07-27 20:08:32 <lechner> return actually makes monads less scary. would it be fair to somehow compare monads to imperative function prototypes?
2021-07-27 20:09:33 <jiribenes> it makes monads _look_ less scary, but its semantics confuse the heck out of imperative programmers
2021-07-27 20:10:18 <monochrom> The difference between "I understand, meaning I feel so good" and "I understand, meaning I write correct code".
2021-07-27 20:10:37 <lechner> does it have semantics
2021-07-27 20:10:52 <lechner> it does nothing
2021-07-27 20:10:57 <monochrom> A little bit of semantics from the monad laws.
2021-07-27 20:11:06 <geekosaur> but tey expect semantics
2021-07-27 20:11:13 <monochrom> Beyond that, it's up to actual instances.
2021-07-27 20:11:20 gehmehgeh joins (~user@user/gehmehgeh)
2021-07-27 20:11:37 P1RATEZ joins (piratez@user/p1ratez)
2021-07-27 20:12:00 <monochrom> But do look at "return x >>= k = k x". This tells you a lot. For example, this tells you "not an exit".
2021-07-27 20:12:34 <jiribenes> ^ this
2021-07-27 20:13:04 <monochrom> I know of a monad tutorial (that even makes it to Haskell Weekly News) that gets this wrong.
2021-07-27 20:13:18 <monochrom> Subsequently I shamed them in an exam question.
2021-07-27 20:13:53 <Cale> haha, nice
2021-07-27 20:15:07 <Cale> You also have (x >>= \v -> return v) = x, which is another way to say that return isn't doing a whole lot
2021-07-27 20:15:38 <Cale> But yeah, the actual meaning of return (and (>>=)) varies based on which monad we're talking about
2021-07-27 20:15:55 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 20:16:27 <Cale> So while there's a sort of "imperative-ish" feel to things, sometimes it'll subvert your expectations a bit. Monads can have backtracking, state can flow in the opposite direction from the rest of the computation, etc.
2021-07-27 20:17:03 <maerwald> is that a good thing?
2021-07-27 20:17:18 <Cale> Can be.
2021-07-27 20:17:20 <maerwald> I'd argue it basically makes reasoning harder
2021-07-27 20:17:38 <maerwald> about monadic combinators at least
2021-07-27 20:17:51 <Cale> It's good because we get to define a bunch of functions generically that'll work in any monad, and then use them in every monad we define.
2021-07-27 20:18:00 <maerwald> "work" how?
2021-07-27 20:18:11 <maerwald> rather "somehow"

All times are in UTC.