Logs: freenode/#haskell
| 2020-10-09 17:25:51 | → | snakemas1 joins (~snakemast@213.100.206.23) |
| 2020-10-09 17:25:56 | → | geekosaur joins (82659a05@host154-005.vpn.uakron.edu) |
| 2020-10-09 17:26:15 | → | oisdk joins (~oisdk@2001:bb6:3329:d100:d4b4:3667:7218:633) |
| 2020-10-09 17:28:51 | × | mdunnio quits (~mdunnio@208.59.170.5) (Read error: Connection reset by peer) |
| 2020-10-09 17:28:52 | × | avdb quits (~avdb@ip-62-235-188-165.dsl.scarlet.be) (Quit: WeeChat 2.9) |
| 2020-10-09 17:29:26 | → | mdunnio joins (~mdunnio@208.59.170.5) |
| 2020-10-09 17:33:27 | × | thir quits (~thir@p200300f27f02580060eb7dde324e54c8.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
| 2020-10-09 17:34:08 | → | galagora- joins (~ao@197.237.20.60) |
| 2020-10-09 17:41:03 | × | LKoen quits (~LKoen@81.255.219.130) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”) |
| 2020-10-09 17:43:18 | <dwts> | hi all, when a comparison returns GT, LT, or EQ, is it safe to assume that in reality the "real" values of them are numbers? |
| 2020-10-09 17:43:33 | <tomsmeding> | dwts: the real values of what exactly |
| 2020-10-09 17:43:37 | <tomsmeding> | GT/LT/EQ ? |
| 2020-10-09 17:43:39 | <dwts> | yes |
| 2020-10-09 17:44:01 | <dwts> | I have trouble understanding what is the benefit of returning these instead of numbers |
| 2020-10-09 17:44:16 | <tomsmeding> | https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Ord.html#t:Ordering |
| 2020-10-09 17:44:25 | <tomsmeding> | it's just 'data Ordering = LT | EQ | GT' |
| 2020-10-09 17:44:48 | <dsal> | dwts: Why would you want a number there? |
| 2020-10-09 17:44:49 | <tomsmeding> | though you can use fromEnum on them to get 0,1,2 if you should wish :p |
| 2020-10-09 17:45:53 | <tomsmeding> | re:benefit: more type safety |
| 2020-10-09 17:46:33 | <tomsmeding> | a number you can potentially confuse with something else that produces a number |
| 2020-10-09 17:46:34 | → | todda7 joins (~torstein@athedsl-4367507.home.otenet.gr) |
| 2020-10-09 17:46:34 | <dwts> | dsal: I don't *want* a number, I'm trying to visualize in my mind what haskell is doing underneath and why the ordering is implemented that way |
| 2020-10-09 17:46:39 | → | thir joins (~thir@p200300f27f02580060eb7dde324e54c8.dip0.t-ipconnect.de) |
| 2020-10-09 17:46:51 | <dwts> | ah, I see |
| 2020-10-09 17:46:57 | <tomsmeding> | well deep down in the implementation details, Ordering really boils down to just a byte |
| 2020-10-09 17:47:00 | <tomsmeding> | that's 0, 1 or 2 |
| 2020-10-09 17:47:10 | <tomsmeding> | because that's how haskell compiles down sum types like these |
| 2020-10-09 17:47:20 | <tomsmeding> | but the programmer need not think about that :) |
| 2020-10-09 17:47:46 | <dsal> | Similar to how Bool is False and True. You *can* convert those to numbers and some languages do that and it's massively error prone. |
| 2020-10-09 17:48:22 | × | st8less quits (~st8less@2603:a060:11fd:0:9c66:9b18:c21:60c) (Ping timeout: 260 seconds) |
| 2020-10-09 17:48:27 | <dwts> | do these LT/EQ/GT have a special name like True/False have Boolean? |
| 2020-10-09 17:48:40 | <Uniaika> | hmm, not that I know of |
| 2020-10-09 17:48:43 | <tomsmeding> | data Bool = False | True |
| 2020-10-09 17:48:46 | <Uniaika> | they're just values of an ADT |
| 2020-10-09 17:48:49 | <tomsmeding> | data Ordering = LT | EQ | GT |
| 2020-10-09 17:48:51 | <dsal> | Ordering? |
| 2020-10-09 17:48:56 | <dwts> | ok |
| 2020-10-09 17:49:33 | <dwts> | I think I'm good for now, thank you all |
| 2020-10-09 17:49:37 | <dsal> | Similarly, Boolean is often a really bad abstraction. |
| 2020-10-09 17:50:05 | <dwts> | dsal: not sure why, but I have no reason not to believe you :) |
| 2020-10-09 17:50:07 | <dsal> | I had an awful time understanding some of my own code that I modeled a bit from a protocol specification as a Boolean before I changed it to my own sum type and suddenly could read my own code. |
| 2020-10-09 17:50:14 | <dsal> | boolean blindness is a terrible thing |
| 2020-10-09 17:50:20 | <tomsmeding> | now we're (indirectly) talking about performance anyway: is there a faster way to read lots of Double's from a file than the following: sum . map (read @Double) . words <$> readFile "doubles.txt" |
| 2020-10-09 17:50:30 | <tomsmeding> | because that's horribly slow |
| 2020-10-09 17:50:59 | <ski> | @where boolean-blindness |
| 2020-10-09 17:51:00 | <lambdabot> | http://existentialtype.wordpress.com/2011/03/15/boolean-blindness/ |
| 2020-10-09 17:51:02 | → | avdb joins (~avdb@ip-62-235-188-165.dsl.scarlet.be) |
| 2020-10-09 17:51:03 | <dsal> | Is read that slow? |
| 2020-10-09 17:51:08 | <tomsmeding> | apparently? |
| 2020-10-09 17:51:45 | <dsal> | You could probably make a faster parser if you don't need all of the things that a Double parser could parse. |
| 2020-10-09 17:52:36 | <ski> | > sortBy (comparing length <> compare) (words "The quick brown fox jumps over the lazy dog") -- dwts, with a separate `Ordering' data type, we can do this "primarily sort by length, secondarily by ordinary lexicographic word ordering") |
| 2020-10-09 17:52:39 | <lambdabot> | ["The","dog","fox","the","lazy","over","brown","jumps","quick"] |
| 2020-10-09 17:52:43 | <tomsmeding> | from some rudimentary timing the 'read' part indeed takes the longest time |
| 2020-10-09 17:53:28 | hackage | rebase 1.10.0.1 - A more progressive alternative to the "base" package https://hackage.haskell.org/package/rebase-1.10.0.1 (NikitaVolkov) |
| 2020-10-09 17:53:29 | <tomsmeding> | dwts: ski's example is a thing because we can define <> to do something special on Ordering that it does not do on plain numbers |
| 2020-10-09 17:53:38 | <dwts> | ski: I was actually reading a book with a sortBy example and came to the definition of LT/EQ/GT |
| 2020-10-09 17:54:03 | <dwts> | this looks really powerful and confusing at the same time |
| 2020-10-09 17:54:14 | × | shafox quits (~shafox@106.51.234.111) (Remote host closed the connection) |
| 2020-10-09 17:54:20 | <tomsmeding> | dsal: I could try that, but 'length . words' already takes longer than C++ takes to parse the entire thing into an std::vector<double> |
| 2020-10-09 17:54:28 | hackage | rerebase 1.10.0.1 - Reexports from "base" with a bunch of other standard libraries https://hackage.haskell.org/package/rerebase-1.10.0.1 (NikitaVolkov) |
| 2020-10-09 17:54:34 | <tomsmeding> | dwts: welcome to haskell :p |
| 2020-10-09 17:54:42 | <ski> | @where monoids |
| 2020-10-09 17:54:43 | <lambdabot> | comment on "Monoids? In my programming language?" by Cale in 2008 (or 2009 ?) at <http://www.reddit.com/r/programming/comments/7cf4r/monoids_in_my_programming_language/c06adnx> about a use of ` |
| 2020-10-09 17:54:43 | <lambdabot> | instance Monoid a => Monoid (rho -> a)' |
| 2020-10-09 17:54:46 | <ski> | dwts ^ |
| 2020-10-09 17:55:24 | <dsal> | dwts: At a higher level, discussing meaning makes it a lot easier to reason about things than discussing implementation. |
| 2020-10-09 17:55:59 | <dwts> | tomsmeding: thanks :P Coming from a scheme background some things are similar but others seem so different |
| 2020-10-09 17:56:19 | <dwts> | dsal: I see your point |
| 2020-10-09 17:56:20 | <dsal> | You never have to read the manual to remember what a compare function returns and how the integer value maps to maybe -1, 0, 1, or maybe just some negative or positive value, or 0, 1, 2, or how you might be able to combine comparisons by renormalizing them, etc... |
| 2020-10-09 17:56:54 | <dsal> | The Ordering semigroup is really a secondary benefit. Primarily, you get to talk about what you mean instead of going back and forth to machine speak constantly. |
| 2020-10-09 17:58:10 | <dwts> | hmmm |
| 2020-10-09 17:58:15 | <dwts> | there's a lot to digest here |
| 2020-10-09 17:58:16 | <dwts> | lol |
| 2020-10-09 17:58:39 | <tomsmeding> | dwts: sidenote: "semigroup" means that definition of <> |
| 2020-10-09 17:58:49 | <tomsmeding> | nothing more :p |
| 2020-10-09 17:58:50 | <dwts> | ah |
| 2020-10-09 17:59:51 | <dsal> | Well, what happens is when you start talking about what you mean, you get to make a lot of things common that you wouldn't have been able to see the commonality in before. |
| 2020-10-09 18:00:01 | × | kers quits (~kers@178.162.212.214) () |
| 2020-10-09 18:00:08 | → | emmanuel` joins (~user@2604:2000:1382:ce03:4ce1:f2da:89aa:1919) |
| 2020-10-09 18:01:47 | × | darjeeling_ quits (~darjeelin@122.245.210.138) (Ping timeout: 240 seconds) |
| 2020-10-09 18:02:12 | <galagora-> | Has anyone ever used Silica, the lens library? |
| 2020-10-09 18:02:36 | × | dyeplexer quits (~lol@unaffiliated/terpin) (Remote host closed the connection) |
| 2020-10-09 18:03:32 | × | emmanuel_erc quits (~user@2604:2000:1382:ce03:ddc4:166d:60ea:ae29) (Ping timeout: 260 seconds) |
| 2020-10-09 18:04:37 | × | AlterEgo- quits (~ladew@124-198-158-163.dynamic.caiway.nl) (Read error: Connection reset by peer) |
| 2020-10-09 18:05:30 | → | darjeeling_ joins (~darjeelin@122.245.210.138) |
| 2020-10-09 18:06:42 | × | gnar^2 quits (~user@c-73-118-153-248.hsd1.wa.comcast.net) (Remote host closed the connection) |
| 2020-10-09 18:06:43 | × | jrqc quits (~rofl@96.78.87.197) (Ping timeout: 260 seconds) |
| 2020-10-09 18:07:20 | → | AlterEgo- joins (~ladew@124-198-158-163.dynamic.caiway.nl) |
| 2020-10-09 18:07:35 | → | jrqc joins (~rofl@96.78.87.197) |
| 2020-10-09 18:07:49 | <dsal> | galagora-: I just heard about it a around 5 minutes ago. Is it working out for you? |
| 2020-10-09 18:08:05 | × | todda7 quits (~torstein@athedsl-4367507.home.otenet.gr) (Ping timeout: 240 seconds) |
| 2020-10-09 18:08:16 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds) |
| 2020-10-09 18:08:17 | × | DataComputist quits (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net) (Quit: Leaving...) |
| 2020-10-09 18:08:46 | → | wroathe joins (~wroathe@c-73-24-27-54.hsd1.mn.comcast.net) |
| 2020-10-09 18:09:47 | <tomsmeding> | dsal: the same pipeline but then with Int instead of Double is only slightly faster (on a file that only contains integers, of course) |
| 2020-10-09 18:09:56 | <tomsmeding> | so a custom Double parser is unlikely to make things better |
| 2020-10-09 18:10:34 | → | howdoi joins (uid224@gateway/web/irccloud.com/x-nyfmrtbjovrebhnn) |
| 2020-10-09 18:10:45 | → | GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) |
| 2020-10-09 18:10:45 | × | GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host) |
| 2020-10-09 18:10:45 | → | GyroW joins (~GyroW@unaffiliated/gyrow) |
All times are in UTC.