Logs: freenode/#haskell
| 2020-09-17 14:30:07 | → | nan` joins (~nan`@unaffiliated/nan/x-5405850) |
| 2020-09-17 14:33:03 | × | kleisli_ quits (~kleisli@2600:1700:4640:c560:68bd:9d76:dbd8:24e7) (Ping timeout: 244 seconds) |
| 2020-09-17 14:33:30 | × | aplainzetakind quits (~johndoe@captainludd.powered.by.lunarbnc.net) (Quit: Free ZNC ~ Powered by LunarBNC: https://LunarBNC.net) |
| 2020-09-17 14:34:06 | × | mmohammadi9812 quits (~mmohammad@5.238.164.128) (Ping timeout: 272 seconds) |
| 2020-09-17 14:34:32 | → | mmohammadi9812 joins (~mmohammad@5.238.164.128) |
| 2020-09-17 14:34:45 | → | jneira joins (501e65ce@gateway/web/cgi-irc/kiwiirc.com/ip.80.30.101.206) |
| 2020-09-17 14:35:01 | × | nan` quits (~nan`@unaffiliated/nan/x-5405850) (Ping timeout: 264 seconds) |
| 2020-09-17 14:35:48 | → | ddellacosta joins (~dd@86.106.121.168) |
| 2020-09-17 14:37:05 | × | shafox quits (~shafox@106.51.234.111) (Remote host closed the connection) |
| 2020-09-17 14:38:12 | → | shafox joins (~shafox@106.51.234.111) |
| 2020-09-17 14:38:13 | × | TooDifficult quits (~TooDiffic@139.59.59.230) (Quit: TooDifficult) |
| 2020-09-17 14:38:16 | → | aplainzetakind joins (~johndoe@captainludd.powered.by.lunarbnc.net) |
| 2020-09-17 14:38:47 | × | miklcct quits (quasselcor@2001:19f0:7001:5ad:5400:2ff:feb6:50d7) (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
| 2020-09-17 14:39:43 | × | cantstanya quits (~chatting@gateway/tor-sasl/cantstanya) (Ping timeout: 240 seconds) |
| 2020-09-17 14:40:37 | → | gestone joins (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) |
| 2020-09-17 14:42:17 | → | miklcct joins (quasselcor@2001:19f0:7001:5ad:5400:2ff:feb6:50d7) |
| 2020-09-17 14:43:44 | × | da39a3ee5e6b4b0d quits (~textual@2403:6200:8876:37d7:b93e:60af:b75b:c0ef) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-09-17 14:44:28 | <z0> | > 9 / (1/0) |
| 2020-09-17 14:44:31 | <lambdabot> | 0.0 |
| 2020-09-17 14:44:47 | → | shadowdao joins (~user@unaffiliated/shadowdaemon) |
| 2020-09-17 14:44:59 | <z0> | ^ can someone explain this to me? |
| 2020-09-17 14:45:07 | × | gestone quits (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) (Ping timeout: 246 seconds) |
| 2020-09-17 14:45:13 | → | cantstanya joins (~chatting@gateway/tor-sasl/cantstanya) |
| 2020-09-17 14:45:22 | <dolio> | 1/0 is infinity, and 9/infinity = 0. |
| 2020-09-17 14:46:10 | <z0> | i get the theory, but how does Haskell do this? |
| 2020-09-17 14:46:21 | <dolio> | It's IEEE754 arithmetic. |
| 2020-09-17 14:46:32 | × | mariatsji quits (~mariatsji@2a01:79d:53aa:c66c:59f2:1ee3:fe3e:b848) (Remote host closed the connection) |
| 2020-09-17 14:47:31 | × | kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection) |
| 2020-09-17 14:47:53 | <hyperisco> | so obviously 0*infinity = 9 |
| 2020-09-17 14:48:22 | <merijn> | z0: What do you mean by "how does Haskell do this?? |
| 2020-09-17 14:48:31 | <merijn> | s/??/"? |
| 2020-09-17 14:48:38 | <hyperisco> | > 0 * (1/0) |
| 2020-09-17 14:48:41 | <lambdabot> | NaN |
| 2020-09-17 14:48:58 | → | mariatsji joins (~mariatsji@2a01:79d:53aa:c66c:59f2:1ee3:fe3e:b848) |
| 2020-09-17 14:48:59 | × | cosimone quits (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) (Quit: Quit.) |
| 2020-09-17 14:49:07 | × | mariatsji quits (~mariatsji@2a01:79d:53aa:c66c:59f2:1ee3:fe3e:b848) (Remote host closed the connection) |
| 2020-09-17 14:49:07 | <merijn> | The answer is, most likely, "the same way C does this" |
| 2020-09-17 14:49:16 | <hyperisco> | maybe "NaN" should mean "more than one number" |
| 2020-09-17 14:49:25 | <z0> | @type (1/0) |
| 2020-09-17 14:49:27 | <lambdabot> | Fractional a => a |
| 2020-09-17 14:49:34 | → | mariatsji joins (~mariatsji@2a01:79d:53aa:c66c:59f2:1ee3:fe3e:b848) |
| 2020-09-17 14:49:37 | <z0> | > 1/0 |
| 2020-09-17 14:49:40 | <lambdabot> | Infinity |
| 2020-09-17 14:49:42 | <dmwit> | > 9 / (1/0) :: Rational |
| 2020-09-17 14:49:44 | <lambdabot> | *Exception: Ratio has zero denominator |
| 2020-09-17 14:49:46 | <z0> | @type Infinity |
| 2020-09-17 14:49:48 | <lambdabot> | error: |
| 2020-09-17 14:49:48 | <lambdabot> | • Data constructor not in scope: Infinity |
| 2020-09-17 14:49:48 | <lambdabot> | • Perhaps you meant variable ‘infinity’ (imported from Data.Number.Natural) |
| 2020-09-17 14:49:49 | <ski> | > sqrt (-1) |
| 2020-09-17 14:49:51 | <lambdabot> | NaN |
| 2020-09-17 14:49:52 | <merijn> | z0: Ah, how does it decide the type of a polymorphic expression? |
| 2020-09-17 14:49:52 | <ski> | > log (-1) |
| 2020-09-17 14:49:54 | <lambdabot> | NaN |
| 2020-09-17 14:50:05 | <merijn> | z0: Was that the question? |
| 2020-09-17 14:50:15 | <z0> | merijn: that's right |
| 2020-09-17 14:50:19 | <hyperisco> | MoreThanOneNumber, NotInRealPlane |
| 2020-09-17 14:50:34 | × | cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 2.9) |
| 2020-09-17 14:50:37 | <hyperisco> | FILE_NOT_FOUND probably somewhere in the arithmetic |
| 2020-09-17 14:50:41 | <dmwit> | z0: It uses defaulting. The default default is (Integer, Double), I think. |
| 2020-09-17 14:50:41 | → | agiza joins (2eef7ad3@larka.olf.sgsnet.se) |
| 2020-09-17 14:50:55 | <merijn> | z0: Ok, so there's a bunch of rules in the report that define special cases for polymorphic types for Num/Integral and Fractional/etc. |
| 2020-09-17 14:51:02 | ski | . o O ( `abs (0/0)' ) |
| 2020-09-17 14:51:03 | <z0> | merijn: and what is Infinity treated as a value of type Fractional a => a |
| 2020-09-17 14:51:18 | <dmwit> | Infinity is not a value of type Fractional a => a. |
| 2020-09-17 14:51:24 | × | agiza quits (2eef7ad3@larka.olf.sgsnet.se) (Remote host closed the connection) |
| 2020-09-17 14:51:24 | <dmwit> | It is a value of type Double, and a value of type Float. |
| 2020-09-17 14:51:25 | <merijn> | z0: Which basically say "if you've got a polymorphic expression that's Num or Integral, default it to Integer" and "Double" for Fractional |
| 2020-09-17 14:51:38 | <dmwit> | > (read "Infinity" :: Double, read "Infinity" :: Rational) |
| 2020-09-17 14:51:41 | <lambdabot> | (Infinity,*Exception: Prelude.read: no parse |
| 2020-09-17 14:51:50 | <merijn> | z0: This is covered by the "defaulting rules" |
| 2020-09-17 14:51:54 | → | alp_ joins (~alp@2a01:e0a:58b:4920:102b:86e3:d072:38a0) |
| 2020-09-17 14:51:54 | <hyperisco> | yes, the seldom talked about defaults feature |
| 2020-09-17 14:52:02 | <merijn> | z0: If you enable -Wall you should get warnings for defaulting, iirc |
| 2020-09-17 14:52:10 | <dolio> | Well, Infinity isn't a valid expression unless you define a data type with a constructor of that name. |
| 2020-09-17 14:52:19 | <ski> | (or pattern synonym) |
| 2020-09-17 14:52:24 | <dolio> | Yeah, or that. |
| 2020-09-17 14:52:28 | <z0> | dolio: i think that's what is confusing me |
| 2020-09-17 14:52:52 | → | bahamas joins (~lucian@188.24.181.166) |
| 2020-09-17 14:52:52 | × | bahamas quits (~lucian@188.24.181.166) (Changing host) |
| 2020-09-17 14:52:52 | → | bahamas joins (~lucian@unaffiliated/bahamas) |
| 2020-09-17 14:52:53 | <dolio> | 1/0 is an expression, and what it does depends on the type. |
| 2020-09-17 14:53:09 | <merijn> | z0: "(1/0) :: Fractional a => a" gets defaulted to type "Double" and when you compute 1/0 for Double the result is a Double (which happens to have value Infinity) |
| 2020-09-17 14:53:27 | <ski> | > 1 / 0 :: Rational |
| 2020-09-17 14:53:30 | <lambdabot> | *Exception: Ratio has zero denominator |
| 2020-09-17 14:53:47 | <z0> | > ((1/0) :: Double, (1/0) :: Rational, Infinity :: Double, Infinity :: Rational) |
| 2020-09-17 14:53:48 | × | jonathanx quits (~jonathan@dyn-8-sc.cdg.chalmers.se) (Remote host closed the connection) |
| 2020-09-17 14:53:50 | <lambdabot> | error: |
| 2020-09-17 14:53:50 | <lambdabot> | • Data constructor not in scope: Infinity :: Double |
| 2020-09-17 14:53:50 | <lambdabot> | • Perhaps you meant variable ‘infinity’ (imported from Data.Number.Natur... |
| 2020-09-17 14:54:06 | <z0> | > ((1/0) :: Double, (1/0) :: Rational) |
| 2020-09-17 14:54:09 | × | mariatsji quits (~mariatsji@2a01:79d:53aa:c66c:59f2:1ee3:fe3e:b848) (Ping timeout: 244 seconds) |
| 2020-09-17 14:54:09 | <lambdabot> | (Infinity,*Exception: Ratio has zero denominator |
| 2020-09-17 14:54:22 | <z0> | > (Infinity :: Double) |
| 2020-09-17 14:54:25 | <lambdabot> | error: |
| 2020-09-17 14:54:25 | <lambdabot> | • Data constructor not in scope: Infinity :: Double |
| 2020-09-17 14:54:25 | <lambdabot> | • Perhaps you meant variable ‘infinity’ (imported from Data.Number.Natural) |
| 2020-09-17 14:54:32 | <z0> | hum |
| 2020-09-17 14:54:40 | <merijn> | z0: Infinity is the string representation of a Double value |
| 2020-09-17 14:54:48 | <merijn> | z0: That double value has no literal way to write it |
All times are in UTC.