Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-08 22:55:12 <lambdabot> GT
2020-11-08 22:55:20 <koz_> OK, I'm not forgetting the order.
2020-11-08 22:56:56 × jbox quits (~atlas@unaffiliated/jbox) (Read error: Connection reset by peer)
2020-11-08 22:57:13 × jonatanb quits (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl) (Ping timeout: 264 seconds)
2020-11-08 22:57:22 jbox joins (~atlas@unaffiliated/jbox)
2020-11-08 23:00:05 <Feuermagier> I want to build a string by calling an evaluation function on each position of a list. how can I extend the list up to a fixed size, or alternatively handle nonexistant entries in the array?
2020-11-08 23:01:11 <comerijn> Feuermagier: Do you have a sensible element to pad with if it's too short?
2020-11-08 23:01:15 <Feuermagier> 0
2020-11-08 23:01:21 <Feuermagier> (its a list of integers)
2020-11-08 23:01:39 <comerijn> > take 10 ([1..5] ++ repeat 0)
2020-11-08 23:01:41 <lambdabot> [1,2,3,4,5,0,0,0,0,0]
2020-11-08 23:01:57 <Feuermagier> ooh, fancy
2020-11-08 23:02:06 <comerijn> Feuermagier: Just pad with infinite zeroes at the end and take however many elements you need :p
2020-11-08 23:03:59 nbloomf joins (~nbloomf@2600:1700:ad14:3020:c5c0:6767:7b37:f0c3)
2020-11-08 23:04:05 <Feuermagier> can I pad at front as well?
2020-11-08 23:04:54 <comerijn> That's trickier, because you'll need to know in advance how many elements to pad with
2020-11-08 23:05:14 <Feuermagier> I guess I can simply reverse my list
2020-11-08 23:05:36 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:c5c0:6767:7b37:f0c3) (Client Quit)
2020-11-08 23:07:18 ransom joins (~c4264035@c-73-243-2-10.hsd1.co.comcast.net)
2020-11-08 23:08:24 <koz_> Cale: Any chance you could tell me how one satisfies a 'ConstraintsFor F (ComposeC Show Identity)'? I'm trying to use a custom GADT F in the context of 'DMap F Identity' and a Show instance for it.
2020-11-08 23:08:27 <koz_> (same with Eq)
2020-11-08 23:08:54 uwap_ joins (~uwap@genja.uwap.name)
2020-11-08 23:09:08 × atle quits (~jack@beta3.space) (Ping timeout: 260 seconds)
2020-11-08 23:09:24 atle joins (~jack@beta3.space)
2020-11-08 23:09:34 × edwtjo quits (~edwtjo@fsf/member/edwtjo) (Ping timeout: 265 seconds)
2020-11-08 23:09:43 × uwap quits (~uwap@genja.uwap.name) (Ping timeout: 260 seconds)
2020-11-08 23:09:43 × kish` quits (~oracle@unaffiliated/oracle) (Remote host closed the connection)
2020-11-08 23:10:14 kish` joins (~oracle@unaffiliated/oracle)
2020-11-08 23:10:18 × laxask quits (~lax@unaffiliated/laxask) (Ping timeout: 260 seconds)
2020-11-08 23:10:28 × elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Read error: Connection reset by peer)
2020-11-08 23:10:45 laxask joins (~lax@unaffiliated/laxask)
2020-11-08 23:11:13 edwtjo joins (~edwtjo@fsf/member/edwtjo)
2020-11-08 23:12:43 × alp quits (~alp@2a01:e0a:58b:4920:286f:8943:c678:1c5c) (Ping timeout: 244 seconds)
2020-11-08 23:16:00 nbloomf joins (~nbloomf@2600:1700:ad14:3020:a17b:c481:d5f1:9100)
2020-11-08 23:17:25 × sulu quits (~sulu@unaffiliated/sulu) (Ping timeout: 240 seconds)
2020-11-08 23:17:29 × Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Quit: Leaving.)
2020-11-08 23:18:54 jcowan joins (sid325434@gateway/web/irccloud.com/x-xccxiqbedbcrqfvq)
2020-11-08 23:18:58 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-08 23:20:35 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-11-08 23:21:00 × Sheilong quits (uid293653@gateway/web/irccloud.com/x-nprfqeunfdioejyi) (Quit: Connection closed for inactivity)
2020-11-08 23:21:53 <bqv> Hey, how best can I get a "Maybe monad"-style effect in polysemy?
2020-11-08 23:22:34 × tsaka__ quits (~torstein@ppp-2-84-22-81.home.otenet.gr) (Remote host closed the connection)
2020-11-08 23:22:45 <bqv> I'm looking at NonDet, but I'm not quite sure how to use it
2020-11-08 23:23:00 tsaka__ joins (~torstein@ppp-2-84-22-81.home.otenet.gr)
2020-11-08 23:23:26 × jbox quits (~atlas@unaffiliated/jbox) (Read error: Connection reset by peer)
2020-11-08 23:23:36 <bqv> I gues I'm looking for a function :: Maybe a -> Polysemy.Sem r a
2020-11-08 23:23:38 × Franciman quits (~francesco@host-79-36-167-172.retail.telecomitalia.it) (Quit: Leaving)
2020-11-08 23:23:40 <bqv> Of some sort
2020-11-08 23:23:43 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds)
2020-11-08 23:24:00 jbox joins (~atlas@unaffiliated/jbox)
2020-11-08 23:24:59 <bqv> I see at least NonDet gives Sem an alternative instance, but how to drop a maybe into NonDet?
2020-11-08 23:26:10 × Deide quits (~Deide@217.155.19.23) (Quit: Seeee yaaaa)
2020-11-08 23:26:18 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Quit: Leaving)
2020-11-08 23:27:59 <bqv> I could embed Maybe...
2020-11-08 23:28:14 <bqv> Feels oof tho
2020-11-08 23:28:44 <bqv> Probably the easiest solution to be honest
2020-11-08 23:30:11 <bqv> Or maybe I should just handle the errors properly. Ugh
2020-11-08 23:30:36 CMCDragonkai1 joins (~Thunderbi@124.19.3.250)
2020-11-08 23:32:07 <jcowan> Is there any usable workaround for the fact that a constructor can't appear in two or more types?
2020-11-08 23:32:29 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:a17b:c481:d5f1:9100) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-11-08 23:32:33 <hpc> naming them different things?
2020-11-08 23:32:46 <jcowan> yeah, maybe I deserve that.
2020-11-08 23:32:53 <hpc> if they're in different modules, import them qualified
2020-11-08 23:33:12 <hpc> or if you can't do that, prefixing them with the type maybe
2020-11-08 23:33:21 <jcowan> I'm assuming of course that they are in fact the *same* constructor (same number and types of arguments, not just a coincidence of names
2020-11-08 23:33:35 <hpc> like if Foo and Bar both have constructor Object, name them FooObject and BarObject instead
2020-11-08 23:34:08 <jcowan> Which means that the system can't recognize the isomorphism.
2020-11-08 23:34:53 <hpc> if you want both constructors to be the same value, use a function or type class or something along those lines
2020-11-08 23:35:01 <hpc> constructors can't be polymorphic in the type they construct
2020-11-08 23:35:07 <bqv> Classy
2020-11-08 23:35:32 <hpc> (also i definitely phrased that first suggestion for maximum humor :D)
2020-11-08 23:36:01 hackage json-to-haskell 0.1.1.0 - https://hackage.haskell.org/package/json-to-haskell-0.1.1.0 (ChrisPenner)
2020-11-08 23:38:37 nbloomf joins (~nbloomf@2600:1700:ad14:3020:a17b:c481:d5f1:9100)
2020-11-08 23:39:32 × jbox quits (~atlas@unaffiliated/jbox) (Ping timeout: 265 seconds)
2020-11-08 23:40:36 jbox joins (~atlas@unaffiliated/jbox)
2020-11-08 23:43:57 jedws joins (~jedws@101.184.150.81)
2020-11-08 23:44:09 Amras joins (~Amras@unaffiliated/amras0000)
2020-11-08 23:44:29 <Feuermagier> how can I get element n out of a list?
2020-11-08 23:44:39 <bqv> Feuermagier: list !! n
2020-11-08 23:44:51 <bqv> % 1
2020-11-08 23:44:52 <yahb> bqv: 1
2020-11-08 23:44:57 Gurkenglas__ joins (Gurkenglas@gateway/vpn/protonvpn/gurkenglas)
2020-11-08 23:45:04 <bqv> % ["a", "b", "c"] !! 1
2020-11-08 23:45:04 <yahb> bqv: "b"
2020-11-08 23:45:08 <bqv> % ["a", "b", "c"] !! 3
2020-11-08 23:45:09 <yahb> bqv: "*** Exception: Prelude.!!: index too large
2020-11-08 23:45:11 <bqv> % ["a", "b", "c"] !! 0
2020-11-08 23:45:11 <yahb> bqv: "a"
2020-11-08 23:45:15 <Feuermagier> I have a list of 10 elements and want to perform a different operation on each position and sum the results
2020-11-08 23:45:19 <koz_> [insert obligatory warning about indexing lists being both slow and unsafe]
2020-11-08 23:45:26 <comerijn> tbh, random access on lists is bad
2020-11-08 23:45:32 <bqv> Feuermagier: sounds like a fold
2020-11-08 23:45:45 <Feuermagier> bqv, havent heard of that yet
2020-11-08 23:45:48 <koz_> bqv: Or a foldMap. :P
2020-11-08 23:46:00 <hpc> Feuermagier: zipWith ($) sounds more suitable
2020-11-08 23:46:27 jalumar joins (uid392211@gateway/web/irccloud.com/x-cinmpjhrecfacgba)
2020-11-08 23:46:28 <hpc> % zipWith [(+ 5), (* 2), id] [100, 1000, 10000]
2020-11-08 23:46:29 <yahb> hpc: ; <interactive>:16:9: error:; * Couldn't match expected type `a1 -> b -> c' with actual type `[a0 -> a0]'; * In the first argument of `zipWith', namely `[(+ 5), (* 2), id]'; In the expression: zipWith [(+ 5), (* 2), id] [100, 1000, 10000]; In an equation for `it': it = zipWith [(+ 5), (* 2), id] [100, 1000, 10000]; * Relevant bindings include it :: [b] -> [c] (bound at <interacti
2020-11-08 23:46:37 <hpc> % zipWith ($) [(+ 5), (* 2), id] [100, 1000, 10000]
2020-11-08 23:46:37 <yahb> hpc: [105,2000,10000]

All times are in UTC.