Logs: freenode/#haskell
| 2020-09-28 19:47:40 | → | cosimone joins (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) |
| 2020-09-28 19:48:23 | <Guest18> | then i check to see if the head satisfies the predicate. If it does, keep it to the list and filter the tail, otherwise just filter the tail |
| 2020-09-28 19:48:57 | <Guest18> | the tutorial i am following added a little thing though |
| 2020-09-28 19:49:01 | <Enrico63> | (I'm pasting my own message from 1h ago, maybe that was not the right time of the day...) Hello, I've installed `haskell-language-server` and set things up in Vim for having completions. However I'm not sure how to take advantage of that. Maybe the language server is simply not meant to be useful for completion? Please, give a look at this short |
| 2020-09-28 19:49:02 | <Enrico63> | screencast: https://asciinema.org/a/Hce9ZH3iRdOUg1wDkuicMNLqy |
| 2020-09-28 19:49:51 | <Guest18> | archaephyrryx: he added a case in which it gets an empty list, as an edge case, and returns an empty list |
| 2020-09-28 19:50:02 | → | coot joins (~coot@37.30.59.210.nat.umts.dynamic.t-mobile.pl) |
| 2020-09-28 19:50:07 | <Guest18> | so the recursion ends |
| 2020-09-28 19:50:26 | <Guest18> | but as far as i can tell, my version behaves okay without that case |
| 2020-09-28 19:50:38 | <ski> | show your code ? |
| 2020-09-28 19:50:47 | <Guest18> | and i am wondering if it's necesarry and my function will break at some point |
| 2020-09-28 19:50:49 | <archaephyrryx> | Guest18: the pattern match is irrefutable if you don't have a case that isn't matched by (x:xs) |
| 2020-09-28 19:50:59 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2020-09-28 19:51:11 | <Guest18> | filter' :: (a -> Bool) -> [a] -> [a] |
| 2020-09-28 19:51:12 | <Guest18> | filter' f (x:xs) |
| 2020-09-28 19:51:12 | <Guest18> | | f x == False = filter' f xs |
| 2020-09-28 19:51:13 | <Guest18> | | otherwise = x : filter' f xs -- my code |
| 2020-09-28 19:51:27 | → | ph88 joins (~ph88@ip5f5af71a.dynamic.kabel-deutschland.de) |
| 2020-09-28 19:51:29 | <archaephyrryx> | Guest18: unless you are working with infinite lists your code will run into a [] and fail |
| 2020-09-28 19:51:30 | <Guest18> | his code added this: filter _ [] = [] |
| 2020-09-28 19:51:50 | <ski> | > let filter' :: (a -> Bool) -> [a] -> [a]; filter' f (x:xs) | f x == False = filter' f xs | otherwise = x : filter' f xs in filter' even [0,1,2,3,4,5,6,7] |
| 2020-09-28 19:51:52 | <lambdabot> | [0,2,4,6*Exception: <interactive>:3:43-119: Non-exhaustive patterns in funct... |
| 2020-09-28 19:52:30 | <Guest18> | so it's not an edge case? |
| 2020-09-28 19:52:42 | <ski> | it's a termination case, when to stop looping |
| 2020-09-28 19:52:46 | <yushyin> | Enrico63: https://paste.xinu.at/2EnyX1/ looks like this to me with vim-lsp + set omnifunc=lsp#complete the rendering of the popup-preview sucks.will have to fix that but no time yet. |
| 2020-09-28 19:52:48 | <ski> | > let filter' :: (a -> Bool) -> [a] -> [a]; filter' f (x:xs) | f x == False = filter' f xs | otherwise = x : filter' f xs in filter' even [] |
| 2020-09-28 19:52:49 | <ph88> | hey guys, what's the best way to use stack with private packages ?? |
| 2020-09-28 19:52:51 | <archaephyrryx> | Guest18: as a side note you don't actually need the '== False' bit, you just need to swap the guard RHS |
| 2020-09-28 19:52:51 | <lambdabot> | *Exception: <interactive>:3:43-119: Non-exhaustive patterns in function filter' |
| 2020-09-28 19:53:02 | → | adam_wespiser joins (~adam_wesp@209.6.42.110) |
| 2020-09-28 19:53:15 | <lyxia> | ph88: use the extra-deps field of stack.yaml? |
| 2020-09-28 19:53:24 | <ski> | yes, it's more idiomatic to say `not (...)' rather than `... == False'. but here you can just flip the order |
| 2020-09-28 19:53:47 | <ph88> | lyxia, then pointing to what ? |
| 2020-09-28 19:53:57 | × | thc202 quits (~thc202@unaffiliated/thc202) (Ping timeout: 260 seconds) |
| 2020-09-28 19:54:12 | <ski> | Guest18 : you could say it's an edge case, if you want to. but it's a necessary case, to have a complete definition, that will work as expected for any input |
| 2020-09-28 19:54:15 | <glguy> | ski: not ... == True? :nod: ;) |
| 2020-09-28 19:54:26 | ski | smirks |
| 2020-09-28 19:55:44 | <Guest18> | archaephyrryx: can you clarify what 'swapping the guard' means? Still a beginner, took up haskell a week ago |
| 2020-09-28 19:56:20 | <archaephyrryx> | 'filter f (x:xs) | f x = x : filter xs | otherwise = filter xs' |
| 2020-09-28 19:56:26 | <ski> | Guest18 : changing the order of the two cases (don't keep element / keep element), and adjusting the guard conditions accordingly |
| 2020-09-28 19:57:12 | <archaephyrryx> | you would still keep the 'f _ [] = []' though to make the pattern match complete |
| 2020-09-28 19:57:16 | <Enrico63> | yushyin, sorry for the dumb question, but is `vim-lsp` an alternative to youcompleteme (if you know it) or something that can be leveraged by it? |
| 2020-09-28 19:57:16 | → | filwisher joins (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net) |
| 2020-09-28 19:57:25 | <archaephyrryx> | sorry, 'filter _ [] = []' (not f) |
| 2020-09-28 19:58:32 | <Guest18> | ah, so i remove the False because f is already a predicate and returns Bool |
| 2020-09-28 19:58:38 | <archaephyrryx> | exactly |
| 2020-09-28 19:58:40 | × | macrover quits (~macrover@ip70-189-231-35.lv.lv.cox.net) (Ping timeout: 272 seconds) |
| 2020-09-28 19:58:52 | <archaephyrryx> | and you would just adjust the logic accordingly |
| 2020-09-28 19:59:35 | <yushyin> | Enrico63: just minimal vim-script only LSP client for vim. more of an alternative to YCM |
| 2020-09-28 19:59:47 | <Guest18> | yes, because now it will return true and it needs to keep the element |
| 2020-09-28 19:59:47 | → | raehik joins (~raehik@cpc96984-rdng25-2-0-cust109.15-3.cable.virginm.net) |
| 2020-09-28 20:00:13 | × | dhil quits (~dhil@11.29.39.217.dyn.plus.net) (Ping timeout: 258 seconds) |
| 2020-09-28 20:00:16 | <Guest18> | i mean, if it returns true |
| 2020-09-28 20:00:25 | <Guest18> | i got it, thanks! |
| 2020-09-28 20:00:46 | × | adam_wespiser quits (~adam_wesp@209.6.42.110) (Ping timeout: 246 seconds) |
| 2020-09-28 20:01:01 | <ski> | generally, you don't need to compare things with `False' or `True' |
| 2020-09-28 20:01:16 | <ski> | either use the condition directly, or negate it |
| 2020-09-28 20:01:50 | <Guest18> | bad habit from imperative programming i guess |
| 2020-09-28 20:01:52 | → | adam_wespiser joins (~adam_wesp@209.6.42.110) |
| 2020-09-28 20:02:05 | <ski> | it's also considered bad style, in imperative programming :) |
| 2020-09-28 20:02:29 | <archaephyrryx> | i was about to say, booleans are booleans are booleans |
| 2020-09-28 20:02:42 | <archaephyrryx> | even when they aren't strictly typed |
| 2020-09-28 20:02:49 | → | o1lo01ol1o joins (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) |
| 2020-09-28 20:02:55 | → | dhil joins (~dhil@11.29.39.217.dyn.plus.net) |
| 2020-09-28 20:02:57 | <ski> | anyway, if you have some argument function, that returns a `Bool'ean, then it's quite common to call it `p' (for "predicate" or "property") instead of `f' |
| 2020-09-28 20:02:58 | hackage | persistent-template 2.9 - Type-safe, non-relational, multi-backend persistence. https://hackage.haskell.org/package/persistent-template-2.9 (MaxGabriel) |
| 2020-09-28 20:03:18 | <Guest18> | depends who you ask, i find it a little more readable i guess, especially when negating. I would much rather see 'if (condition == false)' than 'if (!condition)' |
| 2020-09-28 20:03:38 | <ski> | i'd rather see the latter |
| 2020-09-28 20:03:40 | × | filwisher quits (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net) (Ping timeout: 258 seconds) |
| 2020-09-28 20:03:49 | <Guest18> | to each their own :) |
| 2020-09-28 20:04:16 | <Guest18> | i sometimes miss the little ! and it becomes infuriating |
| 2020-09-28 20:04:31 | <Guest18> | maybe i need to change the font |
| 2020-09-28 20:04:53 | <archaephyrryx> | in C where non-zero values are true-ish and zero is false-ish, it would be awkward to explicitly test equality |
| 2020-09-28 20:05:13 | <archaephyrryx> | "!(!x) = 1" just looks bad |
| 2020-09-28 20:05:24 | <ski> | (also, please don't use `if' where one branch is `False' or `True'. use logical operations like `&&' and `||' instead (possibly with `not', if required). also applies for guards) |
| 2020-09-28 20:05:43 | <koz_> | Where can I find some information on the structure of a cabal.project file? |
| 2020-09-28 20:05:44 | <archaephyrryx> | "!(!x) == 1" is what I meant, i did the bad thing |
| 2020-09-28 20:06:01 | <ski> | archaephyrryx : could be Java or C# or something |
| 2020-09-28 20:06:22 | × | rcdilorenzo quits (~rcdiloren@cpe-76-182-87-188.nc.res.rr.com) (Quit: rcdilorenzo) |
| 2020-09-28 20:06:28 | <Guest18> | archaephyrryx: i rarely program in C nowadays, mostly C# now |
| 2020-09-28 20:06:39 | → | rcdilorenzo joins (~rcdiloren@cpe-76-182-87-188.nc.res.rr.com) |
| 2020-09-28 20:06:41 | <yushyin> | koz_: https://cabal.readthedocs.io/en/3.4/cabal-projectindex.html#cap-cabal.project%20fields |
| 2020-09-28 20:06:50 | <koz_> | yushyin: Thanks! |
| 2020-09-28 20:07:18 | <Guest18> | anyhoo. i am off! thanks for the help |
| 2020-09-28 20:07:18 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-09-28 20:07:21 | <Guest18> | :q |
| 2020-09-28 20:07:23 | <ski> | yw |
| 2020-09-28 20:07:35 | × | Guest18 quits (567e8866@gateway/web/cgi-irc/kiwiirc.com/ip.86.126.136.102) (Quit: Connection closed) |
| 2020-09-28 20:07:48 | <yushyin> | (this is not vim :P) |
| 2020-09-28 20:07:54 | <lyxia> | ph88: pointing to the directory containing a package |
| 2020-09-28 20:08:06 | → | mu_ joins (~mu@unaffiliated/mu) |
| 2020-09-28 20:08:07 | × | adam_wespiser quits (~adam_wesp@209.6.42.110) (Ping timeout: 246 seconds) |
| 2020-09-28 20:08:22 | <koz_> | Also, phadej: does cabal-fmt handle cabal.project files as well? |
| 2020-09-28 20:09:58 | <archaephyrryx> | returning the the question I asked a while ago, does the order of intercalate and map on [ByteString] (strict) affect performance meaningfully |
| 2020-09-28 20:10:03 | <maerwald> | koz_: all this trouble, just because someone didn't pick a common format, such as toml... |
| 2020-09-28 20:10:16 | <monochrom> | Clearly, guards are better than both "if condition then else" and "if not condition then else". |
| 2020-09-28 20:10:19 | <koz_> | Also, for the subdir field of source-repository-package, can I have multiple things, or can it only be one? |
| 2020-09-28 20:10:33 | → | son0p joins (~son0p@181.136.122.143) |
| 2020-09-28 20:10:53 | × | rcdilorenzo quits (~rcdiloren@cpe-76-182-87-188.nc.res.rr.com) (Client Quit) |
| 2020-09-28 20:11:07 | × | remexre quits (~nathan@207-153-38-50.fttp.usinternet.com) (Ping timeout: 240 seconds) |
All times are in UTC.