Squarism 2017-02-07 14:52:16
I understand its not so pure / FP - but is there any cache with automatic eviction that someone can recommend - im not curious on learning some exotic method of caching - just something easy that just works
Welkin 2017-02-07 14:54:16
Squarism: a list
Welkin 2017-02-07 14:54:46
or a lazy map
dmwit 2017-02-07 15:06:29
Welkin: "with automatic eviction"
ClaudiusMaximus 2017-02-07 15:06:33
Squarism: perhaps https://hackage.haskell.org/package/lrucaching (not used it myself though)
Squarism 2017-02-07 15:08:43
ClaudiusMaximus, Ill check it out
halogenandtoast 2017-02-07 15:09:20
Is there any way to simplify this ` return $ (pack . replaceDictionaryLinks . unpack . toStrict . render) <$> mArticle
halogenandtoast 2017-02-07 15:09:41
I don't like that I have the pack unpack toStrict stuff in there and I'm wondering if there's a better way.
dmwit 2017-02-07 15:11:29
You would have to rewrite `replaceDictionaryLinks` to work on lazy `ByteString`s instead of `[Word8]`s, I guess.
dmwit 2017-02-07 15:11:46
Not sure what you're asking, to be honest.
halogenandtoast 2017-02-07 15:22:53
dmwit: that's fair, I just wasn't sure if there was some way to encapsulate (probably the wrong word entirely) that I wanted to both unpack and repack a Text
halogenandtoast 2017-02-07 15:23:24
something like: return $ (repack replaceDictionaryLinks . toStrict .render) <$> mArticle
halogenandtoast 2017-02-07 15:26:21
unfortunately replaceDictionaryLinks just calls out to regexReplace from Hledger.Utils.Regex so it has to operate on String
ClaudiusMaximus 2017-02-07 15:35:38
halogenandtoast: you could define your own repack f = pack . f . unpack
jchia 2017-02-07 15:42:02
jli: See what吴岳said in the wechat group at 20170123 15:55. Isn't that the code you said you need for MD login?
jchia 2017-02-07 15:42:32
sorry, wrong chat
halogenandtoast 2017-02-07 15:42:49
ClaudiusMaximus: yeah that's what I ended up doing
halogenandtoast 2017-02-07 15:43:09
allthough repack was poorly named because it confliched with ClassyPrelude
halogenandtoast 2017-02-07 15:43:39
So I ended up making `lazyTextFun f = pack . f . unpack . toStrict`
halogenandtoast 2017-02-07 15:44:21
I couldn't come up with a better name