Logs: liberachat/#haskell
| 2021-08-03 11:43:56 | × | mastarija_ quits (~mastarija@31.217.8.174) (Ping timeout: 252 seconds) |
| 2021-08-03 11:44:15 | → | mastarija joins (~mastarija@78-3-212-215.adsl.net.t-com.hr) |
| 2021-08-03 11:44:37 | → | azeem joins (~azeem@dynamic-adsl-94-34-48-122.clienti.tiscali.it) |
| 2021-08-03 11:46:26 | × | mastarija__ quits (~mastarija@31.217.16.231) (Ping timeout: 256 seconds) |
| 2021-08-03 11:46:59 | <merijn> | Somewhat relatedly |
| 2021-08-03 11:47:17 | × | dschrempf quits (~dominik@070-207.dynamic.dsl.fonira.net) (Quit: WeeChat 3.2) |
| 2021-08-03 11:47:33 | <merijn> | Is there a way to allow people to pattern match on a constructor, without letting them create their own values? I guess some pattern synonym hackery would allow that |
| 2021-08-03 11:49:38 | <hpc> | probably yeah |
| 2021-08-03 11:50:06 | <hpc> | or pattern guards or view patterns would be better |
| 2021-08-03 11:50:42 | <merijn> | Not really in this case |
| 2021-08-03 11:50:58 | → | timCF joins (~timCF@200-149-20-81.sta.estpak.ee) |
| 2021-08-03 11:52:25 | → | Obo joins (~roberto@70.pool90-171-81.dynamic.orange.es) |
| 2021-08-03 11:52:35 | <merijn> | Basically, I'm trying to put our dynamically typed exceptions everyone forgets into practice, but I wanna prevent people from people (accidentally or intentionally) inserting their exception into my part of the hierarchy :p |
| 2021-08-03 11:53:26 | <dminuoso> | merijn: You could also present it via some form of scott encoding (i.e. via its case-of expression) |
| 2021-08-03 11:54:00 | <merijn> | dminuoso: hmm? |
| 2021-08-03 11:55:27 | <timCF> | Hello! I have a huge Haskell source code file generated by `proto-lens-protoc` protobuf plugin from very big Google Protobuf document. The size of resulting Haskell file is something around 3MB. And I did found out that GHC 8.6.5 fails to compile this file on relatively weak laptops (8GB RAM) with default settings. But it compiles quite ok on machines with bigger RAM capacity. What can you suggest to |
| 2021-08-03 11:55:31 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
| 2021-08-03 11:55:33 | <timCF> | workaround this issue? Maybe there are some magical GHC flags to reduce RAM consumption? Or I should just invest into GHC upgrade in my project? |
| 2021-08-03 11:55:59 | <dminuoso> | Invest into more RAM? :-p |
| 2021-08-03 11:56:05 | <merijn> | That, yes :p |
| 2021-08-03 11:56:10 | <timCF> | Haha :) |
| 2021-08-03 11:56:30 | <merijn> | Or patch proto-lens-protoc to produce more GHC friendly output |
| 2021-08-03 11:56:59 | <merijn> | There's work on optimising GHCs memory usage/compile times, but that's hard work and will take a while to actually improve things (and only in newer GHCs) |
| 2021-08-03 11:57:30 | <merijn> | So "buy more RAM" and "change the generated code" are the only really short-term options you have |
| 2021-08-03 11:57:54 | × | peterhil quits (~peterhil@dsl-hkibng32-54fb52-57.dhcp.inet.fi) (Ping timeout: 272 seconds) |
| 2021-08-03 11:58:12 | <timCF> | Do you remember significant improvements on RAM consumption with GHC 9 upgrade? I just didn't tried latest versions of compiler. Is it better? |
| 2021-08-03 11:58:26 | <merijn> | I can't remember, because I'm still using 8.10 :p |
| 2021-08-03 11:58:53 | × | Atum_ quits (IRC@user/atum/x-2392232) (Ping timeout: 258 seconds) |
| 2021-08-03 11:59:06 | <timCF> | Well, things like compilers usually are getting better over time :) |
| 2021-08-03 11:59:09 | <hpc> | i like the technical correctness of saying "i can't remember" about something that hasn't happened yet |
| 2021-08-03 11:59:15 | <dminuoso> | GHC hasn't really received any updates recently that majorly change how many resources it consumes. |
| 2021-08-03 11:59:20 | <dminuoso> | Aside from bug fixes of course |
| 2021-08-03 11:59:53 | <merijn> | hpc: Technically correct is the best kind of correct :p |
| 2021-08-03 12:01:59 | <merijn> | ugh |
| 2021-08-03 12:02:10 | <merijn> | Is there any hope Hackage will support multiple public libraries soon? >.< |
| 2021-08-03 12:02:43 | × | curiousgay quits (~curiousga@77-120-186-48.kha.volia.net) (Ping timeout: 258 seconds) |
| 2021-08-03 12:04:23 | → | peterhil joins (~peterhil@dsl-hkibng32-54fb52-57.dhcp.inet.fi) |
| 2021-08-03 12:05:46 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-03 12:06:17 | → | Pickchea joins (~private@user/pickchea) |
| 2021-08-03 12:06:51 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-03 12:11:36 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 276 seconds) |
| 2021-08-03 12:12:27 | <merijn> | What's the cheapest concurrent append operation? I guess IORef with atomicModifyIORef? |
| 2021-08-03 12:14:42 | → | burnside_ joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-03 12:14:42 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Read error: Connection reset by peer) |
| 2021-08-03 12:17:37 | → | nicklaf joins (~nick@c-73-231-202-254.hsd1.ca.comcast.net) |
| 2021-08-03 12:17:41 | → | drd joins (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) |
| 2021-08-03 12:17:59 | ← | nicklaf parts (~nick@c-73-231-202-254.hsd1.ca.comcast.net) () |
| 2021-08-03 12:24:11 | → | solirc joins (~solirc@119.42.116.126) |
| 2021-08-03 12:24:24 | × | anandprabhu quits (~anandprab@94.202.243.198) (Quit: Leaving) |
| 2021-08-03 12:25:41 | → | xsperry joins (~as@user/xsperry) |
| 2021-08-03 12:29:42 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 2021-08-03 12:35:35 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-08-03 12:36:01 | → | aman joins (~aman@user/aman) |
| 2021-08-03 12:36:45 | → | sub0 joins (~bc8150b8@217.29.117.252) |
| 2021-08-03 12:37:26 | → | futty joins (~futty@c83-252-75-55.bredband.tele2.se) |
| 2021-08-03 12:40:16 | <futty> | In the book Learn You A Haskell at chapter 4, there are two consecutive examples of recursion. The two type signatures are length' :: (Num b) => [a] -> b AND sum' :: (Num a) => [a] -> a. a and b are polymorphic type variables but how do I know where to use a and where to use b? |
| 2021-08-03 12:40:44 | <merijn> | futty: What do you mean? |
| 2021-08-03 12:41:59 | <futty> | I mean the two polymorphic variables are different. In the first one, b is used. In the second a is used all the way. Can I for example write length' :: (Num a) => [a] -> a in the first one? I dont really grasp that concept. |
| 2021-08-03 12:42:38 | <merijn> | futty: The actual letters don't matter, except that within a single type all occurences of that letter are the same type |
| 2021-08-03 12:42:57 | <merijn> | futty: So your new length example can only count lengths of list that have the same elements as the result |
| 2021-08-03 12:44:12 | → | neceve joins (~quassel@2a02:c7f:607e:d600:f762:20dd:304e:4b1f) |
| 2021-08-03 12:44:17 | <merijn> | "length' :: Num a => [a] -> a" effectively says "I can compute the length of a list of 'a's and produce a resulting 'a', as long as 'a' is an instance of Num", this means you *can't* compute the length of, say, [Char], because Char is not an instance of Num |
| 2021-08-03 12:44:25 | × | Vajb quits (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) (Read error: Connection reset by peer) |
| 2021-08-03 12:44:30 | × | jippiedoe quits (~david@77-171-152-62.fixed.kpn.net) (Ping timeout: 258 seconds) |
| 2021-08-03 12:44:58 | → | fendor_ joins (~fendor@77.119.205.218.wireless.dyn.drei.com) |
| 2021-08-03 12:45:02 | <merijn> | futty: In the original version we're computing the length of a list of 'b's (whatever 'b' may be) and produce a result that can be any 'a' that is a Num instance |
| 2021-08-03 12:45:05 | <futty> | ah, so in length' :: (Num b) => [a] -> b, a can be of type String and the output is an Int. In the sum' :: (Num a) => [a] -> a., a MUST be of type Int because there is no other way? |
| 2021-08-03 12:45:19 | <dminuoso> | futty: A type variable is something the *consumer/caller/user* can/must chose a type for. |
| 2021-08-03 12:45:20 | <merijn> | futty: Well, it could be Double too :p |
| 2021-08-03 12:45:24 | <merijn> | futty: But yes |
| 2021-08-03 12:45:36 | <futty> | Yes. I understand now. Thank you, grateful. |
| 2021-08-03 12:46:16 | → | jao joins (jao@gateway/vpn/protonvpn/jao) |
| 2021-08-03 12:46:46 | <merijn> | futty: Distinct type variables (may!) have different types, but identical type variables (within a signature) all refer to the exact same type |
| 2021-08-03 12:46:47 | × | mastarija quits (~mastarija@78-3-212-215.adsl.net.t-com.hr) (Ping timeout: 245 seconds) |
| 2021-08-03 12:47:04 | <futty> | Got it. |
| 2021-08-03 12:47:29 | <merijn> | futty: So in case of '[b] -> a' we can pick 'b = Char' and 'a = int', but note that 'b = Int' and 'a = Int' is also valid, so they don't *have* to be different |
| 2021-08-03 12:47:35 | → | dschrempf joins (~dominik@070-207.dynamic.dsl.fonira.net) |
| 2021-08-03 12:47:38 | × | fendor quits (~fendor@178.115.48.162.wireless.dyn.drei.com) (Ping timeout: 256 seconds) |
| 2021-08-03 12:48:45 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) |
| 2021-08-03 12:49:01 | <futty> | I was so confused, thank you |
| 2021-08-03 12:49:56 | <merijn> | Note that LYAH is a nice "here's some cool examples" book, but generally not considered all that good at teaching you how to actually write Haskell |
| 2021-08-03 12:52:07 | <merijn> | Graham Hutton's "Programming in Haskell", Richard Bird's "Thinking Functionally with Haskell", and Julie Moronuki & Chris Allen's "Haskell from First Principles" are generally considered better introduction to teach actually programming in Haskell |
| 2021-08-03 12:52:17 | <merijn> | @where cis194 |
| 2021-08-03 12:52:17 | <lambdabot> | https://www.seas.upenn.edu/~cis194/spring13/lectures.html |
| 2021-08-03 12:52:21 | <merijn> | @where exercises |
| 2021-08-03 12:52:21 | <lambdabot> | http://www.haskell.org/haskellwiki/H-99:_Ninety-Nine_Haskell_Problems https://github.com/bitemyapp/learnhaskell http://www.reddit.com/r/dailyprogrammer/ http://www.reddit.com/r/programmingchallenges/ |
| 2021-08-03 12:52:30 | <merijn> | Are also some good pointers |
| 2021-08-03 12:54:00 | × | jneira quits (~jneira@212.8.115.226) (Quit: Client closed) |
| 2021-08-03 12:55:11 | <futty> | I actually tried to begin with Haskell from First Principles long ago but my computer science course at university uses LYAH. I got a re-exam and try to remember first by course resources. Then I'll read Haskell from First Principles. |
| 2021-08-03 13:00:23 | × | Melantha quits (~pyon@user/pyon) (Ping timeout: 252 seconds) |
| 2021-08-03 13:01:07 | → | alx741 joins (~alx741@181.196.69.121) |
| 2021-08-03 13:02:11 | → | Melantha joins (~pyon@user/pyon) |
| 2021-08-03 13:06:42 | → | favonia joins (~favonia@user/favonia) |
| 2021-08-03 13:12:49 | → | pbrisbin joins (~patrick@pool-108-52-124-197.phlapa.fios.verizon.net) |
| 2021-08-03 13:12:56 | × | qbt quits (~edun@user/edun) (Quit: Leaving) |
| 2021-08-03 13:14:34 | × | mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 240 seconds) |
| 2021-08-03 13:17:43 | → | Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) |
| 2021-08-03 13:19:33 | × | dschrempf quits (~dominik@070-207.dynamic.dsl.fonira.net) (Quit: WeeChat 3.2) |
| 2021-08-03 13:20:38 | → | mastarija joins (~mastarija@78-3-212-215.adsl.net.t-com.hr) |
| 2021-08-03 13:20:57 | → | haskell-lurkmore joins (~haskell-l@78.155.54.115) |
All times are in UTC.