Logs: freenode/#haskell
| 2020-11-05 03:37:35 | <ddellaco1> | Axman6: thanks. I ended up just doing some fmap ugliness for the time being, going to revisit tomorrow |
| 2020-11-05 03:37:37 | <sshine> | justsomeguy, there is some technical trade-off, but the big trade-off, I think, is you're not really coding Haskell. :-P |
| 2020-11-05 03:38:21 | <justsomeguy> | Hmm, maybe this is something that I should be solving with an editor macro, instead. |
| 2020-11-05 03:39:06 | <justsomeguy> | (Or not solving at all, since it's not a big deal :^p) |
| 2020-11-05 03:39:11 | → | nbloomf_ joins (~nbloomf@2600:1700:ad14:3020:b093:9754:189c:f0eb) |
| 2020-11-05 03:39:18 | <Axman6> | % let a ==> b = (a,b) |
| 2020-11-05 03:39:18 | <yahb> | Axman6: |
| 2020-11-05 03:39:23 | <dolio> | It seems like OverloadedLists is completely adequate. |
| 2020-11-05 03:39:37 | <Axman6> | % [True ==> "Hello", False ==> "bye"] :: M.Map Bool String |
| 2020-11-05 03:39:38 | <yahb> | Axman6: fromList [(False,"bye"),(True,"Hello")] |
| 2020-11-05 03:40:12 | <sshine> | justsomeguy, you could do a similar reasoning with regexes. Perl has $x =~ m/(foo)*/ syntax and in Haskell the nicest alternative (I think) is regex-applicative which is more like 'many (string "foo")' -- so takes up more space, but the style is combinator composition. |
| 2020-11-05 03:40:47 | → | Stanley00 joins (~stanley00@unaffiliated/stanley00) |
| 2020-11-05 03:40:48 | × | ColdRush quits (~coldrush@4e69b241.skybroadband.com) (Ping timeout: 272 seconds) |
| 2020-11-05 03:40:50 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:10ae:4d3f:5d98:36e2) (Ping timeout: 264 seconds) |
| 2020-11-05 03:41:07 | <sshine> | justsomeguy, wrt. Maps and syntax support, if you already accept the syntactic weight of composing combinators, is just 'fromList' and the many parentheses around tuples. |
| 2020-11-05 03:42:16 | <justsomeguy> | Right, it's not bad at all. |
| 2020-11-05 03:42:37 | <sshine> | justsomeguy, and if you think 'fromList' is too heavy, OverloadedLists can remove it. but you'd still want a syntactically consistent way to address the remaining values in a way that is similar to how you adress other things. |
| 2020-11-05 03:42:46 | <sshine> | justsomeguy, it depends on the perspective. |
| 2020-11-05 03:43:16 | <sshine> | justsomeguy, combinators aren't always the shortest. but the benefit of being able to compose things is so high. |
| 2020-11-05 03:43:56 | × | theDon quits (~td@muedsl-82-207-239-021.citykom.de) (Ping timeout: 258 seconds) |
| 2020-11-05 03:44:37 | → | Tario joins (~Tario@201.192.165.173) |
| 2020-11-05 03:45:13 | × | st8less quits (~st8less@2603:a060:11fd:0:acb3:c1f9:8208:550f) (Quit: WeeChat 2.7.1) |
| 2020-11-05 03:45:49 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-11-05 03:46:08 | <texasmynsted> | I am not really sure how to search for or even describe what I am looking for... Is there something I can use to "grep" a bunch of files for a token using a parser like megaparsec or something rather than regexp? |
| 2020-11-05 03:46:14 | <sshine> | justsomeguy, e.g. in Perl if you want to combine two regexes, you need to be aware of not accidentally embedding user-input strings into your regex, since Perl regexes are a bit too powerful (e.g. allow general recursion and exponential compute holes, since they're not regular).. so m/$regex1$regex2/ is fine as long as $regex1 and $regex2 weren't dirty. if anything is dirty you want \Q$dirtybit\E. with |
| 2020-11-05 03:46:20 | <sshine> | regex-applicative I'm not familiar with a way to make those accidents. |
| 2020-11-05 03:46:44 | <Axman6> | texasmynsted: well, there is https://hackage.haskell.org/package/lens-regex-0.1.1/docs/Text-Regex-Lens.html... |
| 2020-11-05 03:46:57 | → | GUEST48003 joins (~GUEST4800@124.123.104.52) |
| 2020-11-05 03:47:07 | <texasmynsted> | that sounds like it uses regexps |
| 2020-11-05 03:47:12 | <Axman6> | it does |
| 2020-11-05 03:47:39 | × | jud quits (~jud@unaffiliated/jud) (Read error: Connection reset by peer) |
| 2020-11-05 03:47:39 | <Axman6> | I'm sure I've seen something which does a similar things |
| 2020-11-05 03:47:49 | <texasmynsted> | I was looking for an alternative to regexps. (I do not think regexps are easy to read, maintain, or debug.) |
| 2020-11-05 03:48:05 | <sshine> | texasmynsted, regex-applicative / Megaparsec? :) |
| 2020-11-05 03:48:09 | <Axman6> | https://hackage.haskell.org/package/replace-attoparsec? |
| 2020-11-05 03:48:18 | → | jud joins (~jud@unaffiliated/jud) |
| 2020-11-05 03:48:23 | <texasmynsted> | I am looking for a token in the YAML header of markdown files. |
| 2020-11-05 03:48:24 | <sshine> | Axman6, neat. |
| 2020-11-05 03:48:27 | → | chise joins (3b29a236@59.41.162.54) |
| 2020-11-05 03:48:55 | <texasmynsted> | oh intersting. |
| 2020-11-05 03:48:56 | <sshine> | texasmynsted, like a tag or something? |
| 2020-11-05 03:49:12 | <texasmynsted> | yes. like "isUnpublished=true" |
| 2020-11-05 03:49:43 | × | jud quits (~jud@unaffiliated/jud) (Max SendQ exceeded) |
| 2020-11-05 03:49:55 | <texasmynsted> | like I have a bunch of markdown files. Some I do not want published so I want them added to an exclude list for rsync |
| 2020-11-05 03:50:01 | <Axman6> | Can't decide is this is cool or gross: streamEditT (char '{' *> manyTill anyChar (char '}')) (fmap T.pack . getEnv) "- {HOME} -" |
| 2020-11-05 03:50:11 | × | justanotheruser quits (~justanoth@unaffiliated/justanotheruser) (Ping timeout: 272 seconds) |
| 2020-11-05 03:50:17 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds) |
| 2020-11-05 03:51:08 | → | jud joins (~jud@unaffiliated/jud) |
| 2020-11-05 03:51:24 | → | justanotheruser joins (~justanoth@unaffiliated/justanotheruser) |
| 2020-11-05 03:51:40 | <sshine> | > "isUnpublished=true" `isInfixOf` "I'm not sure what a token in the YAML header of a Markdown file looks like, but if it contains isUnpublished=true, maybe this qualifies?" |
| 2020-11-05 03:51:42 | <lambdabot> | True |
| 2020-11-05 03:52:41 | → | Guest74313 joins (~benj@195.206.169.184) |
| 2020-11-05 03:52:42 | <texasmynsted> | YAML header starts with --- and ends with --- |
| 2020-11-05 03:52:47 | <texasmynsted> | At the top of the file |
| 2020-11-05 03:53:03 | <Axman6> | this sounds like you could just use pandoc |
| 2020-11-05 03:53:12 | <Axman6> | "just" |
| 2020-11-05 03:53:22 | <texasmynsted> | maybe but I am trying to get a list of files. |
| 2020-11-05 03:53:22 | <sshine> | "one does not just..." |
| 2020-11-05 03:53:26 | <Axman6> | I mean you're describing a format pandoc knows about |
| 2020-11-05 03:53:41 | × | Sheilong quits (uid293653@gateway/web/irccloud.com/x-hgnmrpxqnetkvsrt) () |
| 2020-11-05 03:54:21 | <texasmynsted> | Pandoc seems well suited to filtering/altering/rendering markdown files, but I am not sure how to get it to just search for tokens and add or not a file name to a list |
| 2020-11-05 03:54:50 | <texasmynsted> | I could convert each file to the AST then search the AST, then ? |
| 2020-11-05 03:55:03 | texasmynsted | hoogles `isInfixOf` |
| 2020-11-05 03:56:21 | <texasmynsted> | oh. isInfixOf is usef. |
| 2020-11-05 03:56:27 | <texasmynsted> | I mean useful |
| 2020-11-05 03:57:12 | <sshine> | if you want to build a mostly sufficient Markdown header parser, but not pull out a big gun, ask yourself how little you can get away with. isInfixOf won't let you blog about what you're doing right now. :-P |
| 2020-11-05 04:01:32 | × | GUEST48003 quits (~GUEST4800@124.123.104.52) (Remote host closed the connection) |
| 2020-11-05 04:01:51 | → | GUEST48896 joins (~GUEST4889@124.123.104.52) |
| 2020-11-05 04:04:05 | × | olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Ping timeout: 240 seconds) |
| 2020-11-05 04:04:56 | → | shatriff_ joins (~vitaliish@176.52.219.10) |
| 2020-11-05 04:07:41 | × | shatriff quits (~vitaliish@176.52.219.10) (Ping timeout: 256 seconds) |
| 2020-11-05 04:09:24 | → | o1lo01ol1o joins (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) |
| 2020-11-05 04:09:35 | <texasmynsted> | I think that finding the token is less the issue. More of the issue is searching all the files. |
| 2020-11-05 04:10:30 | <Axman6> | if you can search one file, and you can get all the file names, then you just traverse |
| 2020-11-05 04:11:41 | → | thir joins (~thir@p200300f27f0b7e00f4e9381c2bf90854.dip0.t-ipconnect.de) |
| 2020-11-05 04:11:45 | × | ransom quits (~c4264035@c-73-243-2-10.hsd1.co.comcast.net) (Ping timeout: 240 seconds) |
| 2020-11-05 04:12:13 | × | vicfred quits (~vicfred@unaffiliated/vicfred) (Quit: Leaving) |
| 2020-11-05 04:12:25 | → | k199 joins (3e8b7dcd@62.139.125.205) |
| 2020-11-05 04:13:28 | × | drbean quits (~drbean@TC210-63-209-23.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin1 - https://znc.in) |
| 2020-11-05 04:13:42 | × | o1lo01ol1o quits (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) (Ping timeout: 256 seconds) |
| 2020-11-05 04:14:05 | × | ddellaco1 quits (~dd@86.106.121.168) (Ping timeout: 240 seconds) |
| 2020-11-05 04:15:41 | × | thir quits (~thir@p200300f27f0b7e00f4e9381c2bf90854.dip0.t-ipconnect.de) (Ping timeout: 244 seconds) |
| 2020-11-05 04:16:09 | <sshine> | texasmynsted, https://gist.github.com/sshine/4e8673ad48b3f6098e4dbe097a9dfe5f |
| 2020-11-05 04:16:45 | × | mi23523523 quits (~Mi1029384@82.131.36.5.cable.starman.ee) (Quit: Leaving) |
| 2020-11-05 04:16:53 | <texasmynsted> | WOW! Thank you! |
| 2020-11-05 04:17:08 | <texasmynsted> | Now I understand. :-) |
| 2020-11-05 04:17:17 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 258 seconds) |
| 2020-11-05 04:17:22 | <justsomeguy> | That is very nice and easy to read, even for a noob like me. |
| 2020-11-05 04:17:52 | <sshine> | it started as a one-liner so I could paste it on IRC. |
| 2020-11-05 04:18:10 | <Axman6> | yuno bytestring |
| 2020-11-05 04:18:24 | → | star_watt joins (7c7b6834@124.123.104.52) |
| 2020-11-05 04:18:44 | <sshine> | Axman6, good point, thanks. |
| 2020-11-05 04:19:20 | → | olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber) |
| 2020-11-05 04:19:28 | <pjb> | perhaps I would use isPublished instead, to avoid double-negatives… |
| 2020-11-05 04:19:34 | → | coot joins (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) |
| 2020-11-05 04:20:01 | × | k199 quits (3e8b7dcd@62.139.125.205) (Remote host closed the connection) |
| 2020-11-05 04:20:21 | <Axman6> | texasmynsted: just becareful that you don't write a blog post about this and forget to publish the file because you have the string "isUnpublished=true" in it :P |
| 2020-11-05 04:20:37 | <texasmynsted> | LOL |
| 2020-11-05 04:20:45 | <koz_> | isUnpublished=false is _definitely_ likely to lead to confusion. |
| 2020-11-05 04:21:18 | <texasmynsted> | preventPublish: true |
All times are in UTC.