Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-05 14:24:34 timCF joins (511495c6@198-149-20-81.sta.estpak.ee)
2020-11-05 14:24:49 <PacoV> I've written a static site generator with Hakyll that handles translations in templates thanks to a functionField.
2020-11-05 14:25:19 <PacoV> The logic is simple : it takes two strings (language and the string to translate).
2020-11-05 14:25:33 <PacoV> If a translation for the given language exists, it's returned.
2020-11-05 14:25:41 <PacoV> Else, it keepd the original string.
2020-11-05 14:26:10 <PacoV> My translations are in a map of maps (Map String (Map String Strin)).
2020-11-05 14:26:42 <PacoV> I now want to store my translations in a yaml file, not hardcoded in the haskell code.
2020-11-05 14:27:05 <PacoV> So, I'm looking for a way to parse that (Map String (Map String Strin)) from a yaml file.
2020-11-05 14:27:28 <timCF> Hello! Are there any good libraries for multithreading communication? I'm trying to use STM/MVar but really struggle with `BlockedIndefinitelyOnMVar` and `BlockedIndefinitelyOnSTM` handling. It results from how Haskell runtime is counting references. The biggest issue here is that runtime kills both child and parent threads with async exceptions
2020-11-05 14:27:28 <timCF> which are very annoying to handle
2020-11-05 14:27:51 <merijn> timCF: The RTS doesn't use reference counting
2020-11-05 14:28:02 <PacoV> I'm still a Haskell beginner and can't figure how to extract the content of the yaml file even using the yaml package.
2020-11-05 14:28:21 <merijn> timCF: If you get those exceptions then the only thread that can access the MVar is blocking on the MVar (and thus can't ever wake up)
2020-11-05 14:28:39 <merijn> timCF: So you have messed up your logic somewhere
2020-11-05 14:29:23 <PacoV> Maybe the simple form of my question could be : do you have any working example of reading a (Map )
2020-11-05 14:29:27 <merijn> timCF: The runtime doesn't kill "both child and parent", because Haskell threads don't have such a thing as parent threads
2020-11-05 14:29:36 <PacoV> Maybe the simple form of my question could be : do you have any working example of reading a (Map String String) from a Yaml file please?
2020-11-05 14:29:58 <merijn> timCF: However, if the main thread exits the program stops, even if there are other threads still running
2020-11-05 14:30:56 <merijn> timCF: You should probably tell us what you're doing and what you actually want, else we can only guess
2020-11-05 14:31:03 <timCF> merijn it's valid situation in some cases. For example some sort of API socket subscriptions which is running in separate thread and is supposed to put value into TChan, but got disconnected, subscription process terminating, parent process considers deadlocked
2020-11-05 14:31:08 Cotillion joins (~Cotillion@217.146.82.202)
2020-11-05 14:31:24 <merijn> Well, yes
2020-11-05 14:31:31 <merijn> That's because it is deadlocked
2020-11-05 14:31:46 <merijn> Unless other threads also use the same TChan
2020-11-05 14:33:16 <timCF> merijn I'm using `link` function from `Async` everywhere, to link parent and child processes, so I kinda have this category
2020-11-05 14:33:34 <merijn> Well, if you don't want you parent to get killed...don't use link?
2020-11-05 14:33:45 <merijn> Like...that's what link is for...
2020-11-05 14:33:45 × timCF quits (511495c6@198-149-20-81.sta.estpak.ee) (Remote host closed the connection)
2020-11-05 14:34:00 hackage goldplate 0.1.2 - A lightweight golden test runner https://hackage.haskell.org/package/goldplate-0.1.2 (JasperVanDerJeugt)
2020-11-05 14:38:17 timCF joins (511495c6@198-149-20-81.sta.estpak.ee)
2020-11-05 14:39:27 ystael joins (~ystael@209.6.50.55)
2020-11-05 14:40:52 <PacoV> Basically need to parse something like http://ix.io/2D7k as a (Map String (Map String String)).
2020-11-05 14:41:08 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-05 14:41:25 × geekosaur quits (82659a09@host154-009.vpn.uakron.edu) (Remote host closed the connection)
2020-11-05 14:42:36 Ariakenom joins (~Ariakenom@h-82-196-111-76.NA.cust.bahnhof.se)
2020-11-05 14:47:00 mdunnio joins (~mdunnio@208.59.170.5)
2020-11-05 14:47:24 jollygood2 joins (~bc8165ab@217.29.117.252)
2020-11-05 14:47:31 <jollygood2> > splitOn [5] [1..10]
2020-11-05 14:47:33 <lambdabot> [[1,2,3,4],[6,7,8,9,10]]
2020-11-05 14:47:45 <jollygood2> is there something like this that will include separator in either list?
2020-11-05 14:49:02 <ski> separator ?
2020-11-05 14:49:16 <ski> hm
2020-11-05 14:49:18 <jollygood2> 5 in the example above
2020-11-05 14:50:04 <int-e> https://hackage.haskell.org/package/split-0.2.3.4/docs/Data-List-Split.html#v:onSublist
2020-11-05 14:50:54 <jollygood2> close but not quite what I had in mind. f 5 [1..10] should give me [1,2,3,4,5] [6,7,8,9,10]
2020-11-05 14:51:30 × timCF quits (511495c6@198-149-20-81.sta.estpak.ee) (Remote host closed the connection)
2020-11-05 14:51:47 <jollygood2> and f 3 [1,3,4,3,5] => [[1,3],[4,3],[5]]
2020-11-05 14:52:49 coot_ joins (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl)
2020-11-05 14:53:39 <ski> > unfoldr (\xs0 -> guard (not (null xs0)) >> pure (let (ys,xs1) = break ('c' ==) xs0; (zs,xs2) = span ('c' ==) xs1 in (ys ++ zs,xs2))) "abacabadabacabaeabacabadabacabaf"
2020-11-05 14:53:42 <lambdabot> ["abac","abadabac","abaeabac","abadabac","abaf"]
2020-11-05 14:54:12 pmikkelsen1 joins (~pmikkelse@vps1.pmikkelsen.com)
2020-11-05 14:54:13 <ski> > unfoldr (\xs0 -> guard (not (null xs0)) >> pure (let (ys,xs1) = break (3 ==) xs0; (zs,xs2) = span (3 ==) xs1 in (ys ++ zs,xs2))) [1,3,4,3,5]
2020-11-05 14:54:15 <lambdabot> [[1,3],[4,3],[5]]
2020-11-05 14:54:36 × coot quits (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 256 seconds)
2020-11-05 14:54:37 coot_ is now known as coot
2020-11-05 14:56:29 <jollygood2> interesting
2020-11-05 14:56:48 × pmikkelsen1 quits (~pmikkelse@vps1.pmikkelsen.com) (Remote host closed the connection)
2020-11-05 14:57:17 <ski> > let assoc = (fst &&& fst . snd) &&& snd . snd in unfoldr (\xs0 -> guard (not (null xs0)) >> (pure . first (uncurry (++)) . assoc) (span (3 ==) <$> break (3 ==) xs0)) [1,3,4,3,5]
2020-11-05 14:57:19 <lambdabot> [[1,3],[4,3],[5]]
2020-11-05 14:57:22 × ahmr88 quits (~ahmr88@cpc85006-haye22-2-0-cust131.17-4.cable.virginm.net) (Read error: Connection reset by peer)
2020-11-05 15:00:02 × Cotillion quits (~Cotillion@217.146.82.202) ()
2020-11-05 15:00:10 kupi joins (uid212005@gateway/web/irccloud.com/x-fvjiylahrovnfgof)
2020-11-05 15:01:50 × alp quits (~alp@88.126.45.36) (Ping timeout: 260 seconds)
2020-11-05 15:01:52 <jollygood2> thanks for interesting solutions, but Data.List.Split can actually do this
2020-11-05 15:01:55 <jollygood2> > split (keepDelimsR $ whenElt (==3)) [1,3,4,3,5]
2020-11-05 15:01:58 <lambdabot> [[1,3],[4,3],[5]]
2020-11-05 15:02:20 <akegalj> Hey guys. I just run onto article that says effect tracking is useless https://degoes.net/articles/no-effect-tracking . I am not sure has this been discussed in haskell community but I am not sure I understand the point he is making. In a similar way I find it would be beneficial to track exceptions - that way we can at least be sure we are at least handling all exceptions (and compiler can ensure that).
2020-11-05 15:02:26 <akegalj> In short, what is your opinion about this and if this is already discussed somewhere from haskell community can you point me to it?
2020-11-05 15:04:12 benjamingr__ joins (uid23465@gateway/web/irccloud.com/x-ifxghrbxkdgdxjip)
2020-11-05 15:04:38 × sh9 quits (~sh9@softbank060116136158.bbtec.net) (Ping timeout: 260 seconds)
2020-11-05 15:06:23 × troydm quits (~troydm@unaffiliated/troydm) (Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset)
2020-11-05 15:06:30 hackage kubernetes-client-core 0.3.1.0 - Auto-generated kubernetes-client-core API Client https://hackage.haskell.org/package/kubernetes-client-core-0.3.1.0 (axeman)
2020-11-05 15:07:07 troydm joins (~troydm@unaffiliated/troydm)
2020-11-05 15:07:30 hackage kubernetes-client 0.3.1.0 - Client library for Kubernetes https://hackage.haskell.org/package/kubernetes-client-0.3.1.0 (axeman)
2020-11-05 15:10:53 dmiles joins (dmiles@c-73-67-179-188.hsd1.wa.comcast.net)
2020-11-05 15:11:48 pmikkelsen joins (~pmikkelse@vps1.pmikkelsen.com)
2020-11-05 15:14:05 × pmikkelsen quits (~pmikkelse@vps1.pmikkelsen.com) (Read error: Connection reset by peer)
2020-11-05 15:16:24 christo joins (~chris@81.96.113.213)
2020-11-05 15:16:33 × christo quits (~chris@81.96.113.213) (Remote host closed the connection)
2020-11-05 15:16:54 × whatisRT quits (~whatisRT@2002:5b41:6a33:0:dea6:32ff:fe5b:d45f) (Read error: Connection reset by peer)
2020-11-05 15:20:20 carlomagno joins (~cararell@148.87.23.5)
2020-11-05 15:21:34 <ski> akegalj : i would distinguish between "side-effects" and "effects". the poster correctly notes that e.g. `putStrLn :: String -> IO ()' doesn't have any side-effects, but i'd still claim that it has (`IO'-)effects. and that `IO' "tracks" effects (it's a very crude form a tracking, not fine-grained. also there's other types of effects, e.g. `Maybe',`[]',`Either e',`STM',`ST s',...)
2020-11-05 15:22:56 <hololeap_> is there any way to turn `IO [a]` into `LogicT IO a`?
2020-11-05 15:23:02 hololeap_ is now known as hololeap
2020-11-05 15:27:16 <hololeap> % import System.Directory
2020-11-05 15:27:16 <yahb> hololeap:
2020-11-05 15:27:23 <hololeap> % :t \f -> fmap (concat . transpose) . traverse listDirectory >=> mapM_ f
2020-11-05 15:27:23 <yahb> hololeap: (FilePath -> IO b) -> [FilePath] -> IO ()
2020-11-05 15:27:33 <ski> @type let oneOf = foldr ((<|>) . pure) empty in (oneOf =<<) . lift :: IO [a] -> LogicT IO a
2020-11-05 15:27:34 <lambdabot> IO [a] -> LogicT IO a
2020-11-05 15:29:26 <hololeap> i'm trying to do a breadth-first scan of a list of directories, and do some kind of IO action on each file, so a file structure like [a/a.txt
2020-11-05 15:30:27 <hololeap> ["a/a.txt","a/b.txt","b/a.txt","c/a.txt"] would be processed in the order ["a/a.txt","b/a.txt","c/a.txt","a/b.txt"]
2020-11-05 15:30:34 × knupfer quits (~Thunderbi@i59F7FF32.versanet.de) (Quit: knupfer)
2020-11-05 15:31:23 <hololeap> would LogicT be the way to go for this or should i just stick with lists, using transpose to get the order i'm looking for
2020-11-05 15:31:33 × DataComputist quits (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net) (Quit: Leaving...)
2020-11-05 15:31:57 × conal quits (~conal@64.71.133.70) (Ping timeout: 258 seconds)
2020-11-05 15:31:59 <hololeap> i'm still pretty unfamiliar with LogicT, so i might be reaching for it when it isn't necessary
2020-11-05 15:33:25 Amras joins (~Amras@unaffiliated/amras0000)
2020-11-05 15:34:31 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2020-11-05 15:36:32 <ski> akegalj : i agree that part of the power of `IO' (and other monads and idioms) is having effects be first-class values

All times are in UTC.