Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-09 02:38:16 <laudiacay> oh that also works
2021-04-09 02:38:18 <laudiacay> wow thank you
2021-04-09 02:38:43 <laudiacay> i felt like it was lift but then i googled tuple lifting and that was not what i wanted in my google search results
2021-04-09 02:39:01 <koz_> You can also use applicative notation; if f :: a -> b -> c, x :: IO a, b :: IO b, you can write f <$> x <*> y :: IO c
2021-04-09 02:39:14 <laudiacay> oh thats very nice......
2021-04-09 02:39:15 <koz_> So for the tuple case, you could do (,) <$> x <*> y :: IO (a, b)
2021-04-09 02:39:19 <laudiacay> i need to get better at notation
2021-04-09 02:39:22 <gnumonic> or: a >>= \a' -> b >>= \b' -> pure $ f a' b'
2021-04-09 02:39:36 <gnumonic> if you really like >>=. probably better to use the applicative stuff
2021-04-09 02:39:39 <laudiacay> yall are darlings and im going to be asking you a lot of silly questions in the near future
2021-04-09 02:39:40 <koz_> Yeah, you can do that, but the applicative style is a lot more convenient IMHO.
2021-04-09 02:39:48 <koz_> laudiacay: We're happy to help.
2021-04-09 02:39:59 <laudiacay> how do i stop doing the pattern of "aaaaagh >>= (return.some . stuff)
2021-04-09 02:40:04 <laudiacay> in ghci
2021-04-09 02:40:10 <laudiacay> i feel like a dork
2021-04-09 02:40:19 <laudiacay> just putting return. in front of everything
2021-04-09 02:40:28 <koz_> foo >>= (return . f) is the same as fmap f foo
2021-04-09 02:40:37 <laudiacay> oh jeez
2021-04-09 02:40:40 <koz_> Or f <$> foo if you prefer.
2021-04-09 02:40:42 <laudiacay> wow monads are functors arent they
2021-04-09 02:40:47 <koz_> Among other things.
2021-04-09 02:40:48 <laudiacay> its been a SECOND
2021-04-09 02:40:49 <gnumonic> you should use pure instead of return. saves you two characters :p
2021-04-09 02:40:50 × cads2 quits (~cads@ip-64-72-99-232.lasvegas.net) (Ping timeout: 252 seconds)
2021-04-09 02:40:53 <laudiacay> that was so embarrassing
2021-04-09 02:41:00 <koz_> gnumonic: In that particular case, you should use _neither_. :P
2021-04-09 02:41:07 <laudiacay> lmao
2021-04-09 02:42:10 <laudiacay> ohhhh my goooosh the applicative infix just
2021-04-09 02:42:12 <laudiacay> saved my life
2021-04-09 02:42:15 <laudiacay> you dont understand
2021-04-09 02:42:36 <koz_> It's a very neat thing, for sure.
2021-04-09 02:42:38 <laudiacay> i was like up arrow, tack another bind and (return.somestuff) onto the already-heinous 3-terminal-line-long trainwreck
2021-04-09 02:42:54 <laudiacay> it was heeeeeinous
2021-04-09 02:43:10 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2021-04-09 02:44:15 <gnumonic> you can use do notation in ghci btw. though at the moment i forget where the braces go exactly
2021-04-09 02:44:37 <laudiacay> sounds complicated
2021-04-09 02:44:45 <laudiacay> this way i get better at infix though
2021-04-09 02:44:48 <laudiacay> so i dont really mind
2021-04-09 02:44:58 <laudiacay> the other day i learned about `?` and i was elated
2021-04-09 02:45:05 <laudiacay> like just the question mark not the uh
2021-04-09 02:45:08 <laudiacay> ticks
2021-04-09 02:45:10 Codaraxis_ joins (~Codaraxis@ip68-5-90-227.oc.oc.cox.net)
2021-04-09 02:45:19 <gnumonic> yeah i don't really see the point. you can also do case expressions on one line with curly braces but it's like, eh, doesn't seem very haskelley
2021-04-09 02:45:32 <laudiacay> yea
2021-04-09 02:45:45 <laudiacay> im gonna get better at lens infix soon
2021-04-09 02:45:51 <laudiacay> soon im just going to be haskelling in runes
2021-04-09 02:45:58 <laudiacay> like defining my own heinous infix operators
2021-04-09 02:46:09 <laudiacay> what man can stop me, none, ill be so powerful
2021-04-09 02:46:25 <gnumonic> there's kind of a logic to the lens operators, they mostly aren't that bad
2021-04-09 02:46:38 <laudiacay> lens type signatures just spook me yaknow
2021-04-09 02:46:47 <gnumonic> though for some reason it took me forever to get used to backwards fmap (<&>)
2021-04-09 02:46:49 <laudiacay> like i know what theyre meant for, i feel like i get the feeling of lenses
2021-04-09 02:46:55 <laudiacay> but they literally say "stab" like what
2021-04-09 02:47:09 <DigitalKiwi> https://xkcd.com/1704/
2021-04-09 02:47:26 snowflake joins (~snowflake@gateway/tor-sasl/snowflake)
2021-04-09 02:47:27 <gnumonic> it's easier if you look at the Lens' versions that aren't type-changing
2021-04-09 02:47:30 × zebrag quits (~inkbottle@aaubervilliers-654-1-2-51.w83-200.abo.wanadoo.fr) (Quit: Konversation terminated!)
2021-04-09 02:47:41 × royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 240 seconds)
2021-04-09 02:48:06 <laudiacay> oh i think i copypasted that whole definition into a file once because i had to run my code on a server with a version of ghc with no lenses in the stdlib
2021-04-09 02:48:17 <laudiacay> it was like an autograder
2021-04-09 02:48:34 <laudiacay> i was like "this looks like a reasonable standin for control.lens"
2021-04-09 02:48:41 × Codaraxis quits (Codaraxis@gateway/vpn/mullvad/codaraxis) (Ping timeout: 240 seconds)
2021-04-09 02:49:02 <gnumonic> if you really want your mind blown look at the lens internals. it's a bizarre bazaar of molten magma
2021-04-09 02:49:06 <laudiacay> yeah
2021-04-09 02:49:14 <laudiacay> im not that witchy yet
2021-04-09 02:49:16 <laudiacay> one day
2021-04-09 02:50:11 × theDon quits (~td@muedsl-82-207-238-224.citykom.de) (Ping timeout: 240 seconds)
2021-04-09 02:51:38 <gnumonic> tangentially i found it a bit easier to understand the type signatures if you start w/ traversals and write a few by hand
2021-04-09 02:51:47 <laudiacay> traversals?
2021-04-09 02:52:15 <laudiacay> i am just getting my hands dirty and writing a PR to an open source codebase that uses lenses
2021-04-09 02:52:19 theDon joins (~td@muedsl-82-207-238-007.citykom.de)
2021-04-09 02:52:34 <laudiacay> tangentially that codebase does a lot of things that i do not understand NEARLY as well as i originally thought going in
2021-04-09 02:52:55 <laudiacay> but fortunately im having more trouble with what the code actually does than the "oh god, oh god, lenses are hard"
2021-04-09 02:53:08 <laudiacay> which is always a good sign
2021-04-09 02:53:10 <gnumonic> http://hackage.haskell.org/package/lens-5.0.1/docs/Control-Lens-Traversal.html
2021-04-09 02:54:18 × shailangsa quits (~shailangs@host86-186-136-21.range86-186.btcentralplus.com) (Ping timeout: 260 seconds)
2021-04-09 02:54:52 <laudiacay> oh this makes sense i think
2021-04-09 02:55:14 FinnElija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716)
2021-04-09 02:55:14 finn_elija is now known as Guest22853
2021-04-09 02:55:14 FinnElija is now known as finn_elija
2021-04-09 02:55:19 <gnumonic> agh I can't find the "how to write this stuff by hand to help you understand the type signatures" thing that helped me get it down :-(
2021-04-09 02:55:26 <laudiacay> its ok
2021-04-09 02:55:28 <laudiacay> im in no rush
2021-04-09 02:55:38 <laudiacay> the way i finally understood monads was by.... using them a ton
2021-04-09 02:55:50 <laudiacay> i expect lensguts will end up going the same way
2021-04-09 02:55:54 <laudiacay> i can use them enough for now
2021-04-09 02:56:32 <laudiacay> its really just the "wtf is all these tildes ~uwu~ ~~i feel like an egirl uwu~~"
2021-04-09 02:56:46 <laudiacay> like not having the infix memorized
2021-04-09 02:57:19 <gnumonic> nothing wrong with using the named functions instead fwiw
2021-04-09 02:58:45 × Guest22853 quits (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) (Ping timeout: 240 seconds)
2021-04-09 02:59:13 <laudiacay> but infix is so spooky
2021-04-09 02:59:24 <laudiacay> i feel like an alien of mystery
2021-04-09 03:00:59 <gnumonic> ya it does make you feel like a function sorcerer. and it's fun to show to people who don't understand haskell and be all "but it's so simple this is just infix flipped contramap" or whatever
2021-04-09 03:02:10 × Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer)
2021-04-09 03:04:37 × chenshen quits (~chenshen@2620:10d:c090:400::5:d3b2) (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
2021-04-09 03:04:49 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-04-09 03:07:11 × stree quits (~stree@68.36.8.116) (Ping timeout: 246 seconds)
2021-04-09 03:08:28 <laudiacay> one day....
2021-04-09 03:14:36 star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com)
2021-04-09 03:18:57 shailangsa joins (~shailangs@host86-186-133-58.range86-186.btcentralplus.com)

All times are in UTC.