Logs: liberachat/#haskell
| 2021-08-10 22:16:36 | <janus> | > read (cycle "1") :: Int |
| 2021-08-10 22:16:42 | <lambdabot> | mueval-core: Time limit exceeded |
| 2021-08-10 22:16:49 | <glguy> | Aww, I thought it might work that time |
| 2021-08-10 22:16:56 | <janus> | ah right, thanks dsal! |
| 2021-08-10 22:16:58 | <glguy> | >_> |
| 2021-08-10 22:17:38 | <janus> | glguy: sarcastic? i tried it because Integer allows for infinite size, i thought. so it would make more sense to show for Int |
| 2021-08-10 22:17:58 | <glguy> | janus: yeah, </s> ; of course it can't work for either |
| 2021-08-10 22:18:40 | <janus> | what is the "obvious" reason you're referring to here? because it isn't readMaybe? or because everybody is presumed to know how it works internally? |
| 2021-08-10 22:18:52 | <glguy> | the only thing it can do is fail |
| 2021-08-10 22:19:33 | <glguy> | It certainly can't produce an Int |
| 2021-08-10 22:19:36 | <janus> | but a granular exception would be better than time limit exceeded. there are many ways of failing even in haskell |
| 2021-08-10 22:22:36 | <monochrom> | "integer allows for infinite size" is a misconception. Subtle, yes, but it will bite you one day. |
| 2021-08-10 22:23:21 | × | Tuplanolla quits (~Tuplanoll@91-159-69-50.elisa-laajakaista.fi) (Quit: Leaving.) |
| 2021-08-10 22:23:35 | <monochrom> | There is a difference between "infinitely many possibilities" and "one such possibility is infinite in any sense at all" |
| 2021-08-10 22:24:12 | <monochrom> | Every integer has finite size. We just don't have one single upper bound that caps over all integers. |
| 2021-08-10 22:24:44 | × | michalz quits (~michalz@185.246.204.61) (Remote host closed the connection) |
| 2021-08-10 22:24:51 | <glguy> | even if Integer had a value called "Infinity", read couldn't know to return it given (cycle "1") |
| 2021-08-10 22:25:15 | <dsal> | > read (cycle "0") :: Integer |
| 2021-08-10 22:25:21 | <lambdabot> | mueval-core: Time limit exceeded |
| 2021-08-10 22:25:22 | <dsal> | Be smarter, Haskell! |
| 2021-08-10 22:25:26 | <glguy> | > read "100000000000000000000" :: Int |
| 2021-08-10 22:25:27 | <lambdabot> | 7766279631452241920 |
| 2021-08-10 22:25:29 | <monochrom> | For the same reason I prefer to describe the Turing machine tape size as "as much as you actually use, on demand" rather than "infinite". You will never actually use infinitely many cells. Never. |
| 2021-08-10 22:25:53 | <glguy> | and as long as modular behavior is allowed there the behavior of read (cycle "1") :: Int could never sanely be anything other than a timeout |
| 2021-08-10 22:26:18 | <janus> | can i say "unbounded" instead of "as much as you can actually use, on demand" ? |
| 2021-08-10 22:26:23 | <oak-> | > read "1000000000000000000000000000000000000000000000000" :: Integer |
| 2021-08-10 22:26:25 | <lambdabot> | 1000000000000000000000000000000000000000000000000 |
| 2021-08-10 22:26:44 | <monochrom> | Yes "unbounded" is right. |
| 2021-08-10 22:27:14 | <dsal> | Bounded only by your computer's imagination. |
| 2021-08-10 22:27:55 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-10 22:30:10 | <monochrom> | Statically determining semantic properties of "read (cycle "1")" is a very involved static analysis problem. |
| 2021-08-10 22:31:21 | <monochrom> | Or rather, the real question hiding behind the proxy question "I just need the computer to be just smart enough for that one single example" is. |
| 2021-08-10 22:31:35 | <monochrom> | No one really ever just means wanting just one example solved. |
| 2021-08-10 22:32:07 | → | allbery_b joins (~geekosaur@xmonad/geekosaur) |
| 2021-08-10 22:32:07 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b))) |
| 2021-08-10 22:32:10 | allbery_b | is now known as geekosaur |
| 2021-08-10 22:32:19 | <monochrom> | It is a long-running meme. |
| 2021-08-10 22:32:55 | <monochrom> | When programmer has just a specific, special-case problem in mind, they must ask the generalized question. |
| 2021-08-10 22:32:59 | <janus> | i am really more worried about DoS attacks if i use 'read' on something i got from the network |
| 2021-08-10 22:33:14 | <monochrom> | And when they have a general problem in mind, they must just ask one example. |
| 2021-08-10 22:33:33 | <monochrom> | It is like their brain actually knows the right question, then pass it through a not-gate. |
| 2021-08-10 22:33:56 | <hpc> | or like they can only consciously think in terms of examples? |
| 2021-08-10 22:34:01 | <geekosaur> | janus, that's only an issue if you got something infinite from the network |
| 2021-08-10 22:34:10 | <geekosaur> | which would be difficult |
| 2021-08-10 22:34:26 | × | xcmw quits (~textual@2603-6011-2200-f103-402c-0cc9-e9a3-e4f0.res6.spectrum.com) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-08-10 22:34:32 | <geekosaur> | how would you store it to feed it to read? |
| 2021-08-10 22:34:39 | <monochrom> | You are actively inviting DoS in the first place the moment you say you accept as many bytes as the other side sends you. |
| 2021-08-10 22:34:53 | <deejaytee> | monochrom: this is what blows me away with GHC, sometimes you turn on the right language extensions and it just solves a specific case, and I'm sitting there knowing that that must mean it solves it in the general case (for some loose definition of general), while I struggle to formulate & solve even a specific example |
| 2021-08-10 22:35:42 | <deejaytee> | I'm half-convinced that GHC might just end up being the first program to spontaneously gain sentience |
| 2021-08-10 22:35:42 | × | Atum_ quits (~IRC@user/atum/x-2392232) (Remote host closed the connection) |
| 2021-08-10 22:35:48 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds) |
| 2021-08-10 22:35:59 | → | Atum_ joins (~IRC@user/atum/x-2392232) |
| 2021-08-10 22:36:01 | <deejaytee> | {-# LANGUAGE GeneralArtificialIntelligence #-} |
| 2021-08-10 22:36:05 | <janus> | geekosaur: ok, let's say i have a receive limit of 100 kibibytes. is it safe to use Read? i am not trying to determine anything about infinities. i am trying to determine whether Read is a problem for non-streaming applications with normal message sizes and parsing untrusted data |
| 2021-08-10 22:36:26 | <monochrom> | hpc, I refuse to believe that programmers only think in terms of examples. Last time I checked they spoke like "hi how do I debug type errors?" in its most generality when they already had one single example, "f x = x ++ [x]" |
| 2021-08-10 22:37:00 | <deejaytee> | ah, shoot, I forgot to include {-# LANGUAGE SelfAwareAndSentient #-} |
| 2021-08-10 22:37:40 | <monochrom> | If you paid me 1 cent every time an asker here doesn't put their actual code on a paste bin, I would be rich and could retire now. |
| 2021-08-10 22:37:53 | <hpc> | when that happens to me at work i link them to https://youtu.be/ZKxr0wyIic4?t=10 :D |
| 2021-08-10 22:37:55 | <deejaytee> | (admittedly I have limited experience with proof systems, I'm sure there are stronger candidates for "smart programs that infer things I cannot") |
| 2021-08-10 22:38:14 | <monochrom> | Heh |
| 2021-08-10 22:38:23 | <monochrom> | We need to say that more to askers. |
| 2021-08-10 22:38:23 | <deejaytee> | hpc: hehe |
| 2021-08-10 22:38:25 | × | acidjnk_new quits (~acidjnk@p200300d0c72b9574c56a490b8c03a837.dip0.t-ipconnect.de) (Ping timeout: 258 seconds) |
| 2021-08-10 22:39:16 | <monochrom> | As it happens, I am giving a network socket assignment to my students in a unix-and-C course. |
| 2021-08-10 22:39:43 | <monochrom> | And I provide the exes of some good and bad the-other-side's for them to test against. |
| 2021-08-10 22:40:15 | <monochrom> | One of the bad ones guarantees to send you a message of "many, many bytes". |
| 2021-08-10 22:40:23 | <hpc> | hah, awesome |
| 2021-08-10 22:40:25 | <geekosaur> | janus, I think read is safe there. that said, I wouldn't use it because it's not very good at what it does |
| 2021-08-10 22:40:39 | <monochrom> | And by that I mean it simply doesn't end, it keeps sending more and more packets. |
| 2021-08-10 22:41:15 | <monochrom> | You know, just in case a student deludes themselves into thinking that "640GB ought to be enough for everyone". |
| 2021-08-10 22:41:57 | <monochrom> | Oh even the good ones are juicy. |
| 2021-08-10 22:43:05 | <monochrom> | To drive home the point that stream sockets lose packet boundaries, the good ones fragment one message into randomly many write()'s, and even merge two messages into one single write(). |
| 2021-08-10 22:43:47 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds) |
| 2021-08-10 22:43:55 | <glguy> | monochrom: What's the actual assignment (roughly)? |
| 2021-08-10 22:44:49 | <monochrom> | I'll tell the tldr after this URL to the whole thing: http://www.cs.utoronto.ca/~trebla/CSCB09-2021-Summer/a4/ |
| 2021-08-10 22:45:09 | <geekosaur> | janus, it's convenient but slow and wasteful, and you almost certainly don't need its full generality. and haskell makes it almost trivial to write parsers that work better |
| 2021-08-10 22:45:11 | <monochrom> | The student is to write one server and one client for the same protocol. |
| 2021-08-10 22:45:16 | → | bitmapper joins (uid464869@id-464869.tooting.irccloud.com) |
| 2021-08-10 22:45:44 | <monochrom> | The protocol is newline-delimited messages, with known upper bounds on legal messages. |
| 2021-08-10 22:46:02 | × | forell_ quits (~forell@host-178-216-90-220.sta.tvknaszapraca.pl) (Changing host) |
| 2021-08-10 22:46:02 | → | forell_ joins (~forell@user/forell) |
| 2021-08-10 22:46:07 | forell_ | is now known as forell |
| 2021-08-10 22:47:03 | <monochrom> | The server side is to receive a name, look up a phone number from a file it can access, then send the phone number. |
| 2021-08-10 22:48:05 | <hpc> | random thought: a good follow-up assignment would be to have them implement all the test case clients |
| 2021-08-10 22:48:08 | <hpc> | including the bad ones |
| 2021-08-10 22:48:46 | <janus> | geekosaur: all right , thanks! |
| 2021-08-10 22:51:38 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-08-10 22:54:25 | × | finsternis quits (~X@23.226.237.192) (Remote host closed the connection) |
| 2021-08-10 22:57:24 | Meowmancer | is now known as Neuromancer |
| 2021-08-10 23:00:11 | <dsal> | > product (cycle 0) -- I actually do think this one should work |
| 2021-08-10 23:00:13 | <lambdabot> | error: |
| 2021-08-10 23:00:13 | <lambdabot> | • No instance for (Num [Integer]) arising from a use of ‘e_10’ |
| 2021-08-10 23:00:13 | <lambdabot> | • In the expression: e_10 |
| 2021-08-10 23:00:25 | <dsal> | Well, something like that. |
| 2021-08-10 23:00:56 | <monochrom> | product (repeat 0) |
| 2021-08-10 23:01:02 | <dsal> | oh. I just woke up. heh |
| 2021-08-10 23:01:33 | <dsal> | But yeah. I don't quite understand why product doesn't short circuit. That one exact simple case I'm thinking of. |
| 2021-08-10 23:01:42 | <monochrom> | Our standard (*) is defined to be very strict. To be sure, it is just someone's decision, not the only good one. |
| 2021-08-10 23:02:48 | <dsal> | I don't know that it's ever affected me. I just feel smarter than my computer when I see that and I don't like speaking so poorly of computers. |
| 2021-08-10 23:02:52 | × | Atum_ quits (~IRC@user/atum/x-2392232) (Remote host closed the connection) |
All times are in UTC.