Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-25 01:30:26 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-11-25 01:30:27 monochrom plans to talk about using emacs for email and usenet news.
2020-11-25 01:30:38 <ezzieyguywuf> koz_: what's another way to do it?
2020-11-25 01:30:38 <Digit> int-e: n_n this is much more peaceful and ammicable an editor/ide discussion than the wars of old. n_n
2020-11-25 01:30:52 <int-e> monochrom: or browsers... lynx, links, elinks, or w3m :P
2020-11-25 01:31:06 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2020-11-25 01:31:10 <koz_> ezzieyguywuf: What do your 50 flags mean? Can they co-occur? What do they describe? How do you represent this data? Etc etc
2020-11-25 01:31:13 <monochrom> I almost used emacs for web browser too.
2020-11-25 01:31:16 <Digit> is there a web browser written in haskell? that'd be cool. :)
2020-11-25 01:31:18 <koz_> There is no One True Answer to these questions.
2020-11-25 01:31:32 <MarcelineVQ> Sure there is, it's the one I say
2020-11-25 01:31:32 conal joins (~conal@64.71.133.70)
2020-11-25 01:31:32 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-11-25 01:31:36 <int-e> Digit: It is. But it's still not going anywhere :P
2020-11-25 01:31:58 conal joins (~conal@64.71.133.70)
2020-11-25 01:32:17 <monochrom> What saved me from this depravity 20 years ago was that emacs did not have real concurrency.
2020-11-25 01:32:20 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-11-25 01:32:41 <ezzieyguywuf> koz_: I was using 50 as an example. I currently only have 1 flag, for a filename. I guess my main question is - is the `data MyOpts = FileName String` approach the only way to use an optparse-applicative parser to parse the arguments
2020-11-25 01:33:08 <koz_> ezzieyguywuf: No, in the same way as the 'data MyOpts = FileName String' approach would not be the only way to use a megaparsec parser.
2020-11-25 01:33:10 conal joins (~conal@64.71.133.70)
2020-11-25 01:33:23 <monochrom> Whenever its web browser was waiting for responses, the editor window become unresponsive. That disillusioned me to realize that emacs was not an OS afterall.
2020-11-25 01:33:31 <koz_> Like... it's _your_ data, structure it however you want. Your internal representation doesn't have to precisely match the data you get fed.
2020-11-25 01:33:46 sand_dull joins (~theuser@c-73-149-95-105.hsd1.ct.comcast.net)
2020-11-25 01:34:44 × caecilius quits (~caecilius@pool-108-46-151-95.nycmny.fios.verizon.net) (Ping timeout: 256 seconds)
2020-11-25 01:35:21 <ezzieyguywuf> ok let me ask the question differently. Let's say I wanted to add my own "--help" option (just for the sake of argument, I know optparse-applicative has this built-in sorta). I don't really need `data MyData = FileName String | Help`, because if someone passes "--help" I want to display the help info then immediately exit, i.e. do nothing else
2020-11-25 01:35:29 × mpereira quits (~mpereira@2a02:810d:f40:d96:f587:a442:5e3:1e55) (Ping timeout: 272 seconds)
2020-11-25 01:35:39 <ezzieyguywuf> so how would I accomlish that using optparse-applicative?
2020-11-25 01:35:56 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2020-11-25 01:36:14 <sm[m]> ezzieyguywuf: do the docs not cover it ?
2020-11-25 01:36:47 <sm[m]> I'm not being snarky, I want to know if o-a's docs are good enough yet
2020-11-25 01:37:04 × sqrt2 quits (~ben@unaffiliated/sqrt2) (Read error: Connection reset by peer)
2020-11-25 01:37:07 sqrt2_ joins (~ben@unaffiliated/sqrt2)
2020-11-25 01:37:08 Lord_of_Life_ joins (~Lord@46.217.220.129)
2020-11-25 01:37:27 <ezzieyguywuf> sm[m]: the docs are really good, but from what I can tell they don't cover this.
2020-11-25 01:37:38 × Lord_of_Life quits (~Lord@unaffiliated/lord-of-life/x-0885362) (Ping timeout: 256 seconds)
2020-11-25 01:37:42 <sm[m]> I found it hard to use but haven't given it a serious try recently
2020-11-25 01:37:51 <ezzieyguywuf> sm[m]: or else, it's just not the intended use-case. or else (and this can definetely be the case) I just don't understand the docs enough to see how to do it.
2020-11-25 01:38:03 <sm[m]> hard to learn, I meant to say
2020-11-25 01:38:18 <koz_> ezzieyguywuf: Write a parser which only parses '--help'. Exec that. If it succeeds, great; if not, try a different one which gets your filename?
2020-11-25 01:38:27 <ezzieyguywuf> koz_: ah hah.
2020-11-25 01:38:32 <ezzieyguywuf> simple. elegant.
2020-11-25 01:38:39 Fractalis joins (~Fractalis@2601:987:280:8d40:eda9:f9e1:2072:cea7)
2020-11-25 01:38:59 <koz_> This may be of use: http://hackage.haskell.org/package/optparse-applicative-0.16.1.0/docs/Options-Applicative.html#v:execParserPure
2020-11-25 01:39:17 <ezzieyguywuf> hrm...or maybe using a <|> somewhere, I remember the documentation talking about that.
2020-11-25 01:39:21 <koz_> (and some of the functions underneath that)
2020-11-25 01:39:27 <ezzieyguywuf> koz_: I was just perusing that!
2020-11-25 01:39:28 <ezzieyguywuf> lol
2020-11-25 01:39:29 <sm[m]> I will say that you can always do your own preprocessing of args, I do it for exactly that case (short circuit to usage message with --help)
2020-11-25 01:39:29 <koz_> You could use <|> I guess.
2020-11-25 01:40:05 <koz_> Basically, a good habit to get into is 'break your problem into the smallest possible pieces, and only glue them together if you have to'.
2020-11-25 01:40:14 <ezzieyguywuf> I think that (a) optparse-applicative is likely powerful enough to do whatever I want, and (b) I should just start with my one dinky flag and try more as the need arises
2020-11-25 01:40:23 <koz_> A lot of the time I find folks instead think 'I need to build an all-singing, all-dancing monolith' and then find it very hard.
2020-11-25 01:40:27 <koz_> (myself included)
2020-11-25 01:40:28 <ezzieyguywuf> koz_: I think that's a good idea.
2020-11-25 01:41:42 <koz_> And yes, start with one flag and work upwards.
2020-11-25 01:41:50 <koz_> At least with one flag, you've got the functionality you need right now.
2020-11-25 01:42:47 <ezzieyguywuf> precisely
2020-11-25 01:43:05 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-11-25 01:46:50 <koz_> How exactly does the Alternative instances of the optparse-applicative Parser work? Is it backtracking?
2020-11-25 01:47:09 <ezzieyguywuf> hope you're not asking me, lol
2020-11-25 01:47:38 <koz_> ezzieyguywuf: Nope - this is a general question to Knowledgeable Folks.
2020-11-25 01:48:20 <ezzieyguywuf> nice.
2020-11-25 01:48:59 <int-e> . o O ( https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it )
2020-11-25 01:49:33 <koz_> int-e: You never know when you need Alternative! :P
2020-11-25 01:50:16 <int-e> koz_: refactoring is easy(-ish) with strong types
2020-11-25 01:50:32 <koz_> Yup!
2020-11-25 01:50:41 <int-e> anyway, it's a good principle, but hard to follow :)
2020-11-25 01:50:52 <MarcelineVQ> *impossible
2020-11-25 01:51:07 <koz_> sm[m]: You said earlier you wanted feedback on the way optparse-applicative is docced: it'd be nice if the Alternative behaviour for Parser was explained somewhere, because I can't seem to find it.
2020-11-25 01:51:08 <int-e> (and hard to apply when you write code for others rather than yourself)
2020-11-25 01:51:54 <sm[m]> thx, noted
2020-11-25 01:52:04 <koz_> sm[m]: Would you be able to tell me?
2020-11-25 01:52:12 royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9)
2020-11-25 01:52:15 <koz_> I'm genuinely curious but the digging through implementation would take too long.
2020-11-25 01:52:22 <sm[m]> sorry, I don't know either
2020-11-25 01:55:53 vicfred joins (~vicfred@unaffiliated/vicfred)
2020-11-25 01:56:58 × vicfred quits (~vicfred@unaffiliated/vicfred) (Max SendQ exceeded)
2020-11-25 01:56:59 conal joins (~conal@64.71.133.70)
2020-11-25 01:57:01 <ezzieyguywuf> hrm, this section has me a bit confused: https://github.com/pcapriotti/optparse-applicative#running-parsers
2020-11-25 01:57:28 vicfred joins (~vicfred@unaffiliated/vicfred)
2020-11-25 01:57:43 × conal quits (~conal@64.71.133.70) (Client Quit)
2020-11-25 01:57:59 <ezzieyguywuf> if `opts :: ParserInfo Sample`, and `info :: Parser a -> InfoMod a -> ParserInfo a`, then how does the code snippet type-check?
2020-11-25 01:58:27 × vicfred quits (~vicfred@unaffiliated/vicfred) (Max SendQ exceeded)
2020-11-25 01:58:42 <ezzieyguywuf> it seems to me that `fullDesc <> progDesc "Print a greeting for TARGET"` would be `InfoMod String`
2020-11-25 01:58:55 vicfred joins (~vicfred@unaffiliated/vicfred)
2020-11-25 01:59:13 <koz_> ezzieyguywuf: The whole thing in brackets is one argument.
2020-11-25 01:59:22 <koz_> That whole thing is an InfoMod.
2020-11-25 02:00:41 <ezzieyguywuf> koz_: but it seems to me that the typo of the whole bracketed area is "InfoMod String"
2020-11-25 02:00:53 <ezzieyguywuf> ahh wait nvm
2020-11-25 02:00:54 <koz_> Why would it be?
2020-11-25 02:00:56 <ezzieyguywuf> I was being dumb
2020-11-25 02:00:59 <koz_> What component of that suggests this?
2020-11-25 02:01:06 <koz_> I'm pretty sure the 'a' type param is phantom there.
2020-11-25 02:02:37 × forell quits (~forell@unaffiliated/forell) (Ping timeout: 260 seconds)
2020-11-25 02:02:42 <ezzieyguywuf> I missed that `progDesc` takes a String as an argument
2020-11-25 02:03:11 guest1125 joins (~user@49.5.6.87)
2020-11-25 02:04:03 × hexfive quits (~hexfive@50-47-142-195.evrt.wa.frontiernet.net) (Quit: i must go. my people need me.)
2020-11-25 02:04:27 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-25 02:04:47 MindlessDrone joins (~MindlessD@unaffiliated/mindlessdrone)
2020-11-25 02:05:44 <ezzieyguywuf> lol, the movie I'm watching has a character named Haskell

All times are in UTC.