Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-16 07:20:53 hackage hs-tags 0.1.5 - Create tag files (ctags and etags) for Haskell code. https://hackage.haskell.org/package/hs-tags-0.1.5 (AndreasAbel)
2021-03-16 07:21:41 _ht joins (~quassel@82-169-194-8.biz.kpn.net)
2021-03-16 07:22:13 <joncol> I'm trying out Cabal a bit in combination with Nix, is there an equivalent of `stack test --file-watch` that can be used with Cabal? I.e. something that watches the files for changes and automatically reruns the tests when this happens? Or should I be looking into using something like GHCID for this?
2021-03-16 07:23:44 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-03-16 07:24:13 × gaff quits (~user@49.207.217.94) (Quit: ERC (IRC client for Emacs 27.1))
2021-03-16 07:24:53 graf_blutwurst joins (~user@2001:171b:226e:adc0:7d06:8763:7b6a:1565)
2021-03-16 07:25:26 × Sgeo_ quits (~Sgeo@ool-18b98aa4.dyn.optonline.net) (Read error: Connection reset by peer)
2021-03-16 07:25:52 × waleee-cl quits (uid373333@gateway/web/irccloud.com/x-nlbmdcqymwlgkesq) (Quit: Connection closed for inactivity)
2021-03-16 07:26:34 benkolera joins (uid285671@gateway/web/irccloud.com/x-egzbqtucjdifvolv)
2021-03-16 07:26:41 zanc joins (~user@103.154.230.130)
2021-03-16 07:26:52 × zanc quits (~user@103.154.230.130) (Client Quit)
2021-03-16 07:30:20 × forgottenone quits (~forgotten@176.42.16.24) (Quit: Konversation terminated!)
2021-03-16 07:30:35 <olligobber> ok, so Cont r a is roughly equal to (a -> r) -> r
2021-03-16 07:31:25 <olligobber> that means callCC :: ((a -> Cont r b) -> Cont r a) -> Cont r a
2021-03-16 07:31:27 aforemny_ is now known as aforemny
2021-03-16 07:31:44 <charukiewicz> joncol: Yes I'd recommend using ghcid. You can use it to invoke tests in a variety of ways. I have an example in the Makefile of a library I published: https://github.com/charukiewicz/hs-isbn/blob/master/Makefile#L10-L14
2021-03-16 07:32:24 danvet joins (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa)
2021-03-16 07:32:25 <olligobber> is similar to ((a -> (b -> r) -> r) -> (a -> r) -> r) -> (a -> r) -> r
2021-03-16 07:32:36 <olligobber> wat
2021-03-16 07:32:38 <charukiewicz> joncol: If you don't want to use ghcid, you can probably also do it with the find and entr utilities, e.g. something like: find . -name *.hs | entr -s 'cabal test .....'
2021-03-16 07:32:42 <[exa]> olligobber: btw lambdabot can do something like @unmtl, you might want to play with that in the /query
2021-03-16 07:32:54 forgottenone joins (~forgotten@176.42.16.24)
2021-03-16 07:35:09 <dminuoso> olligobber: Think of callCC as `catch` or perhaps `setjmp`
2021-03-16 07:35:25 mikoto-chan joins (~anass@gateway/tor-sasl/mikoto-chan)
2021-03-16 07:35:35 <olligobber> dminuoso, `setjmp = callCC (\c -> return (fix c))'
2021-03-16 07:35:37 <olligobber> -_-
2021-03-16 07:35:48 <dminuoso> heh
2021-03-16 07:35:57 cods_ is now known as cods
2021-03-16 07:35:57 × cole-h quits (~cole-h@c-73-48-197-220.hsd1.ca.comcast.net) (Ping timeout: 264 seconds)
2021-03-16 07:36:02 × cods quits (~fred@82-65-232-44.subs.proxad.net) (Changing host)
2021-03-16 07:36:02 cods joins (~fred@unaffiliated/cods)
2021-03-16 07:36:12 <dminuoso> Ah, I see there was some conversation before
2021-03-16 07:36:32 <olligobber> yeah, then I went for a walk to figure out why Cont r is even Applicative
2021-03-16 07:36:38 × ezrakilty quits (~ezrakilty@97-113-58-224.tukw.qwest.net) (Remote host closed the connection)
2021-03-16 07:38:08 <dminuoso> Back to figuring out why aesons rejectUnknownFields refuses to work right :(
2021-03-16 07:38:41 <koz_> olligobber: Yeah, Cont's instances involve some elaborate mind twisting.
2021-03-16 07:40:14 <koz_> Even the Functor instance is somewhat involved.
2021-03-16 07:41:26 × Kaiepi quits (~Kaiepi@47.54.252.148) (Remote host closed the connection)
2021-03-16 07:41:47 bitmagie joins (~Thunderbi@200116b806998b0058b04fa04645b802.dip.versatel-1u1.de)
2021-03-16 07:41:53 <olligobber> for some reason even the definition of pure took me a bit
2021-03-16 07:43:15 <koz_> Yeah, Cont is a pretty slippery one.
2021-03-16 07:43:27 <koz_> It's super-duper general, and can be used to do... well, basically anything.
2021-03-16 07:44:02 Kmos joins (~Kmos@217.146.82.202)
2021-03-16 07:48:23 <olligobber> :t \f c -> f (\x _ -> c x) c
2021-03-16 07:48:25 <lambdabot> ((t1 -> p -> t2) -> (t1 -> t2) -> t3) -> (t1 -> t2) -> t3
2021-03-16 07:49:10 <olligobber> ok that looks like roughly the right type...
2021-03-16 07:49:38 × average quits (uid473595@gateway/web/irccloud.com/x-gpzntdlygmwptuws) (Quit: Connection closed for inactivity)
2021-03-16 07:50:25 <dminuoso> koz_: It cant do IO, though. So the people who claim Cont is the mother of all monads are wrong. :p
2021-03-16 07:50:39 <koz_> Yeah, lol.
2021-03-16 07:50:45 <olligobber> dminuoso, so ContT IO is the mother of all monads? :P
2021-03-16 07:51:01 <dminuoso> Mmm, what about STM?
2021-03-16 07:51:06 <koz_> @unmtl ContT r IO
2021-03-16 07:51:07 <lambdabot> err: `ContT r IO' is not applied to enough arguments, giving `/\A. (A -> IO r) -> IO r'
2021-03-16 07:51:10 <koz_> @unmtl ContT r IO a
2021-03-16 07:51:10 <lambdabot> (a -> IO r) -> IO r
2021-03-16 07:52:04 × Lycurgus quits (~niemand@98.4.116.165) (Quit: Exeunt)
2021-03-16 07:56:06 <olligobber> guest316, Cont is messing with my head, sorry I can't help more rn
2021-03-16 07:57:04 <koz_> Cont messes with your head, confirmed.
2021-03-16 07:57:40 <olligobber> I got as far as "callCC is similar to \f c -> f (\x _ -> c x) c"
2021-03-16 07:57:42 Geekingfrog_ is now known as Geekingfrog
2021-03-16 07:57:55 <olligobber> but the implications of that are too much
2021-03-16 07:57:58 average joins (uid473595@gateway/web/irccloud.com/x-ywsfnraofofbenfj)
2021-03-16 07:57:58 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds)
2021-03-16 07:58:14 idhugo_ joins (~idhugo@87-49-147-45-mobile.dk.customer.tdc.net)
2021-03-16 07:58:37 <dminuoso> callCC f = ContT $ \ c -> runContT (f (\ x -> ContT $ \ _ -> c x)) c
2021-03-16 07:58:56 <olligobber> yeah, I got rid of the ContT and runContT to get that
2021-03-16 07:59:15 <dminuoso> olligobber: Im not sure getting rid of them is a useful thing to do, since that hides how <*> or =<< interact with that
2021-03-16 07:59:36 <olligobber> I'm just trying to figure out how callCC works
2021-03-16 07:59:45 dbmikus joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2021-03-16 07:59:50 <dminuoso> olligobber: Do you understand how to use it?
2021-03-16 07:59:54 <olligobber> nope
2021-03-16 07:59:58 <dminuoso> Start with that, maybe.
2021-03-16 08:00:00 <olligobber> some day I will
2021-03-16 08:00:02 <olligobber> but not today
2021-03-16 08:00:07 <dminuoso> It's rather easy to use, really
2021-03-16 08:00:29 <olligobber> *grits teeth* not ... today ...
2021-03-16 08:00:34 <olligobber> :P
2021-03-16 08:00:45 <dminuoso> Im just saying: If you wnat to understand how it works, its probably easier to understand how to use it first.
2021-03-16 08:00:46 <koz_> "What do we say to ContT?"
2021-03-16 08:00:51 <koz_> "Not today."
2021-03-16 08:00:52 <dminuoso> Since that will give you an intution
2021-03-16 08:00:57 <olligobber> probably
2021-03-16 08:00:58 <olligobber> but
2021-03-16 08:01:00 <olligobber> im pooped
2021-03-16 08:01:13 DavidEichmann joins (~david@234.109.45.217.dyn.plus.net)
2021-03-16 08:01:24 <dminuoso> The probably confusing thing is, this is not just Cont, but *explicit* continuating passing style ontop too.
2021-03-16 08:01:29 <dminuoso> % :t callCC
2021-03-16 08:01:29 <yahb> dminuoso: MonadCont m => ((a -> m b) -> m a) -> m a
2021-03-16 08:03:08 <dminuoso> If you imagine how to call it, it needs one argument - a function. So you write `callCC $ \f -> ...` inside the body of that function you have your regular Cont. The callCC acts as a "catch" block, and you can call "f" at any time to "throw" to it.
2021-03-16 08:03:10 <dminuoso> Done
2021-03-16 08:03:35 <dminuoso> One could think of `catch` in IO as having the type":
2021-03-16 08:03:59 <dminuoso> catch :: ((a -> IO b) -> IO a) -> IO a
2021-03-16 08:04:09 <dminuoso> And suddenly it's the equivalent here
2021-03-16 08:04:14 <dminuoso> The type looks the same too
2021-03-16 08:04:50 <dminuoso> (this requires a bit of pretense, in reality catch cant work like that)
2021-03-16 08:05:02 × dbmikus quits (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com) (Ping timeout: 260 seconds)
2021-03-16 08:05:16 <dminuoso> or at least the type would be misleading, since if you used the provided "throw" function, there's no guarantee the `catch` will actually receive it. with callCC you have that guarantee
2021-03-16 08:07:45 Varis joins (~Tadas@unaffiliated/varis)
2021-03-16 08:08:11 <olligobber> I guess IO isn't MonadCont
2021-03-16 08:08:48 <dminuoso> Yeah.

All times are in UTC.