Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,037 events total
2021-08-10 00:19:33 tommd joins (~tommd@cpe-76-179-204-251.maine.res.rr.com)
2021-08-10 00:19:57 × haykam quits (~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection)
2021-08-10 00:20:10 haykam joins (~haykam@static.100.2.21.65.clients.your-server.de)
2021-08-10 00:34:29 × chomwitt quits (~chomwitt@2a02:587:dc02:6400:12c3:7bff:fe6d:d374) (Remote host closed the connection)
2021-08-10 00:42:47 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-08-10 00:43:47 anononon joins (~anononon@user-5-173-146-83.play-internet.pl)
2021-08-10 00:43:52 Cajun joins (~Cajun@user/cajun)
2021-08-10 00:56:13 Guest4593 joins (~Guest45@2001:8004:2728:3231:22e8:8df9:c65:5ea)
2021-08-10 00:57:44 <lechner> Hi, is it acceptable to replace a . with a $ whenever a chain of functions is being fully applied? Does it matter?
2021-08-10 00:58:00 <Axman6> sure
2021-08-10 00:58:39 <lechner> it only works in a 'do' context, right?
2021-08-10 00:58:44 <geekosaur> thay are not the same thing
2021-08-10 00:58:49 <Axman6> the general pattern people tend to use is f . g . h $ x, I have started using f . g $ h x to remove a symbol, but even f $ g $ h x is pretty common
2021-08-10 00:59:03 <geekosaur> it has nothing to do with do
2021-08-10 00:59:13 <Axman6> @src (.)
2021-08-10 00:59:13 <lambdabot> (f . g) x = f (g x)
2021-08-10 00:59:16 <Axman6> @src ($)
2021-08-10 00:59:16 <lambdabot> f $ x = f x
2021-08-10 00:59:42 <Axman6> they're not always interchangable. I can't see how this would have anything to do with do notation
2021-08-10 01:01:13 <Axman6> :t let ((f .: g) x) y = f x . g y in (.:) -- unrelated, wondering if this even valid
2021-08-10 01:01:15 <lambdabot> (t1 -> b -> c) -> (t2 -> a -> b) -> t1 -> t2 -> a -> c
2021-08-10 01:01:20 <Axman6> :o
2021-08-10 01:01:44 <lechner> for a moment it seemed that 'do' implies full application. maybe my logic was reversed (sufficient vs necessary)
2021-08-10 01:01:49 × xsperry quits (~as@user/xsperry) (Remote host closed the connection)
2021-08-10 01:02:28 <dsal> `do` doesn't have anything to `do` with anything.
2021-08-10 01:02:38 <Axman6> do doesn't
2021-08-10 01:02:53 <dsal> > do do do do "wop"
2021-08-10 01:02:54 <lambdabot> "wop"
2021-08-10 01:03:53 × lbseale quits (~lbseale@user/ep1ctetus) (Read error: Connection reset by peer)
2021-08-10 01:04:31 cjb` joins (~cjb@user/cjb)
2021-08-10 01:05:16 × Skyfire quits (~pyon@user/pyon) (Quit: WeeChat 3.2)
2021-08-10 01:05:18 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-08-10 01:05:29 cjb is now known as Guest8286
2021-08-10 01:05:29 cjb` is now known as cjb
2021-08-10 01:05:58 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-10 01:05:59 <lechner> well, it can't be replaced in all cases, can it? like map (f . g) xs
2021-08-10 01:06:09 × Guest8286 quits (~cjb@user/cjb) (Ping timeout: 260 seconds)
2021-08-10 01:07:27 <Axman6> no, because they do different things
2021-08-10 01:07:55 <Axman6> you talked about situations where it's fully applied, and that isn't one
2021-08-10 01:09:42 <lechner> is for all f,g: replacement legal === fully applied ? or is one space greater?
2021-08-10 01:10:36 <lechner> in other words, are there cases of full application whe replacement does not work?
2021-08-10 01:10:54 <Axman6> I think you should spend some time looking at the definitions and undestanding what they actually mean - they're not magical, playing around with them will show you what is ok and what isn't.
2021-08-10 01:11:10 <Axman6> also understanding their binding power and fixity would help
2021-08-10 01:11:24 × xff0x quits (~xff0x@2001:1a81:5378:e300:775f:2c72:eed7:a05a) (Ping timeout: 272 seconds)
2021-08-10 01:11:46 <lechner> i wasn't asking about parentheses, though
2021-08-10 01:11:53 <dsal> :t f . g
2021-08-10 01:11:54 <lambdabot> error:
2021-08-10 01:11:54 <lambdabot> • Could not deduce (Show b0) arising from a use of ‘f’
2021-08-10 01:11:54 <lambdabot> from the context: (Show a, FromExpr c)
2021-08-10 01:12:04 <dsal> I was hoping magic expr stuff would do something creative.
2021-08-10 01:12:32 <Axman6> it's all relevant to understanding which replacements are ok and which aren't
2021-08-10 01:12:53 <lechner> i asked because i read that $ was controversial.
2021-08-10 01:13:04 xff0x joins (~xff0x@2001:1a81:53b6:2a00:9ab0:6dc8:ce66:af3c)
2021-08-10 01:13:08 <dsal> $ is a heavy hammer
2021-08-10 01:13:19 <dsal> . ties beautiful knots
2021-08-10 01:13:27 <lechner> i was trying to get a sense of its utility, from a purist's view
2021-08-10 01:13:54 <lechner> also avoid ridicule for poor style
2021-08-10 01:14:02 pe200012 joins (~pe200012@218.107.49.28)
2021-08-10 01:14:04 <lechner> i use them more than .
2021-08-10 01:14:15 × dragestil_ quits (~quassel@user/dragestil) (Ping timeout: 258 seconds)
2021-08-10 01:14:29 × fjmorazan quits (~quassel@user/fjmorazan) (Quit: fjmorazan)
2021-08-10 01:14:34 dragestil_ joins (~quassel@user/dragestil)
2021-08-10 01:14:45 <lechner> and i think it's because i spend little time on "pure" programming
2021-08-10 01:14:54 <lechner> i.e. i'm in do
2021-08-10 01:15:05 fjmorazan joins (~quassel@user/fjmorazan)
2021-08-10 01:15:08 <dsal> $ isn't less pure, it just making composition harder.
2021-08-10 01:15:17 <lechner> or impossible?
2021-08-10 01:15:51 <sm> you'll see $ everywhere, I wouldn't worry too much
2021-08-10 01:15:55 <dsal> Yeah. They look similar in some bits of code, but they do different things.
2021-08-10 01:15:58 <dsal> :t (.)
2021-08-10 01:15:59 <lambdabot> (b -> c) -> (a -> b) -> a -> c
2021-08-10 01:16:00 <dsal> :t ($)
2021-08-10 01:16:01 <lambdabot> (a -> b) -> a -> b
2021-08-10 01:16:10 <sm> use whatever makes code clearest/easiest to work with. That will vary depending on situation
2021-08-10 01:16:18 × oso quits (~oso@2601:58c:c080:a950:f275:2530:b398:680b) (Quit: Client closed)
2021-08-10 01:16:44 <sm> $ is more beginner-friendly, I think
2021-08-10 01:16:58 <dsal> $ isn't the root of all problems
2021-08-10 01:17:02 <lechner> i previously thought of $ only as a replacement for parentheses
2021-08-10 01:17:10 <dsal> It's an actual function and you can use it as such.
2021-08-10 01:17:15 <lechner> beginners probably should not use it
2021-08-10 01:17:23 <dsal> Sometimes you actually need $
2021-08-10 01:17:36 <lechner> please say
2021-08-10 01:17:49 <adamCS> $ comes in handy when you want to fmap over a structure (list, say) full of functions and apply each to a fixed argument
2021-08-10 01:17:53 × anononon quits (~anononon@user-5-173-146-83.play-internet.pl) (Ping timeout: 248 seconds)
2021-08-10 01:18:09 <dsal> > ($2) <$> [(2+), (3*)]
2021-08-10 01:18:10 <lambdabot> [4,6]
2021-08-10 01:18:22 <adamCS> yeah
2021-08-10 01:18:26 × tommd quits (~tommd@cpe-76-179-204-251.maine.res.rr.com) (Ping timeout: 256 seconds)
2021-08-10 01:18:52 <lechner> i am a fraid to ask: why is the $ needed?
2021-08-10 01:18:57 <dsal> It's not *needed*
2021-08-10 01:19:01 <dsal> But how else would you write that?
2021-08-10 01:19:03 × natechan quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Read error: Connection reset by peer)
2021-08-10 01:19:07 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-08-10 01:19:08 <adamCS> Just shorthand for (\f -> f 2) but it's pretty
2021-08-10 01:19:09 <dsal> > (\v -> v 2) <$> [(2+), (3*)]
2021-08-10 01:19:10 <lambdabot> [4,6]
2021-08-10 01:19:31 <sm> adding <$> has only muddied the waters :)
2021-08-10 01:19:43 <lechner> i got that!
2021-08-10 01:19:49 <adamCS> I have a love/hate relationship with <$>
2021-08-10 01:19:54 <lechner> dsal: i see. thanks!

All times are in UTC.