Logs: freenode/#haskell
| 2021-03-20 22:16:08 | × | `slikts quits (~nelabs@wikipedia/reinis) (Ping timeout: 265 seconds) |
| 2021-03-20 22:17:08 | × | mastarija quits (~mastarija@31.217.19.201) (Quit: Leaving) |
| 2021-03-20 22:19:39 | × | cabpa quits (~cabpa@180.190.168.108) (Ping timeout: 246 seconds) |
| 2021-03-20 22:20:26 | → | olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber) |
| 2021-03-20 22:20:43 | → | `slikts joins (~nelabs@wikipedia/reinis) |
| 2021-03-20 22:22:06 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 246 seconds) |
| 2021-03-20 22:25:33 | × | zebrag quits (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) (Read error: Connection reset by peer) |
| 2021-03-20 22:25:53 | → | zebrag joins (~inkbottle@aaubervilliers-654-1-109-157.w86-212.abo.wanadoo.fr) |
| 2021-03-20 22:28:52 | <bbhoss> | could someone explain what I'm missing here? https://replit.com/@bbhoss/RedundantYellowishCopyright#main.hs the error is confusing to me. I understand that find returns a Maybe, it seems it's returning a function t0 MyDataType -> Maybe MyDataType? the t0 is particularly unclear |
| 2021-03-20 22:29:20 | <bbhoss> | Couldn't match expected type `Maybe CandidateTally' with actual type `t0 CandidateTally -> Maybe CandidateTally' |
| 2021-03-20 22:29:51 | × | Franciman quits (~francesco@host-79-53-62-46.retail.telecomitalia.it) (Quit: Leaving) |
| 2021-03-20 22:31:02 | <bbhoss> | basically the whole goal there is to find the running tally so I can add one to it to count a vote. I've got isCandidateTally which should make predicates for me depending on who the vote was for (the candidate) |
| 2021-03-20 22:31:27 | × | Lycurgus quits (~niemand@98.4.116.165) (Quit: Exeunt) |
| 2021-03-20 22:32:16 | × | molehillish quits (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) (Remote host closed the connection) |
| 2021-03-20 22:32:48 | → | parallel joins (524f826b@82.79.130.107) |
| 2021-03-20 22:32:56 | × | coot quits (~coot@37.30.58.223.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-03-20 22:33:42 | <ski> | bbhoss : you're missing passing one argument to `find' |
| 2021-03-20 22:34:00 | → | molehillish joins (~molehilli@2600:8800:8d06:1800:c1f2:e355:53f0:4ab8) |
| 2021-03-20 22:34:22 | <bbhoss> | d0h |
| 2021-03-20 22:34:44 | <bbhoss> | I wasn't passing the actual running election in |
| 2021-03-20 22:34:52 | <bbhoss> | thanks |
| 2021-03-20 22:34:55 | <ski> | the type error about not being able to match `Maybe (...)' with `... -> Maybe (...)' immediately suggests missing, or extraneous, argument |
| 2021-03-20 22:35:05 | <ski> | (also, there's no reason to use `$' there) |
| 2021-03-20 22:35:44 | × | unyu quits (~pyon@unaffiliated/pyon) (Quit: Remember that death is not the end, but only a transition.) |
| 2021-03-20 22:35:54 | <bbhoss> | yeah I guess the t0 threw me off. t is the Traversable? Why is the 0 getting added on? |
| 2021-03-20 22:36:44 | <ski> | possibly, during the type inference process, it had already introduced a type variable `t' |
| 2021-03-20 22:36:50 | <ski> | @type find |
| 2021-03-20 22:36:52 | <lambdabot> | Foldable t => (a -> Bool) -> t a -> Maybe a |
| 2021-03-20 22:37:05 | <ski> | the name `t' coming from there, presumably |
| 2021-03-20 22:37:16 | <ski> | in your case, you have a list |
| 2021-03-20 22:38:03 | <ski> | (so `t'/`t0' is `[]', so that `t a'/`t0 CandidateTally' is `[] CandidateTally' is `[CandidateTally]') |
| 2021-03-20 22:38:19 | <ski> | btw, note that |
| 2021-03-20 22:38:25 | <ski> | the whole goal there is to find the running tally so I can add one to it to count a vote. I've got isCandidateTally which should make predicates for me depending on who the vote was for (the candidate) |
| 2021-03-20 22:38:29 | <ski> | er, sorry |
| 2021-03-20 22:38:36 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 2021-03-20 22:39:05 | × | perrier-jouet quits (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.1) |
| 2021-03-20 22:39:07 | <ski> | findCandidateResult candidate election = find (isCandidateTally candidate) election |
| 2021-03-20 22:39:21 | <ski> | is, by "function extensionality", equivalent to |
| 2021-03-20 22:39:30 | <ski> | findCandidateResult candidate = find (isCandidateTally candidate) |
| 2021-03-20 22:39:44 | × | malumore quits (~malumore@151.62.117.235) (Ping timeout: 240 seconds) |
| 2021-03-20 22:39:47 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2021-03-20 22:40:06 | × | parallel quits (524f826b@82.79.130.107) (Quit: Connection closed) |
| 2021-03-20 22:40:19 | <bbhoss> | yep, linter just made that suggestion and I took it. as far as the $ being unnecessary, it seems like it allows me to omit the parentheses? I'm on the fence whether they are better than $ |
| 2021-03-20 22:40:19 | <ski> | (since, if `f x = g x', for all `x', then `f' and `g' behaves the same, in the sense of giving equal outputs for equal inputs, and so `f = g') |
| 2021-03-20 22:40:36 | <ski> | and then, it is possible to reason further |
| 2021-03-20 22:40:41 | <ski> | findCandidateResult candidate = find (isCandidateTally candidate) |
| 2021-03-20 22:40:55 | <ski> | = (find . isCandidateTally) candidate |
| 2021-03-20 22:41:06 | <ski> | findCandidateResult = find . isCandidateTally |
| 2021-03-20 22:41:35 | <ski> | (not saying it's better to rephrase it like that. just that it's possible to do so) |
| 2021-03-20 22:42:48 | → | perrier-jouet joins (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
| 2021-03-20 22:43:04 | <ski> | imho, generally it's not that common (at least compared to how often especially newbies use it) to have a case where `$' improves anything |
| 2021-03-20 22:43:35 | × | fendor quits (~fendor@178.115.129.42.wireless.dyn.drei.com) (Read error: Connection reset by peer) |
| 2021-03-20 22:43:39 | <ski> | (brackets are nothing to be afraid of) |
| 2021-03-20 22:44:26 | <__minoru__shirae> | brackets add one thing to remember when parsing |
| 2021-03-20 22:45:00 | <ski> | in my mind, brackets are easier to parse |
| 2021-03-20 22:45:04 | <__minoru__shirae> | when you meet an opening bracket, you need to put "met opening bracket, expect closing bracket" somewhere in memory |
| 2021-03-20 22:45:09 | <ski> | (especially with sane indentation) |
| 2021-03-20 22:45:33 | <ski> | with operators, i have to think about relative operator precedence |
| 2021-03-20 22:45:43 | <ski> | (and associativity) |
| 2021-03-20 22:45:58 | <__minoru__shirae> | but when you meet $, you don't have to expect for other matching character (when it's done right) |
| 2021-03-20 22:46:14 | × | aarvar quits (~foewfoiew@2601:602:a080:fa0:99f2:16e7:abb7:2d80) (Ping timeout: 264 seconds) |
| 2021-03-20 22:46:27 | <ski> | __minoru__shirae : yes, and you pay for that, by the precedence |
| 2021-03-20 22:50:09 | × | myShoggoth quits (~myShoggot@75.164.81.55) (Ping timeout: 256 seconds) |
| 2021-03-20 22:51:41 | → | Rudd0^ joins (~Rudd0@185.189.115.103) |
| 2021-03-20 22:52:40 | → | RandomArcher joins (~isho@90.153.235.252) |
| 2021-03-20 22:53:10 | <__minoru__shirae> | speaking of precedence, I tripped over it when trying to implement a list bounds check like this: "min 0 y-1" |
| 2021-03-20 22:53:23 | <__minoru__shirae> | and then I started getting -1 |
| 2021-03-20 22:53:29 | × | perrier-jouet quits (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) (Quit: WeeChat 3.1) |
| 2021-03-20 22:53:58 | <__minoru__shirae> | turnes out you have to say "min 0 (y-1)" |
| 2021-03-20 22:54:18 | → | perrier-jouet joins (~perrier-j@modemcable012.251-130-66.mc.videotron.ca) |
| 2021-03-20 22:54:23 | <ski> | yep |
| 2021-03-20 22:54:41 | × | Rudd0 quits (~Rudd0@185.189.115.108) (Ping timeout: 256 seconds) |
| 2021-03-20 22:54:50 | <__minoru__shirae> | can you give an example of screwing up precendence when using % |
| 2021-03-20 22:54:57 | <__minoru__shirae> | s/%/$/ |
| 2021-03-20 22:54:58 | <ski> | function application binds tighter than any (ordinary) infix operators |
| 2021-03-20 22:56:00 | <__minoru__shirae> | err, it should be "max 0 (y-1)" |
| 2021-03-20 22:56:52 | <ski> | foo x $ bar baz |
| 2021-03-20 22:56:55 | <ski> | <|> quux |
| 2021-03-20 22:57:09 | <maralorn> | Is there a simple way to just install (or rather build) a random package from hackage with haskell.nix? |
| 2021-03-20 22:57:52 | <__minoru__shirae> | ski: "foo x $ bar baz" translates to "foo x (bar baz)", right? where is the problem here? |
| 2021-03-20 22:58:46 | × | codygman` quits (~user@47.186.207.161) (Remote host closed the connection) |
| 2021-03-20 22:59:53 | → | aarvar joins (~foewfoiew@2601:602:a080:fa0:114e:cbb2:413:961f) |
| 2021-03-20 23:01:18 | <ski> | the next line |
| 2021-03-20 23:04:56 | × | elfets quits (~elfets@ip-37-201-23-96.hsi13.unitymediagroup.de) (Ping timeout: 240 seconds) |
| 2021-03-20 23:06:17 | <monochrom> | As usual, my theory of () vs $ is of enjoying algebraic formulas vs resenting (even dissenting) algebraic formulas. |
| 2021-03-20 23:06:52 | × | andreas31 quits (~andreas@gateway/tor-sasl/andreas303) (Remote host closed the connection) |
| 2021-03-20 23:07:32 | → | Tario joins (~Tario@37.218.244.251) |
| 2021-03-20 23:07:33 | → | andreas31 joins (~andreas@gateway/tor-sasl/andreas303) |
| 2021-03-20 23:09:29 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-03-20 23:09:57 | <mniip> | locality, eye travel distance, edit distance |
| 2021-03-20 23:10:50 | <monochrom> | You will find that, even in the imperative programming world, even 60 years after Fortran, there are still programmers who insist that "tmp1 = x+y; tmp2 = a-b; z = tmp1 * tmp2" is more readable [sic] than "z = (x+y)*(a-b)". Or bigger versions of that. |
| 2021-03-20 23:11:21 | <mniip> | that's let k = g x in f x k |
| 2021-03-20 23:11:27 | <mniip> | not f x (g x) versus f x $ g x |
| 2021-03-20 23:12:19 | → | codygman` joins (~user@47.186.207.161) |
| 2021-03-20 23:12:28 | <mniip> | if your x,y,a,b have a bunch of parentheses in them as well, such that you cannot fast-seek over them to discover the top level structure of (_ + _) * (_ - _) |
| 2021-03-20 23:12:30 | <mniip> | then that's your problem |
| 2021-03-20 23:14:17 | → | myShoggoth joins (~myShoggot@75.164.81.55) |
| 2021-03-20 23:17:29 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2021-03-20 23:19:26 | × | Tario quits (~Tario@37.218.244.251) (Read error: Connection reset by peer) |
| 2021-03-20 23:20:00 | → | Tario joins (~Tario@201.192.165.173) |
All times are in UTC.