Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 737 738 739 740 741 742 743 744 745 746 747 .. 5022
502,152 events total
2020-10-19 18:38:36 <koz_> A statement like '@[] is a single item list' is _precisely_ mixing the type and value level. TypeApplications is about types. Single-item lists is about values.
2020-10-19 18:38:41 <crestfallen> I don't know what it means to have the ((*),(+)) ascribed to defining pure to work on a list
2020-10-19 18:38:54 <koz_> ((*), (+)) is a value.
2020-10-19 18:39:00 <koz_> It is, more specifically, a pair of functions.
2020-10-19 18:39:08 bartemius joins (~bartemius@109-252-19-142.nat.spd-mgts.ru)
2020-10-19 18:39:11 <koz_> You could do 'pure ((*), (+))' just fine.
2020-10-19 18:39:14 <crestfallen> but those aren't my notes. that is from SO or someplace
2020-10-19 18:39:30 <koz_> crestfallen: Your reading of said notes is what I take issue with.
2020-10-19 18:39:39 <koz_> Let's clearly separate what's going on here.
2020-10-19 18:39:41 <monochrom> This is why I don't use SO.
2020-10-19 18:39:56 <koz_> Does the concept of ((+), (*)), on its own, make sense to you?
2020-10-19 18:39:57 <monochrom> I know first-hand that SO contains wrong answers.
2020-10-19 18:40:05 <koz_> Like, a pair of functions?
2020-10-19 18:40:26 <monochrom> Granted, the example I know is about C and stdio, not Haskell.
2020-10-19 18:40:27 <crestfallen> I'm only certain they are not my notes.
2020-10-19 18:40:45 × ystael quits (~ystael@209.6.50.55) (Ping timeout: 240 seconds)
2020-10-19 18:40:50 <koz_> monochrom: C has a lot of misconceptions about it everywhere. SO just amplifies this.
2020-10-19 18:41:01 <geekosaur> that doesn't necessarily mean (a) they are correct (b) you have understood them
2020-10-19 18:41:24 <monochrom> heh
2020-10-19 18:41:30 <koz_> And in this case, from where I'm standing, it's an issue of (b).
2020-10-19 18:41:51 <monochrom> But this one is more about stdio than C. C is "involved" because stdio is a C library.
2020-10-19 18:42:36 <monochrom> So I gave this midterm question "how to detect whether stdin has hit EOF?" I have a lecture slide that has the answer very visiblly.
2020-10-19 18:43:01 <monochrom> My students decided to look up SO instead. This being COVID online exam and all.
2020-10-19 18:43:04 × knupfer quits (~Thunderbi@200116b82c450700d1249839d4a442f4.dip.versatel-1u1.de) (Ping timeout: 244 seconds)
2020-10-19 18:43:29 <monochrom> The SO answer is "fseek to end, ask ftell if the offset is 0"
2020-10-19 18:44:10 <geekosaur> "…not even wrong…"
2020-10-19 18:45:10 <hyperisco> well I just implemented that as (hGetChar hout $> True) `catchIOError` \_ → pure False so I hope I'm right lol
2020-10-19 18:45:34 <monochrom> I think Haskell's hIsEOF does that for you.
2020-10-19 18:46:12 <crestfallen> koz_: I'd appreciate some review re: " Does the concept of ((+), (*)), on its own, make sense to you?
2020-10-19 18:46:21 <hyperisco> ah I guess slightly different… I also want to discard everything
2020-10-19 18:46:31 <hyperisco> I am doing that in a loop until False
2020-10-19 18:46:43 <koz_> OK, so, are you OK with, say (1, "foo") as a value?
2020-10-19 18:46:57 <crestfallen> sure
2020-10-19 18:47:10 <monochrom> But please don't put the catch-and-handler inside the loop. Put that outside.
2020-10-19 18:47:49 <hyperisco> I see what you're saying but I've removed exceptions from my control-flow thinking lol
2020-10-19 18:48:01 AceNovo joins (~chris@184.101.162.142)
2020-10-19 18:50:50 bifunc2 joins (bifunc2@gateway/vpn/protonvpn/bifunc2)
2020-10-19 18:50:57 <bifunc2> fendor thanks :)
2020-10-19 18:51:01 <koz_> crestfallen: What is the type of (1, "foo")?
2020-10-19 18:51:18 × recon_- quits (~quassel@208.87.96.9) (Ping timeout: 272 seconds)
2020-10-19 18:51:42 × gioyik quits (~gioyik@190.67.155.46) (Ping timeout: 256 seconds)
2020-10-19 18:51:56 × bifunc2 quits (bifunc2@gateway/vpn/protonvpn/bifunc2) (Client Quit)
2020-10-19 18:52:09 <hyperisco> forever (hGetChar hout) `catchIOError` mempty -- für monochrom
2020-10-19 18:52:21 <monochrom> Yeah
2020-10-19 18:52:48 <crestfallen> (1, "foo") :: Num a => (a, [Char])
2020-10-19 18:52:49 son0p joins (~son0p@181.136.122.143)
2020-10-19 18:53:16 <koz_> OK. Now, what's the type of (+) and the type of (*)?
2020-10-19 18:53:28 <hyperisco> in some languages (like JS I think) there is no operational cost to try/catch unless an exception is actually caught
2020-10-19 18:53:40 × Franciman quits (~francesco@host-82-48-166-25.retail.telecomitalia.it) (Quit: Leaving)
2020-10-19 18:54:07 <hyperisco> so I guess the only other reason is removing the redundancy by accepting exceptional control flow
2020-10-19 18:54:29 × s00pcan quits (~chris@075-133-056-178.res.spectrum.com) (Ping timeout: 260 seconds)
2020-10-19 18:54:41 <crestfallen> I see where it's going. pure @[] is ascribing List to the type of (a1 -> a1 -> a1, a2 -> a2 -> a2) , giving us ...
2020-10-19 18:54:51 <crestfallen> [(a1 -> a1 -> a1, a2 -> a2 -> a2]
2020-10-19 18:55:20 <crestfallen> oops
2020-10-19 18:55:33 <crestfallen> [(a1 -> a1 -> a1, a2 -> a2 -> a2)]
2020-10-19 18:56:19 s00pcan joins (~chris@107.181.165.217)
2020-10-19 18:56:22 <monochrom> Err nevermind, you're right, this one doesn't matter.
2020-10-19 18:56:43 lep-delete joins (~lep@94.31.83.149)
2020-10-19 18:56:54 <monochrom> I wrongly had in mind "p = ... `catch` (\x -> ... p)"
2020-10-19 18:57:42 Lord_of_Life_ joins (~Lord@46.217.196.111)
2020-10-19 18:57:50 × ephemera_ quits (~E@122.34.1.187) (Remote host closed the connection)
2020-10-19 18:58:01 × bartemius quits (~bartemius@109-252-19-142.nat.spd-mgts.ru) (Remote host closed the connection)
2020-10-19 18:58:06 <crestfallen> so the exercise is to set that up in ghci. so koz_ could you show me how that would play out in a ghci session? (If I'm correct to this point :))
2020-10-19 18:58:16 × kritzefitz quits (~kritzefit@212.86.56.80) (Ping timeout: 272 seconds)
2020-10-19 18:58:25 × Lord_of_Life quits (~Lord@unaffiliated/lord-of-life/x-0885362) (Ping timeout: 240 seconds)
2020-10-19 18:59:12 ephemera_ joins (~E@122.34.1.187)
2020-10-19 18:59:29 <__monty__> crestfallen: Are you really asking for someone to enter something in a repl, which you could easily do yourself?
2020-10-19 18:59:37 knupfer joins (~Thunderbi@200116b82c450700441c7c862ee5eb73.dip.versatel-1u1.de)
2020-10-19 18:59:55 Lord_of_Life_ is now known as Lord_of_Life
2020-10-19 19:01:58 <__monty__> monochrom: I can't actually find an SO question that has that among the answers, they're all "use feof."
2020-10-19 19:02:38 × berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 260 seconds)
2020-10-19 19:03:23 <monochrom> OK, I worded my question wrong. A more correct wording is "stdin is empty" as in if you try to read in the future you'll get EOF.
2020-10-19 19:03:28 berberman joins (~berberman@unaffiliated/berberman)
2020-10-19 19:04:11 <monochrom> and I have the SO link my TA found when my TA marked that question, I'm finding the email now
2020-10-19 19:04:34 <crestfallen> __monty__: the exercise , wherever it came from, only shows the types, as I have it in the paste. not sure where to go from here.
2020-10-19 19:04:53 <geekosaur> :t well, that makes a little more sense then
2020-10-19 19:04:55 <lambdabot> error: parse error on input ‘,’
2020-10-19 19:05:02 <geekosaur> where did that :t come from
2020-10-19 19:05:31 <monochrom> https://stackoverflow.com/questions/36428098/c-how-to-check-if-my-input-bufferstdin-is-empty?rq=1
2020-10-19 19:07:51 lep-delete is now known as Guest88073
2020-10-19 19:08:01 × mananamenos_ quits (~mananamen@vpn238-7.vpns.upv.es) (Ping timeout: 264 seconds)
2020-10-19 19:08:34 cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd)
2020-10-19 19:08:51 ystael joins (~ystael@168.sub-174-196-209.myvzw.com)
2020-10-19 19:08:58 <crestfallen> I was trying to review pure, what it did, and this was in my notes. I understand what it is doing in this case :
2020-10-19 19:09:02 <crestfallen> λ> Just ((:) 4) <*> (pure [])
2020-10-19 19:09:02 × invaser quits (~Thunderbi@31.148.23.125) (Ping timeout: 256 seconds)
2020-10-19 19:09:21 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Client Quit)
2020-10-19 19:10:36 <crestfallen> but not the stuff about @[], how it is used
2020-10-19 19:11:06 × conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.)
2020-10-19 19:11:19 gioyik joins (~gioyik@190.67.155.46)
2020-10-19 19:12:05 × alp quits (~alp@2a01:e0a:58b:4920:dc5e:4bf0:c579:a0f6) (Ping timeout: 272 seconds)
2020-10-19 19:12:13 <hyperisco> SO is like Wikipedia with less sources
2020-10-19 19:12:43 × mirrorbird quits (~psutcliff@2a00:801:42b:7891:16b1:e53f:55b2:15e1) (Ping timeout: 272 seconds)
2020-10-19 19:12:48 <hyperisco> SO is like if Wikipedia was a concatenation of opinions
2020-10-19 19:13:26 <crestfallen> why would you set pure @[] beforehand, if you could use pure like this? :
2020-10-19 19:13:27 × ystael quits (~ystael@168.sub-174-196-209.myvzw.com) (Read error: Connection reset by peer)
2020-10-19 19:13:29 <crestfallen> λ> Just ((:) 4) <*> (pure [])
2020-10-19 19:13:49 <crestfallen> doesn't that do the same lifting?
2020-10-19 19:14:35 <geekosaur> because in this case it can infer which Applicative to use
2020-10-19 19:15:07 <geekosaur> @[] is for when it otherwise couldn't

All times are in UTC.