Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-14 08:42:53 × magnuscake quits (~magnuscak@87-121-92-61.dyn.launtel.net.au) (Ping timeout: 260 seconds)
2021-03-14 08:43:52 × mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Remote host closed the connection)
2021-03-14 08:44:18 mirrorbird joins (dwsjeid911@gateway/vpn/mullvad/dwsjeid911)
2021-03-14 08:44:28 kiweun joins (~kiweun@2607:fea8:2a62:9600:ccec:b748:42d2:7842)
2021-03-14 08:46:14 stree joins (~stree@68.36.8.116)
2021-03-14 08:47:11 hackage Win32 2.12.0.0 - A binding to Windows Win32 API. https://hackage.haskell.org/package/Win32-2.12.0.0 (TamarChristina)
2021-03-14 08:48:35 × nbloomf quits (~nbloomf@70.182.116.249) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-03-14 08:48:59 supercoven joins (~Supercove@dsl-hkibng31-54fabd-233.dhcp.inet.fi)
2021-03-14 08:49:39 Tuplanolla joins (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi)
2021-03-14 08:53:41 hackage futhark 0.19.2 - An optimising compiler for a functional, array-oriented language. https://hackage.haskell.org/package/futhark-0.19.2 (TroelsHenriksen)
2021-03-14 08:53:41 × kiweun quits (~kiweun@2607:fea8:2a62:9600:ccec:b748:42d2:7842) (Remote host closed the connection)
2021-03-14 08:54:03 <ephemient> curiousgay: Char being 8-bit or 32-bit makes no difference in space usage for most Haskell programs using String, as type String = [Char] (so all the chars are individual objects on the heap, and and all heap objects have a minimum size)
2021-03-14 08:56:12 Franciman joins (~francesco@host-82-49-79-189.retail.telecomitalia.it)
2021-03-14 08:56:40 borne joins (~fritjof@200116b864d4700065fd8eaafdc5f06e.dip.versatel-1u1.de)
2021-03-14 08:56:42 <ephemient> @hackage text-utf8 has a packed UTF-8 representation can use less memory than text's Data.Text which is packed UTF-16, but either way it's significantly different from String
2021-03-14 08:56:42 <lambdabot> https://hackage.haskell.org/package/text-utf8 has a packed UTF-8 representation can use less memory than text's Data.Text which is packed UTF-16, but either way it's significantly different from
2021-03-14 08:56:43 <lambdabot> String
2021-03-14 08:57:03 <ephemient> ... I didn't expect lambdabot to just concat like that, but ok
2021-03-14 08:57:43 × Sgeo quits (~Sgeo@ool-18b98aa4.dyn.optonline.net) (Read error: Connection reset by peer)
2021-03-14 09:06:18 × alexelcu quits (~alexelcu@142.93.180.198) (Remote host closed the connection)
2021-03-14 09:07:27 × pehjota quits (~pehjota@37.120.211.188) (Remote host closed the connection)
2021-03-14 09:08:15 fendor joins (~fendor@91.141.1.110.wireless.dyn.drei.com)
2021-03-14 09:09:33 × pera quits (~pera@unaffiliated/pera) (Ping timeout: 264 seconds)
2021-03-14 09:11:38 hexfive joins (~hexfive@50.35.83.177)
2021-03-14 09:12:59 × teardown quits (~user@gateway/tor-sasl/mrush) (Remote host closed the connection)
2021-03-14 09:13:25 teardown joins (~user@gateway/tor-sasl/mrush)
2021-03-14 09:13:41 × drbean quits (~drbean@TC210-63-209-28.static.apol.com.tw) (Quit: ZNC 1.8.2+cygwin2 - https://znc.in)
2021-03-14 09:13:50 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
2021-03-14 09:15:22 × mirrorbird quits (dwsjeid911@gateway/vpn/mullvad/dwsjeid911) (Ping timeout: 256 seconds)
2021-03-14 09:15:52 × gehmehgeh quits (~ircuser1@gateway/tor-sasl/gehmehgeh) (Remote host closed the connection)
2021-03-14 09:17:12 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
2021-03-14 09:23:18 <curiousgay> ephemient: right, on C side they are `struct String {char c; struct String *next}` where sizeof(struct String) = sizeof(void*) * 2, so on 32-bit machines one character consumes 8 bytes and on 64-bit ones that's 16 bytes
2021-03-14 09:24:08 pera joins (~pera@unaffiliated/pera)
2021-03-14 09:24:17 <curiousgay> that actually gave me a bad first impression about Haskell because I enjoy low level programming, so I already knew how lists work
2021-03-14 09:24:18 × pavonia quits (~user@unaffiliated/siracusa) (Quit: Bye!)
2021-03-14 09:24:50 aggin joins (~ecm@103.88.87.37)
2021-03-14 09:26:42 <curiousgay> size of pointer is larger than size of char, but struct needs all elements to be of the same size
2021-03-14 09:26:59 <ephemient> no, struct does not. but it does require alignment
2021-03-14 09:27:11 <ephemient> that's not quite how it works in Haskell runtime either, it's actually worse
2021-03-14 09:28:18 <ADG1089__> what are phantom types?
2021-03-14 09:28:36 <mikoto-chan> https://dpaste.com/2BWJF66FX
2021-03-14 09:28:46 <mikoto-chan> Hmmm ... this was what I meant last time
2021-03-14 09:28:48 <curiousgay> if strings in Haskell would be arrays from the beginning, I guess that would prevent list comprehensions to work on them
2021-03-14 09:29:05 <mikoto-chan> I tried to install a package globally to test a library but no GHCi doesn't work
2021-03-14 09:29:33 × geowiesnot_bis quits (~user@87-89-181-157.abo.bbox.fr) (Ping timeout: 260 seconds)
2021-03-14 09:30:21 <Rembane> curiousgay: But then Haskell could have array comprehensions, just like Python does.
2021-03-14 09:30:21 heatsink joins (~heatsink@2600:1700:bef1:5e10:408f:2dd3:6494:affd)
2021-03-14 09:30:25 <ephemient> curiousgay: closer to `union List { struct { int tag; void *head; union List *tail; } cons; struct { int tag; } nil; }`, where head points to *another* heap object that would be a Char in the case of String, plus a few other ways to represent thunks etc.
2021-03-14 09:31:01 × ADG1089__ quits (~aditya@106.212.74.137) (Remote host closed the connection)
2021-03-14 09:31:06 <curiousgay> guh
2021-03-14 09:31:37 jamm_ joins (~jamm@unaffiliated/jamm)
2021-03-14 09:32:13 <ephemient> curiousgay: can you think of a way to make Array structurally lazy? IMO that's the most important part of List - not its use as a data structure, although that's convenient, but using it to build control flow
2021-03-14 09:32:31 asicia joins (~asdfasdfa@86.100.110.212)
2021-03-14 09:33:09 <ephemient> and Haskell 98 does have arrays, they're just not convenient to use
2021-03-14 09:34:18 <ephemient> well that and they were still boxed, so you're saving the cost of the cons cells but the chars are still on the heap... we do have multiple packed text types now though
2021-03-14 09:34:26 × bwe_ quits (~bwe@2a01:4f8:1c1c:4878::2) (Quit: leaving)
2021-03-14 09:34:35 × heatsink quits (~heatsink@2600:1700:bef1:5e10:408f:2dd3:6494:affd) (Ping timeout: 240 seconds)
2021-03-14 09:34:37 <curiousgay> ephemient: that's really hard, I'm learning Haskell (beginner), I'm not even sure Go's proverb "make zero value useful" will help here
2021-03-14 09:35:30 × Franciman quits (~francesco@host-82-49-79-189.retail.telecomitalia.it) (Quit: Leaving)
2021-03-14 09:35:30 <curiousgay> nah, that proverb is inadequate here
2021-03-14 09:37:28 <asicia> I'm trying to solve an exercise that asks me to create a function that generates infinate fibonacci sequence only using list comprehension - fib :: [Integer]. I'm assuming creating an inlined recursive function with `where` would be cheating. Any tips for possible strategies?
2021-03-14 09:38:15 <asicia> I've been thinking about this for a few hours, but can't come up with anything
2021-03-14 09:39:03 Varis joins (~Tadas@unaffiliated/varis)
2021-03-14 09:39:38 <tomsmeding> > let fib = 1 : 1 : zipWith (+) fib (tail fib) in take 20 fib
2021-03-14 09:39:40 <lambdabot> [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765]
2021-03-14 09:39:45 bwe joins (~bwe@unaffiliated/bwe)
2021-03-14 09:39:58 <tomsmeding> asicia: not a list comprehension, but this is a "standard" trick; maybe you can get inspiration from it?
2021-03-14 09:40:09 <asicia> thanks, i will try
2021-03-14 09:40:11 <tomsmeding> or perhaps they're asking for something different, I don't know
2021-03-14 09:40:45 × aggin quits (~ecm@103.88.87.37) (Quit: WeeChat 3.0.1)
2021-03-14 09:40:56 <Rembane> asicia: Are you only allowed to use a list comprehension, nothing else at all?
2021-03-14 09:41:06 <asicia> the author did mention zip and tail in the tips section
2021-03-14 09:42:13 <tomsmeding> ah yes, that sounds like a variation on the version I showed
2021-03-14 09:42:33 <asicia> great, i will try to crack it somehow
2021-03-14 09:42:44 <curiousgay> ephemient: well, I think for lazyness internal representation of array needs to be realloc'ed (twice amount of its previous size, I remember seeing that in Go's internal implementation of slices) and there needs to be an integer that will increment by 1 each time a new element is calculated, however this needs adjustments for concurrent needs
2021-03-14 09:42:52 <Rembane> tomsmeding: But how? A list comprehension is kinda flat, and unrecursive to its nature, or have I missed something here?
2021-03-14 09:43:11 hackage Decimal 0.5.2 - Decimal numbers with variable precision https://hackage.haskell.org/package/Decimal-0.5.2 (PaulJohnson)
2021-03-14 09:43:44 <tomsmeding> > [x | let x = 42] -- Rembane
2021-03-14 09:43:46 <lambdabot> [42]
2021-03-14 09:43:50 <tomsmeding> ¯\_(ツ)_/¯
2021-03-14 09:44:10 <tomsmeding> but, like, if the teacher suggests using zip and tail
2021-03-14 09:44:17 <ephemient> > [round (((1 + sqrt 5) / 2) ^ i - ((1 - sqrt 5) / 2) ^ i) / sqrt 5 | i <- [0..]] -- I'm certain this is not what they want... it gets inaccurate too
2021-03-14 09:44:19 <lambdabot> error:
2021-03-14 09:44:19 <lambdabot> • Ambiguous type variable ‘a0’ arising from a use of ‘show_M197298689765...
2021-03-14 09:44:19 <lambdabot> prevents the constraint ‘(Show a0)’ from being solved.
2021-03-14 09:44:26 <Rembane> tomsmeding: That's true, but it feels like cheating. :)
2021-03-14 09:44:32 <tomsmeding> Rembane: yes lol
2021-03-14 09:44:41 <Rembane> ephemient: Is that the closed form of the Fibonacci series?
2021-03-14 09:44:44 <curiousgay> Rembane: I don't know what Python actually has, when I told on interview I used two-dimentional array to represent a plane they asked me "what is that?" and they didn't understand my explanations because I didn't bother saying "list of lists"
2021-03-14 09:44:55 <ephemient> Rembane, one of the closed forms yes
2021-03-14 09:44:58 <tomsmeding> ephemient: can remobe that ((1 - sqrt 5) / 2) ^ i term if you're rounding
2021-03-14 09:45:03 × malumore quits (~malumore@151.62.115.237) (Ping timeout: 245 seconds)
2021-03-14 09:45:11 <tomsmeding> Rembane: Binet's formula
2021-03-14 09:45:30 <Rembane> curiousgay: It has list comprehensions, but in Python a list is an array. [x*2 for x in range(10)] <- how to double some numbers in an array in Python using a list comprehension.
2021-03-14 09:45:49 <Rembane> ephemient, tomsmeding: It's beautiful and absolutely horrible at the same time. :)
2021-03-14 09:46:33 <ephemient> tomsmeding: you're right, just round works. I thought I needed it for the 0th case, but forgot that / sqrt 5 brings the error down small enough
2021-03-14 09:46:41 hackage instana-haskell-trace-sdk 0.6.2.0 - SDK for adding custom Instana tracing support to Haskell applications. https://hackage.haskell.org/package/instana-haskell-trace-sdk-0.6.2.0 (basti1302)
2021-03-14 09:46:51 <ephemient> the matrix multiplication form can be done accurately at least
2021-03-14 09:48:33 MoeEl joins (62a7e21a@ip98-167-226-26.ph.ph.cox.net)
2021-03-14 09:48:40 <tomsmeding> > map snd (iterate (\(a,b) -> (b,a+b)) (0,1))

All times are in UTC.