Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-11 14:01:41 × BatRumbata quits (~rumen@crazy-user.136.47.countrybg.net) ()
2020-11-11 14:02:01 <bqv> Haskell doesn't like infinite types
2020-11-11 14:02:17 <bqv> But does that include all infinite forms?
2020-11-11 14:02:22 elliott_ joins (~elliott_@pool-108-51-141-12.washdc.fios.verizon.net)
2020-11-11 14:02:37 <merijn> bqv: You can trivially bypass that restriction via newtypes
2020-11-11 14:03:04 <bqv> Ok, but without newtypes?
2020-11-11 14:03:26 × neiluj quits (~jco@24.104.204.77.rev.sfr.net) (Ping timeout: 260 seconds)
2020-11-11 14:03:30 <nshepperd> what's an infinite form
2020-11-11 14:03:33 <Iceland_jack> what do you mean by infinite form?
2020-11-11 14:03:41 heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net)
2020-11-11 14:04:07 neiluj joins (~jco@24.104.204.77.rev.sfr.net)
2020-11-11 14:04:35 <bqv> I'm noting that (->) is an indexed type, so I'm wondering if you could make an infinite tree out of it
2020-11-11 14:04:42 avdb joins (~avdb@ip-83-134-202-84.dsl.scarlet.be)
2020-11-11 14:04:44 <bqv> And what that would even do
2020-11-11 14:04:55 × aarvar quits (~foewfoiew@c.24.56.239.179.static.broadstripe.net) (Ping timeout: 256 seconds)
2020-11-11 14:04:59 <bqv> With newtypes it wouldn't be callable
2020-11-11 14:05:51 <merijn> bqv: I mean like "newtype Infinite a = Infinite (a -> Infinite)" works just fine
2020-11-11 14:06:38 <merijn> nshepperd: Well, imagine [[[[a]]]], except nested, well, infinitely many times :)
2020-11-11 14:06:54 <merijn> "newtype Infinite = Infinite [Infinite]"
2020-11-11 14:07:49 <bqv> Ok how about another way, is there a way to create a function that takes an infinite number of args?
2020-11-11 14:08:03 <bqv> :t fix const
2020-11-11 14:08:05 <lambdabot> error:
2020-11-11 14:08:05 <lambdabot> • Occurs check: cannot construct the infinite type: a ~ b -> a
2020-11-11 14:08:05 <lambdabot> Expected type: (b -> a) -> b -> a
2020-11-11 14:08:14 <bqv> Heh
2020-11-11 14:08:28 <dminuoso> bqv: yes.
2020-11-11 14:08:32 <dminuoso> with typeclasses
2020-11-11 14:08:33 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds)
2020-11-11 14:08:44 <bqv> Now we're cooking
2020-11-11 14:09:14 × ubert quits (~Thunderbi@p200300ecdf1e530ce6b318fffe838f33.dip0.t-ipconnect.de) (Remote host closed the connection)
2020-11-11 14:09:24 <merijn> bqv: The first one takes an infinite number of arguments modulo unwrapping :p
2020-11-11 14:09:58 <bqv> I know, its just less cool if you have to unwrap :D
2020-11-11 14:10:25 <nshepperd2> well, with type classes you can make a polymorphic value which can become a function taking any given finite number of arguments
2020-11-11 14:10:40 <dminuoso> % lift (,) (Just 1) (Just 2)
2020-11-11 14:10:41 <yahb> dminuoso: Just (1,2)
2020-11-11 14:10:46 <nshepperd2> which you may or may not consider to count as taking infinite arguments
2020-11-11 14:10:46 <dminuoso> % lift (,,) (Just 1) (Just 2) (Just 3)
2020-11-11 14:10:46 <yahb> dminuoso: Just (1,2,3)
2020-11-11 14:10:49 <dminuoso> % lift (,,,) (Just 1) (Just 2) (Just 3) (Just 4)
2020-11-11 14:10:49 <yahb> dminuoso: Just (1,2,3,4)
2020-11-11 14:10:52 <dminuoso> It's magic. :)
2020-11-11 14:12:08 <hekkaidekapus> xenon- meets Iceland_jack:
2020-11-11 14:12:17 <hekkaidekapus> > let xs = [[1,2,3],[10,20,30],[100,200,300]]; rotate = drop <> take; go = ZipList . head in (,,) <$> go xs <*> go (rotate 1 xs) <*> go (rotate 2 xs)
2020-11-11 14:12:19 <lambdabot> ZipList {getZipList = [(1,10,100),(2,20,200),(3,30,300)]}
2020-11-11 14:12:57 <dminuoso> hekkaidekapus: Okay you're golfing in an odd direction
2020-11-11 14:13:04 <hekkaidekapus> heh
2020-11-11 14:13:25 <nshepperd2> deliberately golfing off the course
2020-11-11 14:13:28 <dminuoso> That's not quite the output asked for.
2020-11-11 14:13:53 <hekkaidekapus> The morning was rough this side :)
2020-11-11 14:14:22 <dminuoso> hekkaidekapus: We might have to revoke your golf greencard.
2020-11-11 14:15:26 <hekkaidekapus> dminuoso: I already won <https://twitter.com/TheMasters/status/1326232433373704194>
2020-11-11 14:15:52 <dminuoso> hekkaidekapus: But, you're onto something
2020-11-11 14:15:54 <dminuoso> % traverse ZipList [[1,2,3],[10,20,30],[100,200,300]]
2020-11-11 14:15:54 <yahb> dminuoso: ZipList {getZipList = [[1,10,100],[2,20,200],[3,30,300]]}
2020-11-11 14:15:58 <dminuoso> % sequence $ traverse ZipList [[1,2,3],[10,20,30],[100,200,300]]
2020-11-11 14:15:58 <yahb> dminuoso: [ZipList {getZipList = [1,2,3]},ZipList {getZipList = [1,2,30]},ZipList {getZipList = [1,2,300]},ZipList {getZipList = [1,20,3]},ZipList {getZipList = [1,20,30]},ZipList {getZipList = [1,20,300]},ZipList {getZipList = [1,200,3]},ZipList {getZipList = [1,200,30]},ZipList {getZipList = [1,200,300]},ZipList {getZipList = [10,2,3]},ZipList {getZipList = [10,2,30]},ZipList {getZipList = [10,2,300]},Zip
2020-11-11 14:16:03 <dminuoso> Uhh, wait
2020-11-11 14:16:05 × jonatanb quits (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl) (Remote host closed the connection)
2020-11-11 14:16:09 <dminuoso> maybe this is easier with ala
2020-11-11 14:16:41 <Iceland_jack> unf
2020-11-11 14:16:44 <dminuoso> % sequence $ ZipList (ZipList <$> [[1,2,3],[10,20,30],[100,200,300]])
2020-11-11 14:16:44 <yahb> dminuoso: ; <interactive>:70:1: error:; * Could not deduce (Monad ZipList) arising from a use of `sequence'; from the context: Num a bound by the inferred type of it :: Num a => ZipList (ZipList a) at <interactive>:70:1-67; * In the expression: sequence $ ZipList (ZipList <$> [[1, 2, 3], [10, 20, 30], [100, 200, 300]]); In an equation for `it': it = sequence $ ZipList (ZipList <$> [[1, 2, ...
2020-11-11 14:16:45 <Iceland_jack> I'm spooked
2020-11-11 14:16:56 <Iceland_jack> >Monad ZipList
2020-11-11 14:16:57 <Iceland_jack> state of sin
2020-11-11 14:17:01 <dminuoso> oh
2020-11-11 14:17:06 <dminuoso> % sequenceA $ ZipList (ZipList <$> [[1,2,3],[10,20,30],[100,200,300]])
2020-11-11 14:17:06 <yahb> dminuoso: ZipList {getZipList = [ZipList {getZipList = [1,10,100]},ZipList {getZipList = [2,20,200]},ZipList {getZipList = [3,30,300]}]}
2020-11-11 14:17:19 jonatanb joins (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl)
2020-11-11 14:17:20 <dminuoso> That looks good, now we just need to run sequenceA with ala. I dont know how to do that
2020-11-11 14:17:48 acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net)
2020-11-11 14:17:48 <hekkaidekapus> Now, who’s golfing :P
2020-11-11 14:18:07 christo joins (~chris@81.96.113.213)
2020-11-11 14:18:36 <dminuoso> % ala ZipList traverse [[1,2], [10,20]]
2020-11-11 14:18:36 <yahb> dminuoso: [[1,10],[2,20]]
2020-11-11 14:18:43 <dminuoso> Getting close there
2020-11-11 14:19:22 urodna joins (~urodna@unaffiliated/urodna)
2020-11-11 14:19:33 <dminuoso> hekkaidekapus: But thanks, I had never considered to traverse with ZipList
2020-11-11 14:19:36 <dminuoso> That's quite a thought.
2020-11-11 14:20:13 <dminuoso> Mmm, I guess `transpose = ala ZipList traverse` ?
2020-11-11 14:22:18 × jonatanb quits (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl) (Ping timeout: 272 seconds)
2020-11-11 14:23:01 × christo quits (~chris@81.96.113.213) (Ping timeout: 264 seconds)
2020-11-11 14:29:09 mputz joins (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de)
2020-11-11 14:29:22 <Iceland_jack> yeah
2020-11-11 14:29:27 christo joins (~chris@81.96.113.213)
2020-11-11 14:29:44 <Iceland_jack> tranpose = transposeOf traverse <-- doesn't lens have
2020-11-11 14:32:58 encod3 joins (~encod3@45-154-157-94.ftth.glasoperator.nl)
2020-11-11 14:33:21 <dminuoso> transposeOf l = getZipList #. l ZipList
2020-11-11 14:33:24 <dminuoso> Yeah makes sense
2020-11-11 14:34:03 matael1 joins (~matael@139.28.218.148)
2020-11-11 14:34:10 × plutoniix quits (~q@node-uj3.pool-125-24.dynamic.totinternet.net) (Quit: Leaving)
2020-11-11 14:36:00 hackage cobot-io 0.1.3.12 - Biological data file formats and IO https://hackage.haskell.org/package/cobot-io-0.1.3.12 (ozzzzz)
2020-11-11 14:36:41 mananamenos joins (~mananamen@84.122.202.215.dyn.user.ono.com)
2020-11-11 14:37:50 × tdhttt quits (~tdhttt@2600:8802:2203:2500:799b:bc7:7aac:82a9) (Ping timeout: 264 seconds)
2020-11-11 14:37:58 × bliminse quits (~bliminse@host109-156-197-211.range109-156.btcentralplus.com) (Quit: leaving)
2020-11-11 14:38:16 × encod3 quits (~encod3@45-154-157-94.ftth.glasoperator.nl) ()
2020-11-11 14:38:35 <bqv> :t (#.)
2020-11-11 14:38:37 <lambdabot> error:
2020-11-11 14:38:37 <lambdabot> • Variable not in scope: #.
2020-11-11 14:38:37 <lambdabot> • Perhaps you meant one of these:

All times are in UTC.