Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-17 16:27:38 <cheater> or even an applicative maybe
2021-03-17 16:27:43 <Jordandave23> yeah mapping is up there
2021-03-17 16:27:50 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-17 16:27:55 <shapr> jumper149: does blucontrol support for changing the amount of blue light based on time of day? I don't immediately see that.
2021-03-17 16:28:09 <shapr> oh wait, is that the rgbMap ?
2021-03-17 16:28:24 <shapr> oh, I bet it is
2021-03-17 16:28:32 <shapr> ah, neat https://github.com/jumper149/blucontrol/blob/master/Main.hs#L16
2021-03-17 16:28:32 <jumper149> shapr: Yeah, what you have to understand is the splitting into three parts
2021-03-17 16:28:38 × Sathiana quits (~kath@185-113-98-38.cust.bredband2.com) (Client Quit)
2021-03-17 16:28:42 <shapr> jumper149: what does that do?
2021-03-17 16:28:56 <shapr> I see it's a non-empty list
2021-03-17 16:29:03 <jumper149> MonadGamma calculates Gamma
2021-03-17 16:29:16 <jumper149> MonadRecolor applies to the X server
2021-03-17 16:29:34 × jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection)
2021-03-17 16:29:39 <cheater> what you really want is for your monitor to strobe black and white in the morning. wakes you right up
2021-03-17 16:29:45 <jumper149> MonadControl can handle errors and also does stuff like setting the interval
2021-03-17 16:29:54 <jumper149> What you probably want to set up is Monad Gamma
2021-03-17 16:30:11 <jumper149> And if you want time-dependent config you need to configure GammaLinearT
2021-03-17 16:31:09 × notzmv quits (~zmv@unaffiliated/zmv) (Ping timeout: 264 seconds)
2021-03-17 16:31:12 <jumper149> shapr: As you can see that rgbMap is the argument to runGammaLinearT
2021-03-17 16:31:24 <shapr> Does GammaLinearT do slow changes or is it an instant change at that time?
2021-03-17 16:31:42 shapr clones, starts the build, experiments
2021-03-17 16:31:53 <jumper149> It does a linear interpolation on the times, hence the name
2021-03-17 16:32:12 <shapr> ah, nice!
2021-03-17 16:32:15 × cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 3.0.1)
2021-03-17 16:32:37 <shapr> I've been looking for exactly this kind of thing, thanks!
2021-03-17 16:32:45 <jumper149> The smoothness depends on how you set up ControlWaitT
2021-03-17 16:33:07 <jumper149> shapr: I'm happy that someone else finds it useful :)
2021-03-17 16:33:17 shapr looks at ControlWaitT
2021-03-17 16:33:31 <jumper149> I wrote this before: https://github.com/jumper149/blugon
2021-03-17 16:33:39 dhruvasagar joins (~dhruvasag@49.207.63.69)
2021-03-17 16:33:45 <jumper149> But wasn't satisfied with the configurability of a standard config file
2021-03-17 16:33:52 <jumper149> So I went the xmonad approach
2021-03-17 16:33:56 wlritchi_ is now known as wlritchi
2021-03-17 16:34:01 <dhruvasagar> Hi guys, I need a little help, i've been in the hole for a while
2021-03-17 16:34:45 <dhruvasagar> Are you guys familiar with https://github.com/tsoding/haskell-json/blob/master/Main.hs ?
2021-03-17 16:34:52 <jumper149> I never posted it anywhere, because documentation is not that thorough. You kinda have to read the source to understand what's going on.
2021-03-17 16:35:06 <koz_> dhruvasagar: We can be if needs be. What's your question?
2021-03-17 16:35:08 <shapr> jumper149: if I ask enough questions, I can contribute some docs :-)
2021-03-17 16:35:32 jakalx joins (~jakalx@base.jakalx.net)
2021-03-17 16:35:59 <dhruvasagar> I am trying to implement something simple but I am not able to wrap my head around it. I want to apply the `ws` parser and extract in essense the indentation of a string, and combine that with `stringP` to create a parser for exact matching that indentation
2021-03-17 16:36:03 <jumper149> I'll be happy to review some PRs :)
2021-03-17 16:36:24 <dhruvasagar> koz_: I don't know if that description was helpful enough, but I would appreciate help
2021-03-17 16:36:34 <dhruvasagar> s/helpful/clear/
2021-03-17 16:36:38 bobweb joins (ac3a1784@172.58.23.132)
2021-03-17 16:37:09 <koz_> dhruvasagar: ws doesn't tell you how much whitespace got parsed.
2021-03-17 16:37:25 <dhruvasagar> koz_: I am aware, but it is in the result of applicataion of the parser
2021-03-17 16:38:20 <koz_> So you need to write a 'countingWS :: Parser (Int, String)' which counts its 'width' after parsing by checking the difference between the loc of the input Input and the loc of the result Input.
2021-03-17 16:38:55 <koz_> Since a Parser is just Input -> (a, Input).
2021-03-17 16:39:32 <koz_> (or rather, Input -> Either ParseError (Input, a), but that's still possible there)
2021-03-17 16:39:44 <dhruvasagar> koz_: I don't necessarily care about the count / length of the indentation
2021-03-17 16:40:00 <koz_> I'm saying you need this as a component for what you _do_ care about.
2021-03-17 16:40:23 <dhruvasagar> koz_: eg.) `runParser ws " asd"` tells me the indentation is " ", then my indentation parser would be `stringP " "`
2021-03-17 16:40:30 × joncol quits (~jco@c188-150-101-195.bredband.comhem.se) (Quit: leaving)
2021-03-17 16:40:49 <koz_> Ah, in that case, the whitespace is the result of the ws parser.
2021-03-17 16:40:59 <dhruvasagar> koz_: yes indeed
2021-03-17 16:41:01 <koz_> Since it's Parser String, which means the String it parses is the whitespace.
2021-03-17 16:41:04 shad0w_ joins (a0ca2598@160.202.37.152)
2021-03-17 16:41:05 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-17 16:41:06 idhugo_ joins (~idhugo@87-49-147-45-mobile.dk.customer.tdc.net)
2021-03-17 16:41:25 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-17 16:42:21 <koz_> So just capture that and now you can use it with stringP just like above.
2021-03-17 16:42:47 conal joins (~conal@64.71.133.70)
2021-03-17 16:42:58 DataComputist joins (~lumeng@50.43.26.251)
2021-03-17 16:43:30 <dhruvasagar> koz_: that's what i've been trying, but I am not able to do the extraction from the either and combining with stringP cleanly
2021-03-17 16:43:42 <koz_> ws >>= stringP
2021-03-17 16:43:46 <dhruvasagar> koz_: it sounds simple on paper, but I am not that great with haskell yet
2021-03-17 16:43:49 <dhruvasagar> oO
2021-03-17 16:43:54 <dhruvasagar> let me look at the type
2021-03-17 16:44:05 <koz_> That's assuming that you don't need to capture the result of the ws and use it multiple times.
2021-03-17 16:44:06 × FortuneZero quits (3223b878@50.35.184.120) (Quit: Connection closed)
2021-03-17 16:44:07 <koz_> Is that your goal?
2021-03-17 16:44:37 <bobweb> koz_: Hi, again! Do you ever sleep? I now have this problem: https://paste.tomsmeding.com/pjyfMlOA Thank you.
2021-03-17 16:44:47 <koz_> bobweb: I assure you that I do.
2021-03-17 16:45:06 <bobweb> koz_: LOL
2021-03-17 16:45:31 dbmikus joins (~dbmikus@cpe-76-167-86-219.natsow.res.rr.com)
2021-03-17 16:45:35 <koz_> bobweb: If I had to guess, the literals 1 and 2 have type (Num a) => a. Similar to the previous issue you asked about. However, there's so much missing context I dunno.
2021-03-17 16:45:35 <dhruvasagar> koz_: I will need to use it multiple times, but as long as I have a parser I was going to just combine it with `many` to do that
2021-03-17 16:45:58 <dhruvasagar> koz_: basically I am creating an indent aware parser similar to the one he created, for yaml
2021-03-17 16:46:01 <koz_> Then you wanna do something like this.
2021-03-17 16:46:39 <geekosaur> ExtendedDefaultRules?
2021-03-17 16:47:05 <koz_> dhruvasagar: https://paste.tomsmeding.com/fqjnhk7w
2021-03-17 16:47:11 <geekosaur> unless tis iss inside ghci in which case a bigger hammer is needed
2021-03-17 16:48:20 <dhruvasagar> koz_: I did try something like that but maybe I was too held up in trying to create a parser, let me rethink a little
2021-03-17 16:51:27 tsaka__ joins (~torstein@2a02:587:1b1a:7800:792e:732d:be64:a99d)
2021-03-17 16:51:31 × todda7 quits (~torstein@2a02:587:1b10:ea00:db5:2d40:d00d:cce4) (Ping timeout: 272 seconds)
2021-03-17 16:53:35 Sornaensis joins (~Sornaensi@077213203030.dynamic.telenor.dk)
2021-03-17 16:53:47 <dhruvasagar> koz_: I was trying something like this earlier - https://gist.github.com/f86ca2afe00419f073eb62666d38a309
2021-03-17 16:54:36 Sorna joins (~Sornaensi@154.6.18.32)
2021-03-17 16:54:41 <koz_> dhruvasagar: I'm not even clear on what that's doing to be honest.
2021-03-17 16:54:41 × emmanuel_erc quits (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com) (Read error: Connection reset by peer)
2021-03-17 16:54:47 <koz_> You need to _first_ mark out your indent.
2021-03-17 16:54:48 <dhruvasagar> koz_: but this is obviously wrong because it's not fixed indent string parser that I am creating, it ends up working just like `ws`
2021-03-17 16:55:00 emmanuel_erc joins (~user@2603-7000-9600-01c9-0000-0000-0000-0874.res6.spectrum.com)
2021-03-17 16:55:01 × Jordandave23 quits (~lmn2@120.154.155.173) (Remote host closed the connection)
2021-03-17 16:55:04 <koz_> Like, you gotta determine what that is before you start many-ing it or whatever.
2021-03-17 16:56:06 <dhruvasagar> koz_: right I felt I got that with `indentP`
2021-03-17 16:56:48 <dhruvasagar> koz_: but let me try the do block approach again
2021-03-17 16:56:54 <koz_> I would suggest this.
2021-03-17 16:56:57 × shad0w_ quits (a0ca2598@160.202.37.152) (Quit: Connection closed)

All times are in UTC.