Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 202 203 204 205 206 207 208 209 210 211 212 .. 5022
502,152 events total
2020-09-25 15:13:48 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 265 seconds)
2020-09-25 15:14:26 <geekosaur> Applicative can do things fmap can't, otherwise we wouldn't have it
2020-09-25 15:14:39 <geekosaur> for example, you can parse with an Applicative but not with a Functor
2020-09-25 15:14:54 <shad0w_> that's what i am trying to understand. why does this even exists /
2020-09-25 15:14:59 tomku joins (~tomku@unaffiliated/tomku)
2020-09-25 15:15:21 <dolio> How do you implement `(a -> b -> c) -> f a -> f b -> f c` with just fmap?
2020-09-25 15:15:37 mu joins (~mu@unaffiliated/mu)
2020-09-25 15:16:09 <shad0w_> you probably can't since fmap :: (a -> b) -> f a -> f b
2020-09-25 15:16:15 <dolio> Right.
2020-09-25 15:16:28 <shad0w_> can b == (b -> c ) ?
2020-09-25 15:16:35 <sm[m]> in the example stats at https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-options-to-produce-runtime-statistics, max_bytes_used is 1065272 and peak_megabytes_allocated is 3. How/are those related ?
2020-09-25 15:16:37 <dolio> It can.
2020-09-25 15:16:43 <shad0w_> ^ sorry if that sounds stupid
2020-09-25 15:16:45 <dolio> Then your result is `f (b -> c)`.
2020-09-25 15:16:51 <geekosaur> but that doesn't help because ... that
2020-09-25 15:17:14 <int-e> :t (<*>)
2020-09-25 15:17:16 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
2020-09-25 15:17:23 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2020-09-25 15:17:28 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 256 seconds)
2020-09-25 15:17:32 <geekosaur> and now you need Applicative to go any further
2020-09-25 15:17:39 <int-e> that's the type you need to continue from f (b -> c)
2020-09-25 15:17:58 × knupfer quits (~Thunderbi@87.123.206.34) (Quit: knupfer)
2020-09-25 15:18:00 knupfer1 joins (~Thunderbi@200116b82c8bb80040b575c5aa538973.dip.versatel-1u1.de)
2020-09-25 15:18:23 snakemasterflex joins (~snakemast@213.100.206.23)
2020-09-25 15:18:30 <shad0w_> so, it becomes usefull if your first argument is (a -> b -> c ) ?
2020-09-25 15:19:11 <dolio> It becomes useful if you have any number other than 1 of your `f` things that you want to do something with.
2020-09-25 15:19:15 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-09-25 15:19:37 <dolio> pure lets you build an `f` thing if you have 0.
2020-09-25 15:19:40 <shad0w_> so you could g <$> x1 <*> x2 ?
2020-09-25 15:19:54 <dolio> And (<*>) lets you combine two `f` things into one.
2020-09-25 15:20:22 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2020-09-25 15:20:24 knupfer1 is now known as knupfer
2020-09-25 15:20:33 × kenran quits (~maier@b2b-37-24-119-190.unitymedia.biz) (Ping timeout: 272 seconds)
2020-09-25 15:20:40 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-09-25 15:20:57 <shad0w_> dolio: say i want to add Just 6 and Just 7
2020-09-25 15:21:06 <shad0w_> then that's an applicative job ?
2020-09-25 15:21:51 <int-e> :t liftA2 (+)
2020-09-25 15:21:51 × gentauro quits (~gentauro@unaffiliated/gentauro) (Read error: Connection reset by peer)
2020-09-25 15:21:52 <lambdabot> (Applicative f, Num c) => f c -> f c -> f c
2020-09-25 15:22:19 <hololeap> shad0w_: that's correct
2020-09-25 15:22:32 gentauro joins (~gentauro@unaffiliated/gentauro)
2020-09-25 15:22:33 <int-e> @src liftA2
2020-09-25 15:22:33 <lambdabot> liftA2 f a b = f <$> a <*> b
2020-09-25 15:23:07 <hololeap> > (+) <$> Just 6 <*> Just 7
2020-09-25 15:23:08 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 260 seconds)
2020-09-25 15:23:10 <lambdabot> Just 13
2020-09-25 15:23:10 <kuribas> how do you experiment in ghci with new-style builds? It doesn't let me import libraries (like pretty-simple)
2020-09-25 15:23:21 <hololeap> > (+) <$> Nothing <*> Just 7
2020-09-25 15:23:24 <lambdabot> Nothing
2020-09-25 15:24:06 <kuribas> is there a way to configure an interactive test environment in the cabal file?
2020-09-25 15:24:19 <shad0w_> > (\x y z -> x + y +z) <$> Just 1 <*> Just 2 <*> Just 3
2020-09-25 15:24:21 <lambdabot> Just 6
2020-09-25 15:24:32 <shad0w_> ^Thanks bot
2020-09-25 15:24:44 <sm[m]> isn't new-style a confusing term at this point
2020-09-25 15:24:45 <shad0w_> i kindda get it now.
2020-09-25 15:24:46 × mu quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-25 15:24:55 <shad0w_> thanks guys : D
2020-09-25 15:24:56 <sm[m]> kuribas: cabal repl doesn't work ?
2020-09-25 15:25:14 <kuribas> sm[m]: it doesn't let me import packages outside of the project
2020-09-25 15:25:22 mu joins (~mu@unaffiliated/mu)
2020-09-25 15:25:25 <hololeap> shad0w_: look up and read typeclassopedia for more details
2020-09-25 15:25:38 <shad0w_> i am reading that
2020-09-25 15:25:38 <hololeap> when you're ready
2020-09-25 15:25:42 crobbins_ joins (~crobbins@2601:2c1:380:ec40:1cb9:1bb9:5a95:58fb)
2020-09-25 15:25:45 <kuribas> sm[m]: well in ghci it works...
2020-09-25 15:25:51 × mu quits (~mu@unaffiliated/mu) (Client Quit)
2020-09-25 15:25:52 <sm[m]> kuribas: ah, that's normal. Perhaps you can bring in more by using a -package option
2020-09-25 15:26:30 <kuribas> sm[m]: I just want to make a temporary test.hs file for quick testing and reloading into ghci
2020-09-25 15:26:38 <sm[m]> if cabal doesn't have that option itself, then maybe cabal repl --ghc-options='-package A -package B'
2020-09-25 15:26:59 <kuribas> sm[m]: so I don't need to retype some commands every reload
2020-09-25 15:27:15 lucid_0x80 joins (~lucid_0x8@188.253.236.126)
2020-09-25 15:27:44 <sm[m]> right, I did that the other day. I think I used stack --package A exec -- ghci test.hs or something
2020-09-25 15:27:59 × geekosaur quits (42d52102@66.213.33.2) (Ping timeout: 245 seconds)
2020-09-25 15:28:11 <sm[m]> so maybe cabal exec is the way, since test.hs isn't a component of the projec
2020-09-25 15:28:12 <sm[m]> t
2020-09-25 15:28:12 <kuribas> hmm, I'll try that
2020-09-25 15:28:58 × nerdypepper quits (nerdypeppe@152.67.160.69) (Ping timeout: 260 seconds)
2020-09-25 15:29:16 × utopic_int0x80 quits (~lucid_0x8@188.253.234.46) (Ping timeout: 265 seconds)
2020-09-25 15:29:17 × crobbins quits (~crobbins@2601:2c1:380:ec40:d443:ce25:44e4:e44d) (Ping timeout: 260 seconds)
2020-09-25 15:29:17 <kuribas> can I do :r with that?
2020-09-25 15:30:07 irc_user joins (uid423822@gateway/web/irccloud.com/x-kojvjfqrylgayrvg)
2020-09-25 15:30:27 × crobbins_ quits (~crobbins@2601:2c1:380:ec40:1cb9:1bb9:5a95:58fb) (Ping timeout: 260 seconds)
2020-09-25 15:31:13 × shad0w_ quits (~shad0w_@160.202.37.157) (Ping timeout: 246 seconds)
2020-09-25 15:32:36 mu joins (~mu@unaffiliated/mu)
2020-09-25 15:32:43 × hololeap quits (~hololeap@unaffiliated/hololeap) (Quit: KVIrc 5.0.1 Aria http://www.kvirc.net/)
2020-09-25 15:33:04 geekosaur joins (42d52102@66.213.33.2)
2020-09-25 15:33:28 <sm[m]> kuribas: how do you mean ?
2020-09-25 15:33:55 <kuribas> reload
2020-09-25 15:33:58 <kuribas> in ghci
2020-09-25 15:34:14 Papillon joins (696b16db@105.107.22.219)
2020-09-25 15:34:30 kenran joins (~maier@b2b-37-24-119-190.unitymedia.biz)
2020-09-25 15:36:50 filwisher joins (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net)
2020-09-25 15:37:47 <fendor_> kuribas, `cabal repl -b A -b B` should work.
2020-09-25 15:38:35 <kuribas> cabal new-repl -b /tmp/test.hs => couldn't parse dependency: /tmp/test.hs
2020-09-25 15:38:56 × kenran quits (~maier@b2b-37-24-119-190.unitymedia.biz) (Ping timeout: 265 seconds)
2020-09-25 15:38:59 <fendor_> kuribas, A is the dependency
2020-09-25 15:39:05 × mu quits (~mu@unaffiliated/mu) (Read error: Connection reset by peer)
2020-09-25 15:39:18 <fendor_> such as aeson or pretty-simple
2020-09-25 15:39:24 <kuribas> right...
2020-09-25 15:39:34 mu joins (~mu@unaffiliated/mu)

All times are in UTC.