Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-21 13:38:02 <merijn> eh, whoops
2021-04-21 13:38:05 <merijn> > [(x, y) | (x, Just y) <- [(True, Nothing), (False, Just 1), (True, Just 2), (True, Nothing), (False, Nothing)]]
2021-04-21 13:38:07 <lambdabot> [(False,1),(True,2)]
2021-04-21 13:38:09 timCF joins (~i.tkachuk@200-149-20-81.sta.estpak.ee)
2021-04-21 13:38:13 bitmagie joins (~Thunderbi@200116b8063572001499edd4f9d505b9.dip.versatel-1u1.de)
2021-04-21 13:38:42 <safinaskar> merijn: thanks a lot
2021-04-21 13:40:23 <kuribas> safinaskar: "Unfortunately, this solution contains lambda", what's unfortunate about that?
2021-04-21 13:40:44 <merijn> kuribas: "a lambda with a potential failing pattern"
2021-04-21 13:40:54 <safinaskar> kuribas: function (\(x, Just y) -> (x, y)) is partial
2021-04-21 13:41:00 <kuribas> ah right
2021-04-21 13:41:14 <merijn> tbh, I think this is one of the few cases where I actually prefer list comprehensions over anything else
2021-04-21 13:41:33 <merijn> The "pattern match failure is filtered out" semantics is very nice
2021-04-21 13:41:35 <timCF> Hello! Is there any good way to represent side-effect rich computation in a compact way with some sort of Alternative applications? If I simplify, my case might look like multiple `IO Bool` expressions, whcih I want to sequentially evaluate until one of them will return `IO True`. Basically I'm looking for something like `a <|> b <|> c` where parameters are these expressions (pseudo-code)
2021-04-21 13:42:05 <kuribas> safinaskar: you could use mapMaybe in that case.
2021-04-21 13:42:22 <kuribas> safinaskar: a comprehension is nicer, but more magical.
2021-04-21 13:42:23 <merijn> kuribas: Sure...or you can use the trivial list comprehension :p
2021-04-21 13:42:38 jao joins (~jao@pdpc/supporter/professional/jao)
2021-04-21 13:42:58 <hyperisco> timCF, at the least you can just define your own operator, if that is a syntax you like
2021-04-21 13:43:29 <kuribas> timCF: what is IO True?
2021-04-21 13:43:57 <hyperisco> timCF, you may also want to look at definitions like allM
2021-04-21 13:44:00 <timCF> hyperisco: maybe there is some standard thing for that? I just don't want nested bind + if then else
2021-04-21 13:44:06 <kuribas> timCF: I think what you ask is, an expression that performance side-effects until one returns True?
2021-04-21 13:44:18 <timCF> kuribas: yes
2021-04-21 13:45:53 <timCF> kuribas: in my example `a <|> b <|> c` I want all expression to return True and don't evaluate `c` in case where `b` is True
2021-04-21 13:46:32 <kuribas> timCF: there isn't something standard like that AFAIK.
2021-04-21 13:46:37 <timCF> kuribas: But expressions are not just Bool, they are `m Bool`
2021-04-21 13:48:15 × aVikingTrex quits (~aVikingTr@2001:8003:340d:d00:b2de:b98:7a93:b0ea) (Ping timeout: 260 seconds)
2021-04-21 13:48:25 × pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Quit: Textual IRC Client: www.textualapp.com)
2021-04-21 13:48:53 <wz1000> timCF: extra has orM and variations
2021-04-21 13:49:31 × raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Quit: WeeChat 3.1)
2021-04-21 13:49:39 × dmytrish quits (~mitra@2a02:8084:a82:d900:fdd2:ac3d:3471:66d9) (Ping timeout: 260 seconds)
2021-04-21 13:49:40 <kuribas> :t liftA2 (&&) . unsafeInterleaveIO
2021-04-21 13:49:42 <lambdabot> error:
2021-04-21 13:49:42 <lambdabot> Variable not in scope: unsafeInterleaveIO :: a -> f Bool
2021-04-21 13:50:12 × sleblanc quits (~sleblanc@unaffiliated/sebleblanc) (Ping timeout: 240 seconds)
2021-04-21 13:50:45 dmytrish joins (~mitra@2a02:8084:a82:d900:fdd2:ac3d:3471:66d9)
2021-04-21 13:51:17 <timCF> kuribas: thanks, I think I did found what I want
2021-04-21 13:51:36 <timCF> :t (||^)
2021-04-21 13:51:38 <lambdabot> error:
2021-04-21 13:51:38 <lambdabot> • Variable not in scope: ||^
2021-04-21 13:51:38 <lambdabot> • Perhaps you meant one of these:
2021-04-21 13:53:01 × Tario quits (~Tario@201.192.165.173) (Ping timeout: 260 seconds)
2021-04-21 13:53:27 Tario joins (~Tario@200.119.185.49)
2021-04-21 13:53:40 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-04-21 13:55:46 × mrchampion quits (~mrchampio@38.18.109.23) (Ping timeout: 245 seconds)
2021-04-21 13:57:27 <wz1000> asymmetric operators for "commutative" operations are so frustruating
2021-04-21 13:57:28 × Tario quits (~Tario@200.119.185.49) (Read error: Connection reset by peer)
2021-04-21 13:57:59 <wz1000> (yes, I know this is not exactly commutative, but it is morally)
2021-04-21 13:58:28 <wz1000> even then that is so ugly. ||> might have been better (|| + >>)
2021-04-21 13:58:33 pfurla joins (~pfurla@ool-182ed2e2.dyn.optonline.net)
2021-04-21 13:59:00 Tario joins (~Tario@201.192.165.173)
2021-04-21 14:00:27 aVikingTrex joins (~aVikingTr@2001:8003:340d:d00:b2de:b98:7a93:b0ea)
2021-04-21 14:01:19 × dmytrish quits (~mitra@2a02:8084:a82:d900:fdd2:ac3d:3471:66d9) (Ping timeout: 260 seconds)
2021-04-21 14:01:40 tatsumaru joins (~tatsumaru@85.196.189.103)
2021-04-21 14:02:59 vs^ joins (vs@ip98-184-89-2.mc.at.cox.net)
2021-04-21 14:04:13 × hypercube quits (hypercube@gateway/vpn/protonvpn/hypercube) (Quit: WeeChat 3.1)
2021-04-21 14:04:42 × CiaoSen quits (~Jura@p200300c9572bc100dd00e68a577d428e.dip0.t-ipconnect.de) (Quit: CiaoSen)
2021-04-21 14:04:58 <tatsumaru> what does x xs xxs etc. mean in haskell notation?
2021-04-21 14:05:13 <tatsumaru> actually I know what x is, I just don't understand xs xxs
2021-04-21 14:05:39 <hpc> xs is the plural of x
2021-04-21 14:05:41 × zaquest quits (~notzaques@5.128.210.178) (Quit: Leaving)
2021-04-21 14:05:44 × pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Quit: Textual IRC Client: www.textualapp.com)
2021-04-21 14:06:01 <hpc> like how you might write "for item in items" in other languages
2021-04-21 14:06:04 <kuribas> doesn't that come from prolog?
2021-04-21 14:06:14 <merijn> tatsumaru: one pig, multiple pigS, one bike, multiple bikeS, one x, multiple xS :)
2021-04-21 14:06:22 pfurla joins (~pfurla@ool-182ed2e2.dyn.optonline.net)
2021-04-21 14:06:25 × berberman_ quits (~berberman@unaffiliated/berberman) (Ping timeout: 250 seconds)
2021-04-21 14:06:38 <tatsumaru> so s is just plural?
2021-04-21 14:06:41 <merijn> yeah
2021-04-21 14:06:52 <tatsumaru> ah that was simpler that I thought, thanks
2021-04-21 14:06:56 <tatsumaru> than*
2021-04-21 14:07:16 berberman joins (~berberman@unaffiliated/berberman)
2021-04-21 14:07:52 <merijn> tatsumaru: You could write "(item:items)" instead of "(x:xs)", but that's more typing and not really any clearer/more meaningful :)
2021-04-21 14:08:03 <timCF> tatsumaru: but what do you mean by `xxs` then?
2021-04-21 14:08:24 <merijn> timCF: That's sometimes a name for lists of lists
2021-04-21 14:08:50 <timCF> merijn: hmm, I'll write `xss` in this case :)
2021-04-21 14:10:43 mrchampion joins (~mrchampio@38.18.109.23)
2021-04-21 14:10:46 <tatsumaru> this is where I saw xxs: ghci> [ [ x | x <- xs, even x ] | xs <- xxs]
2021-04-21 14:11:16 <tatsumaru> where in that particular case xxs was [[1,3,5,2,3,1,2,4,5], [1,2,3,4,5,6,7,8,9],
2021-04-21 14:11:16 <tatsumaru> [1,2,4,2,1,6,3,1,3,2,3,6]]
2021-04-21 14:11:27 <tatsumaru> sorry for the new line it was unintentional
2021-04-21 14:11:57 <tatsumaru> but indeed xss seems more logical
2021-04-21 14:13:05 <tatsumaru> although one could argue that xxs means x of xs and makes sense that way
2021-04-21 14:13:19 blankhart joins (~blankhart@pool-72-88-174-206.nwrknj.fios.verizon.net)
2021-04-21 14:13:51 <blankhart> when template haskell is run at compile-time, is the metaprogram compiled and run the same as any other program, maybe skipping certain optimizations for speed?
2021-04-21 14:14:38 <merijn> blankhart: After TH is run, the resulting AST is spliced into the code and then the whole thing is compiled as normal, yes
2021-04-21 14:15:00 Sgeo joins (~Sgeo@ool-18b98aa4.dyn.optonline.net)
2021-04-21 14:19:01 × LKoen quits (~LKoen@92.163.9.109.rev.sfr.net) (Remote host closed the connection)
2021-04-21 14:19:03 <blankhart> sorry to clarify i am asking about how TH is run
2021-04-21 14:21:30 × bitmagie quits (~Thunderbi@200116b8063572001499edd4f9d505b9.dip.versatel-1u1.de) (Quit: bitmagie)
2021-04-21 14:21:30 <blankhart> for example, if i tell the compiler to use -O3 optimizations, i wouldn't think that means it compiles template haskell with -O3 and executes the optimized version at compile-time
2021-04-21 14:21:44 <geekosaur> TH code lives in the Q monad and is compiled and run in a ghci-like environment / interpreted
2021-04-21 14:22:58 <geekosaur> it can call imported compiled code but won't compile any code itself aside from to ghci bytecode (unless the splice itself does so)
2021-04-21 14:23:07 rj joins (~x@gateway/tor-sasl/rj)
2021-04-21 14:24:45 × rdivyanshu quits (uid322626@gateway/web/irccloud.com/x-fcexcnqymecxutqt) (Quit: Connection closed for inactivity)
2021-04-21 14:27:17 vdukhovni joins (64022765@100.2.39.101)
2021-04-21 14:27:22 barakkl1993 joins (~barakkley@2.55.180.173)
2021-04-21 14:29:02 zaquest joins (~notzaques@5.128.210.178)
2021-04-21 14:30:32 Jd007 joins (~Jd007@162.156.11.151)
2021-04-21 14:30:53 Guest78317 joins (~laudiacay@67.176.215.84)

All times are in UTC.