Logs on 2022-12-04 (liberachat/#haskell)
| 00:00:01 | <dsal> | Just because someone promised me that won't be the case doesn't mean I'm going to listen. |
| 00:00:06 | <EvanR> | 2. is also covered because the result of intersect will have all the same letter for another reason |
| 00:00:12 | <EvanR> | dictated in the problem |
| 00:00:20 | → | albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
| 00:00:44 | <EvanR> | so head is provably correct |
| 00:01:09 | <dsal> | It's the difference between `priority . head` and `foldMap priority` |
| 00:01:31 | <EvanR> | the problem doesn't even say there will be a power outage half way through the program run, but I'm not dealing with that |
| 00:01:39 | × | ballast quits (~ballast@rrcs-24-43-123-92.west.biz.rr.com) (Quit: Client closed) |
| 00:01:40 | <dsal> | It says that, sure, but I'm pretty used to people lying to me about what the input they're going to give me is, and it's not inconvenient to avoid `head` |
| 00:02:41 | <monochrom> | I have a UPS, so power outage is a solved problem, at least if the program just needs 5 minutes. :) |
| 00:03:07 | <EvanR> | sometimes dealing with the impossible case is useless or impossible |
| 00:03:13 | <EvanR> | or redundant (crash) |
| 00:03:15 | <mauke> | everyone is fixating on 'head' and ignoring the problem with 'priority' |
| 00:04:04 | <gqplox> | the otherwise? |
| 00:04:21 | <mauke> | > isLower 'ß' |
| 00:04:22 | <lambdabot> | True |
| 00:04:26 | <EvanR> | that's not one of the letters |
| 00:04:49 | <mauke> | it's a partial function disguised as a total function (by returning nonsense for invalid input) |
| 00:04:53 | <gqplox> | the problem description stated that only 'a'..'z' ++ 'A' .. 'Z' will be inputs |
| 00:05:06 | <dsal> | Sure, but you do parse more than that. |
| 00:05:17 | <gqplox> | I should have put isUperr .. and then _ = error maybe? |
| 00:05:34 | <EvanR> | crashing on invalid input... doesn't actually change anything |
| 00:05:44 | <dsal> | Well, no, ß is lower, but it's going to give you a weird answer. |
| 00:05:57 | <dsal> | > ord 'ß' - ord 'a' + 1 |
| 00:05:58 | <lambdabot> | 127 |
| 00:06:08 | <gqplox> | But i mean the point is my program is supposed to give an output for the specified input |
| 00:06:15 | <mauke> | right |
| 00:06:19 | <EvanR> | what if you parse the file and it contains bytes over 255? xD |
| 00:06:32 | <EvanR> | unlikely but it would give weird answers! |
| 00:06:34 | <geekosaur> | bytes?? |
| 00:06:34 | <EvanR> | better check |
| 00:06:34 | × | Topsi quits (~Topsi@dialin-80-228-141-008.ewe-ip-backbone.de) (Read error: Connection reset by peer) |
| 00:06:36 | <gqplox> | and if i know my input for the purpose of the problem, is ok right? i mean ofc for real code this would not be good practice |
| 00:06:48 | <EvanR> | ok, characters above 1112111 |
| 00:06:49 | <dsal> | Sure. Depends on what you want to get out of it and what you're asking for WRT input on your code. |
| 00:06:51 | <geekosaur> | slightly more than "unlikely" |
| 00:07:06 | <dsal> | For me, if it's not good practice in the real world, then I'd want to avoid it. |
| 00:07:13 | × | thyriaen quits (~thyriaen@2a01:aea0:dd4:470d:6245:cbff:fe9f:48b1) (Quit: Leaving) |
| 00:07:17 | <gqplox> | Oh right, I agree asking for feedback the question was vaugue |
| 00:07:23 | <EvanR> | yeah real code should properly parse the input and reject invalid |
| 00:07:27 | <mauke> | my point is: if you're going to complain about head (because the sample input might be malformed), then you should also be wary of priority (because the sample input might be malformed) |
| 00:07:35 | <gqplox> | Thanks for the info, I will keep that in mind |
| 00:07:39 | <mauke> | personally, I'm not going to complain about head :-) |
| 00:08:00 | <dsal> | Yeah, that's valid. I'm also parsing satisfying `isLetter` so I have the same bug. |
| 00:08:03 | <mauke> | (but I did implement a proper range check on prio in my version) |
| 00:08:10 | <gqplox> | tomorrow ill try to write it to handle a wider range |
| 00:09:11 | <dsal> | OK. Mine only parses characters I told it are valid now. woo. |
| 00:09:11 | <EvanR> | AoC has an FAQ about bugs in the problem. The answer is basically, "by the time you figured this out, so many people will have solved the problem, it's probably you" xD |
| 00:10:23 | <mauke> | my solution for part 2: http://sprunge.us/pRoBDG |
| 00:10:58 | × | Guest26 quits (~Guest26@2001:999:488:5cc:e5b0:b492:b43a:8f46) (Ping timeout: 260 seconds) |
| 00:11:34 | <dsal> | gqplox: In my case, I am using `Sum Int` instead of `Int` so I can just `fold` any values. `foldMap priority` will give the same answer as `priority . head` in the case where there's exactly one result, but will not fail for 0 and not discard findings > 1. If you do find yourself in either of those situations, it's a bug. Not impossible you get the wrong answer in the latter case, but program will crash in the former. |
| 00:12:21 | <c_wraith> | EvanR: There *have* been a couple days in previous years where one problem set didn't match its expected answer |
| 00:12:32 | <EvanR> | oof |
| 00:12:53 | <dsal> | Also, there've been days where my solution would get the right answer for everyone's input by mine. Unrelated, but pretty annoying. |
| 00:13:05 | <dsal> | s/by/but/ |
| 00:13:27 | <gqplox> | mniip by single pass does that mean I can't use tail for example? |
| 00:13:56 | <dsal> | single pass just means you don't start at the beginning of the list and walk down it more than once. |
| 00:14:19 | <EvanR> | if a program is a pile of functions, and every function is correct, the program must be correct. QED? |
| 00:14:41 | <c_wraith> | but haskell programs aren't piles of functions! they have those pesky IO bits thrown in |
| 00:14:43 | <dsal> | That's the hard part. Every function does what I want it to do, but not what the problem wants done. |
| 00:15:08 | <c_wraith> | main is notably *not* a function in Haskell. Ruining that one blog's title. |
| 00:15:10 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 00:15:21 | <EvanR> | which blog |
| 00:15:35 | <mauke> | "main is usually a function" or something like that. C compiler diagnostic |
| 00:16:09 | <mauke> | for when you do: unsigned char main[] = { ... }; // and write your whole program as inline machine code |
| 00:16:33 | <EvanR> | not bad |
| 00:17:10 | <mauke> | https://www.ioccc.org/1984/mullender/mullender.c |
| 00:17:15 | <mauke> | absolute classic |
| 00:17:48 | <dsal> | That's a short main. Is there a longer version? |
| 00:18:12 | <mauke> | m__a__i__n |
| 00:18:16 | geekosaur | wonders what CPU that was for |
| 00:18:39 | <mauke> | CPUs, plural |
| 00:18:48 | <mauke> | it ran on VAX and ... something? |
| 00:19:08 | <mauke> | oh yeah, PDP-11 |
| 00:19:18 | <geekosaur> | VAX and PDP11 would be likely since VAX-11 was a PDP-11 with a real MMU |
| 00:19:36 | <gqplox> | http://sprunge.us/l1WW42 so is this a single pass or not? |
| 00:19:46 | <mauke> | "The first word is a PDP-11 branch instruction that branches to the rest of the PDP code. On the Vax main is called with the calls instruction which uses the first word of the subroutine as a mask of registers to be saved. So on the Vax the first word can be anything. The real Vax code starts with the second word." |
| 00:19:57 | <gqplox> | because of the init and last i think no? |
| 00:20:10 | <c_wraith> | gqplox: also the calls to length |
| 00:20:16 | <dsal> | that's a lot of passes. :) |
| 00:20:20 | <gqplox> | oh yeah |
| 00:20:30 | → | Guest26 joins (~Guest26@2001:999:488:5cc:e5b0:b492:b43a:8f46) |
| 00:20:31 | × | meooow quits (~meooow@165.232.184.169) (Ping timeout: 265 seconds) |
| 00:20:33 | → | meooow_ joins (~meooow@165.232.184.169) |
| 00:20:53 | <c_wraith> | that's O(n^2), in fact. |
| 00:21:16 | <c_wraith> | I didn't bother doing it in a single pass, but I at least made it O(n) |
| 00:21:28 | <EvanR> | half [] = ([],[]); half [a,b] = ([a],[b]); half (x:xs) = _ -- there I started your recursive solution for you |
| 00:21:28 | <mauke> | ... leading straight to the other blog title, "accidentally quadratic" |
| 00:21:49 | <gqplox> | half :: String -> [String] |
| 00:21:49 | <gqplox> | half x = [take l x, drop l x] |
| 00:21:49 | <gqplox> | where |
| 00:21:49 | <gqplox> | l = length x `div` 2 |
| 00:21:55 | <gqplox> | this is o n tho right? |
| 00:22:15 | <c_wraith> | yes, that's O(n). several passes, but a fixed number of them. |
| 00:23:28 | <c_wraith> | in particular, each of length, take, and drop is a separate pass. |
| 00:24:10 | <gqplox> | in haskell is length O(n)? can you not just set a value somewhere with the value of length and update that |
| 00:24:20 | <dsal> | Set it where? |
| 00:24:26 | <c_wraith> | well, length of lists is O(n) |
| 00:24:30 | <EvanR> | you were given a list, not list + length attached |
| 00:24:36 | <c_wraith> | Other data structures do other things. |
| 00:24:37 | <EvanR> | unfortunately |
| 00:25:03 | <EvanR> | so you could measure it or do something else |
| 00:25:05 | <c_wraith> | Data.Sequence.Seq essentially *does* have a length attached. As well as just being a totally different structure. |
| 00:25:10 | <gqplox> | i mean in the implementation of it? |
| 00:25:13 | <mauke> | a Haskell list is literally¹ just: data List a = Nil | Cons a (List a) |
| 00:25:15 | <mauke> | 1) not literally |
| 00:25:24 | <gqplox> | but i guess that doesn't work with the way hsakell is |
| 00:25:33 | <geekosaur> | you want a Vector not a List |
| 00:25:34 | <c_wraith> | gqplox: That would slow down a lot of common use cases |
| 00:25:37 | <gqplox> | it would be kind of a special case |
| 00:25:47 | <mauke> | it's actually data [a] = [] | (:) a [a], but that's a syntax error |
| 00:25:48 | <geekosaur> | lists are loops encoded as data |
| 00:25:53 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 00:26:01 | <c_wraith> | gqplox: taking the length of a list is not a common operation. It shouldn't be optimized for. |
| 00:26:23 | <EvanR> | at least, length of a super long list isn't common |
| 00:26:33 | <dsal> | Lists can be *really* long. |
| 00:26:41 | <EvanR> | because the author probably prematurely optimized by not using a list |
| 00:27:05 | <dsal> | :t length |
| 00:27:06 | <lambdabot> | Foldable t => t a -> Int |
| 00:27:12 | <dsal> | It's easy to make a list so large an Int can't hold the length. |
| 00:27:21 | <c_wraith> | If you really want to work with the length of a data structure, there are definitely better options than lists |
| 00:27:44 | <mauke> | > repeat 4 |
| 00:27:45 | <lambdabot> | [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4... |
| 00:27:48 | × | Tuplanolla quits (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) (Quit: Leaving.) |
| 00:27:51 | <mauke> | what a long list |
| 00:27:55 | <EvanR> | longer than Int, check |
| 00:28:15 | <dsal> | You can make an integer length function to get the size of it, though. |
| 00:28:38 | <EvanR> | unless you're an ultrafinitist, and you're chosen max bound is less than maxBound :: Int |
| 00:28:43 | <EvanR> | your |
| 00:29:03 | <mauke> | struct node loop = { 4, &loop }; |
| 00:29:28 | <EvanR> | > genericLength (repeat 4) :: Integer |
| 00:29:35 | <dsal> | @src repeat |
| 00:29:36 | <lambdabot> | repeat x = xs where xs = x : xs |
| 00:29:37 | <lambdabot> | mueval-core: Time limit exceeded |
| 00:29:37 | <lambdabot> | mueval.real: ExitFailure 1 |
| 00:30:00 | <dsal> | Oh, I didn't know genericLength was a thing. That's neat. |
| 00:30:46 | <EvanR> | > genericLength (replicate 257 'a') :: Word8 |
| 00:30:48 | <lambdabot> | 1 |
| 00:31:01 | <dsal> | genericLength isn't very generic. |
| 00:31:08 | <dsal> | :t genericLength |
| 00:31:09 | <lambdabot> | Num i => [a] -> i |
| 00:31:24 | <monochrom> | Taking the length of a list is not a common operation except for very short lists, it shouldn't encourage safe usage for long lists. >:) |
| 00:31:30 | <EvanR> | should it map to a MetricSpace or something? xD |
| 00:31:45 | <mauke> | > genericLength (replicate 257 'a') :: Float |
| 00:31:46 | <lambdabot> | 257.0 |
| 00:31:49 | <c_wraith> | it should map to an Enum |
| 00:32:03 | <mauke> | > genericLength (replicate 257 'a') :: Complex Float |
| 00:32:03 | <c_wraith> | just be a bunch of calls to succ |
| 00:32:05 | <lambdabot> | 257.0 :+ 0.0 |
| 00:32:16 | <dsal> | > superGenericLength Nothing :: Integer |
| 00:32:17 | <lambdabot> | 0 |
| 00:32:26 | <dsal> | superGenericLength :: (Foldable f, Num i) => f a -> i; superGenericLength = getSum . foldMap (const 1) |
| 00:32:42 | <EvanR> | nothing should operate on lists ever |
| 00:32:47 | <EvanR> | only Foldables |
| 00:33:07 | <monochrom> | Foldable has length too :) |
| 00:33:09 | <EvanR> | nothing should use map, only fmap |
| 00:33:22 | <EvanR> | nothing should use return only pure |
| 00:33:30 | <dsal> | ^ I can't tell if you're mocking me. |
| 00:34:05 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 00:34:58 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 00:35:00 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 248 seconds) |
| 00:35:46 | <mauke> | :t fmap fmap fmap fmap fmap getSum foldMap pure 1 |
| 00:35:47 | <lambdabot> | error: |
| 00:35:47 | <lambdabot> | • Couldn't match type ‘Sum b’ with ‘t0 a0 -> t1’ |
| 00:35:48 | <lambdabot> | Expected type: (((a0 -> t1) -> b) -> (t1 -> a0 -> t1) -> t1 -> b) |
| 00:35:51 | <mauke> | dang |
| 00:36:11 | <dsal> | I'm pretty sure I've written that before. |
| 00:36:48 | <EvanR> | never compose just functions, only semigroupoids! |
| 00:36:53 | <mauke> | oh, I'm dumb |
| 00:37:00 | <dsal> | we need variants of fmap like all the car/cdr variations. |
| 00:37:02 | <iqubic> | What are semigroupoids? |
| 00:37:09 | <dsal> | iqubic: monoids without mempty |
| 00:37:18 | <EvanR> | category without necessarily id |
| 00:37:24 | <iqubic> | Isn't that just a semigroup? |
| 00:37:42 | <dsal> | Yeah, but you get a lot of cool operations you are annoyed are missing from base. |
| 00:37:52 | <gqplox> | btw if I want to make a function half String -> [String] and I used splitAt which gives (String, String) what's the cleanest way to write it? |
| 00:37:55 | <dsal> | https://hackage.haskell.org/package/semigroupoids |
| 00:37:58 | <EvanR> | a semigroup is a semigroupoid with only 1 object |
| 00:38:37 | <iqubic> | gqplox: I literally asked the same thing yesterday. |
| 00:38:46 | <dsal> | @hoogle (a,a) -> [a] |
| 00:38:47 | <lambdabot> | Data.Ix.Enum range :: Enum a => (a, a) -> [a] |
| 00:38:47 | <lambdabot> | Data.Ix range :: Ix a => (a, a) -> [a] |
| 00:38:47 | <lambdabot> | GHC.Arr range :: Ix a => (a, a) -> [a] |
| 00:38:54 | <dsal> | There's a bunch of useless answers. |
| 00:39:03 | <iqubic> | I used biList |
| 00:39:09 | <iqubic> | @hoogle biList |
| 00:39:09 | <lambdabot> | Data.Bifoldable biList :: Bifoldable t => t a a -> [a] |
| 00:39:09 | <lambdabot> | RIO.Prelude biList :: Bifoldable t => t a a -> [a] |
| 00:39:09 | <lambdabot> | Relude.Foldable.Reexport biList :: Bifoldable t => t a a -> [a] |
| 00:39:23 | <EvanR> | half sounds like it returns 1/2 of something |
| 00:39:25 | <iqubic> | I'm not sure if that's the best way to do it. |
| 00:39:35 | <EvanR> | this problem is to bisect a string or list into 2 parts |
| 00:39:47 | <EvanR> | just jargon policing |
| 00:40:10 | <iqubic> | EvanR: This is most likely an Advent Of Code related question. |
| 00:40:17 | <EvanR> | yes |
| 00:40:24 | <dsal> | EvanR just got that Radiohead song stuck in my head. |
| 00:41:13 | <iqubic> | What is this complex diagram on the semigroupoids Hackage page |
| 00:41:28 | → | jmdaemon joins (~jmdaemon@user/jmdaemon) |
| 00:41:29 | <EvanR> | it's ed kmett |
| 00:41:36 | → | neminis joins (~neminis@43.21.135.77.rev.sfr.net) |
| 00:41:51 | <iqubic> | What the heck are Divise and Decide and their subclasses! |
| 00:42:25 | <dsal> | The contravariant analogue of Apply; it is Divisible without conquer. |
| 00:42:34 | <gqplox> | oh nice |
| 00:42:35 | <iqubic> | I understand what Contravariant is. |
| 00:42:40 | <gqplox> | thank you cubic |
| 00:42:48 | <iqubic> | dsal: I have no idea what conquer is. |
| 00:43:00 | <dsal> | Conquer acts as an identity for combining Divisible functors. |
| 00:43:04 | <iqubic> | Apply, Bind, and Extend (not shown) give rise the Static, Kleisli and Cokleisli semigroupoids respectively. |
| 00:43:08 | <dsal> | I've not used all of the things. |
| 00:43:14 | <iqubic> | We're just making up words at this point... |
| 00:43:29 | <dsal> | Some of them are just cowords. |
| 00:43:29 | <EvanR> | all words are made up |
| 00:43:51 | <edwardk> | it is? |
| 00:44:12 | edwardk | tunes in. |
| 00:44:25 | <iqubic> | edwardk: What's the point of the semigroupoid package? |
| 00:44:44 | <dsal> | I found the semigroupoid package the other way -- I needed things that I expected from base that it provided. |
| 00:45:04 | <edwardk> | Map k -- can almost be a monad, but can't implement return. Lots of other things can almost be Applicative but lack pure. When working with Comonads in particular. |
| 00:45:05 | <dsal> | e.g., Data.Semigroup.Foldable |
| 00:45:21 | <dsal> | We were discussing Alt yesterday. |
| 00:45:34 | <edwardk> | I needed ways to fold over non-empty containers with a semigroup |
| 00:45:36 | <dsal> | `Either a` can't be `Alternative` |
| 00:45:45 | <iqubic> | I see. |
| 00:45:56 | <gqplox> | @pl half x = biList (splitAt (length x `div` 2) x) |
| 00:45:57 | <lambdabot> | half = biList . (splitAt =<< (`div` 2) . length) |
| 00:46:07 | <gqplox> | lol |
| 00:46:25 | <dsal> | Sometimes @pl is "make my code a lot worse" |
| 00:46:42 | <EvanR> | seems like biList is a bit much just to make \(x,y) -> [x,y] |
| 00:47:00 | <gqplox> | yeah I agree |
| 00:47:03 | <iqubic> | Wait... Why can't you Data.Map.Empty as the identity for a potential Map k Monad? |
| 00:47:06 | <gqplox> | still, cool to know about |
| 00:47:09 | <edwardk> | the Category class is pretty restrictive given that it has to work for every object in its argument kind, so you couldn't implement something where you had restricted categories that used a constraint on the objects, hence the Ob machinery in there and Semigroupoids. |
| 00:47:22 | <edwardk> | Useful when you want to build a category for matrices for instances. |
| 00:47:29 | <iqubic> | I understand. |
| 00:47:57 | <edwardk> | iqubic: Empty >>= k = Empty |
| 00:48:09 | <edwardk> | iqubic: fails to serve as return |
| 00:48:17 | <iqubic> | If we have biapply, why is there no bipure? |
| 00:48:44 | <edwardk> | iqubic: because there's at least 2-3 notions of it. |
| 00:48:53 | <iqubic> | Oh? |
| 00:49:02 | <edwardk> | well, first of all i don't like Pointed-style classes |
| 00:49:20 | <edwardk> | so a version with _just_ bipure has the problem that Pointed as a superclass of Applicative has |
| 00:49:35 | <edwardk> | you get the point but no non-free laws, so its basically useless |
| 00:50:22 | <edwardk> | a version where it comes with the class? Well we have Biapplicative. Given the ability to rewrite the class hierarchy? I'd put Biapply or whatever as a superclass of it, but with all the others borked doing one just creates asymmetries and pain |
| 00:50:22 | <iqubic> | Why are Pointed-style classes not so good? Is it because you get an identity, but not the corresponding operation? |
| 00:51:00 | <edwardk> | iqubic: given a PointedFunctor there's very little you can do with it. you get one law fmap f . pure = pure . f -- but that law is a free theorem |
| 00:51:15 | <iqubic> | Yeah, that makes sense. |
| 00:51:18 | <edwardk> | on the other hand the semi-applicative Apply style classes actually come with a useful law |
| 00:51:35 | <gqplox> | also guys can I ask a general question, how much of this stuff that you're talking about now is used / required in writing good haskell software? im still very much a beginner but i was thinking id get to the point of writing somewhat useful software kind of soon. |
| 00:52:14 | <edwardk> | but if you put _both_ of them together then you fuck your users over again. because now things will infer as only needing Biapply + Bipure or whatever it is called, and you'll silently omit the fact that you need the law that says the applicative-like operation and the pure-like operation need to be compatible! |
| 00:52:32 | <dsal> | gqplox: There are a few things you use *all* the time and there are things you don't often want to use. Not sure which "this stuff" you're referring to, though. |
| 00:52:46 | <edwardk> | so given that when you have a Pointed class _it has no laws_ interoperating with Functor whatsoever, I instead just make Pointed its own class, with no PointedFunctor composite |
| 00:52:54 | <edwardk> | and then actively discourage people using it |
| 00:53:17 | <edwardk> | because otherwise you get abominations like 'foldMap pure' in user code which is completely impossible to reason about |
| 00:53:27 | <iqubic> | Yeah, that makes a lot of sense. |
| 00:53:30 | <edwardk> | because consider its behavior when returning a [a], Maybe a or Set a. |
| 00:53:38 | <edwardk> | each does something completely different and unrelated |
| 00:53:59 | <gqplox> | i don't know really, I'm just seeing a lot of new words haha |
| 00:54:06 | <gqplox> | biapplicatives semigroupoids comonads |
| 00:54:41 | <iqubic> | Much of these words are things you can mostly ignore. |
| 00:54:42 | <edwardk> | if you are going to work or provide a user with a typeclass, it should be possible to reason and work at the level of the class, not just reason instance by instance because you happen to be using it for some lawless syntactic sugar |
| 00:54:43 | × | Guest26 quits (~Guest26@2001:999:488:5cc:e5b0:b492:b43a:8f46) (Ping timeout: 260 seconds) |
| 00:54:43 | <dsal> | Words are neat for distinct concepts because they're easier to search for. edwardk did a talk on that at some point. |
| 00:54:49 | <EvanR> | start with functors |
| 00:54:58 | <EvanR> | I just keep repeating this advice xD |
| 00:55:12 | <gqplox> | ok cool thank you :) |
| 00:55:16 | <iqubic> | Start with functors, then go to applicatives |
| 00:55:24 | <dsal> | Yeah, classes you're going to use every day: Functors, Applicative Functors, Monads. Monoids start getting really useful fast. |
| 00:55:34 | <edwardk> | gqplox: the stuff i'm talking about here isnt necessary at all to get started with haskell. |
| 00:56:07 | <edwardk> | gqplox: eventually you'll start seeing the same kind of operations on lots of different types, and that might get you curious to see if there's a name for the patterns you are seeing. that's when some of these more exotic sounding terms will have more relevance |
| 00:56:26 | <gqplox> | alright, that makes sense |
| 00:56:28 | <gqplox> | thank you |
| 00:56:31 | <dsal> | e.g., you used foldr1 yesterday. What does that do on empty input? |
| 00:56:39 | <dsal> | > foldr1 (+) [] |
| 00:56:40 | <lambdabot> | *Exception: Prelude.foldr1: empty list |
| 00:57:28 | <dsal> | semigroupoids has a variant that won't compile with non-empty input. You'll reach for that when you start thinking "how do I stop having these partial function bugs?" |
| 00:57:36 | <gqplox> | oh yeah i was happy i found that, initially i did something like foldr with the base conditition as ['a'..'z'] ++ ['A'..'Z'] lol |
| 00:57:38 | <edwardk> | gqplox: i believe in trying to actually give things the right name from mathematics. why? because then when i write down a piece of code, later on someone can google for that term, find something from the 1970s or before i was born that tells me more about my code than i knew. if i make up all the words and all the laws for my constructions then users can only reflect back to me bad understandings of my own ideas. |
| 00:57:49 | <dsal> | er, won't compile without guaranteeing non-empty input |
| 00:58:04 | <gqplox> | oh right that sounds useful |
| 00:58:38 | × | acidjnk quits (~acidjnk@p200300d6e7137a51dd9a34ca5f6ed83a.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 00:58:49 | <mauke> | gqplox: I'd say Functor and Monoid are surprisingly simple and useful classes in Haskell, despite the weird names. the rest ... eh, you might come across them or not |
| 00:58:53 | <EvanR> | the next 700 programming languages tend to rename things, or use existing names for something previously unrelated. So I appreciate that |
| 00:59:18 | <EvanR> | our associative arrays are different ism |
| 00:59:30 | → | beteigeuze joins (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
| 00:59:32 | <gqplox> | also does recursion become easy after some time? I get if for basic simple functions but for example i was reading the source for splitAt just now and its not immediately obvious, id have to draw the example on paper to full get it |
| 00:59:46 | <mauke> | @src splitAt |
| 00:59:46 | <lambdabot> | splitAt n xs = (take n xs, drop n xs) |
| 00:59:54 | <mauke> | well, that's cheating |
| 01:00:00 | <dsal> | Another way to look at that is like, in go for example, there's exactly one kind of loop: `for` (ignore recursion since that's not really used). Anything you do more than one time is "a for loop." In haskell, we've got names for the different kinds of things you're doing. Some of them are more… colloquial (fold and unfold for catamorphism and anamorphism), but having distinct names makes a lot of stuff better. |
| 01:00:20 | <gqplox> | http://sprunge.us/4FUbX0 |
| 01:00:44 | <dsal> | gqplox: recursion is pretty natural, but there's a lot of cases that are already solved for you so you don't need explicit recursion most of the time. |
| 01:00:50 | <gqplox> | yeah true, I guess it is beneficial to have specific terminology |
| 01:01:15 | <EvanR> | this game infinite turtles does a pretty good job and getting you into the recursive mood |
| 01:01:34 | <dsal> | But whole lots of recursion you might be writing may just be `foldr`. |
| 01:01:37 | <EvanR> | to solve the puzzle... assume you have a working solution already, it just doesn't work for the base |
| 01:01:50 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 01:02:12 | <dsal> | @src length |
| 01:02:12 | <lambdabot> | Source not found. Maybe if you used more than just two fingers... |
| 01:02:38 | <mauke> | gqplox: yes, simple cases of recursion become much easier to understand with practice |
| 01:02:42 | → | nate4 joins (~nate@98.45.169.16) |
| 01:03:00 | <mauke> | gqplox: e.g. for me, most of the complexity of splitAt isn't in the recursive part, but everything else :-) |
| 01:03:06 | → | brettgilio joins (~brettgili@x-irc.gq) |
| 01:04:26 | <gqplox> | also unrelated but its a bit annoying that i lose all the chat history when i log out each time of irc |
| 01:04:35 | <dsal> | A lot of times, though, you just don't need explicit recursion. There are all these morphisms ready for you. |
| 01:04:36 | <EvanR> | what client are you using |
| 01:04:38 | <mauke> | it helps that [ ] is a recursive type, so recursive functions on lists tend to follow a certain pattern |
| 01:04:38 | → | califax joins (~califax@user/califx) |
| 01:04:41 | <gqplox> | i mean sometimes i might miss useful chat |
| 01:04:50 | <dsal> | There's logs in the topic |
| 01:04:56 | <gqplox> | yeah, i think the where clause threw me off |
| 01:05:23 | <gqplox> | i just need to not be lazy and write it down once i think |
| 01:05:29 | <gqplox> | im using Textual |
| 01:06:20 | <EvanR> | it should have a local log keeping function |
| 01:06:34 | <dsal> | It's logging out that's the issue. |
| 01:06:38 | <dsal> | I've not logged out of my irc client in years. |
| 01:06:41 | <iqubic> | So I know things like "newtype Predicate a = Predicate { runPredicate :: a -> Bool }" can only have a contravariant functor instance and not a covariant, becase the type parameter is in a negative position. Do contravariant applicatives and contravariant monads exist? |
| 01:06:49 | <gqplox> | but i lost my registration key and cant find it in my emails and reset my mac so i might not be for very long haha, currently on the free trial |
| 01:06:51 | <EvanR> | oh yeah, that needs other solutions |
| 01:07:24 | <EvanR> | contravariant monads = comonad? |
| 01:07:32 | <gqplox> | i just turn off my pc when im not using it |
| 01:07:38 | <iqubic> | Yeah... I just realize that, EvanR |
| 01:07:54 | × | nate4 quits (~nate@98.45.169.16) (Ping timeout: 260 seconds) |
| 01:08:54 | <dsal> | gqplox: If you want some light reading: https://maartenfokkinga.github.io/utwente/mmf91m.pdf |
| 01:08:58 | <mauke> | https://what.thedailywtf.com/assets/uploads/files/1670107165928-c7260411-d79f-43c0-bc90-c6173eb1af99-grafik.png |
| 01:09:57 | <iqubic> | I just found Data.Functor.Contravariant.Divisible from edwardk's Contravariant package. |
| 01:10:00 | <edwardk> | EvanR: comonad /= contravariant monad |
| 01:10:06 | <edwardk> | contravariant functors exist |
| 01:10:20 | <edwardk> | both monads and comonads are _co_variant functors |
| 01:10:25 | <EvanR> | doh |
| 01:10:34 | <gqplox> | hmm I shall see how far i can get through that dsal |
| 01:10:40 | <edwardk> | e.g. Comonad has Functor as a superclass |
| 01:10:48 | <EvanR> | of course |
| 01:10:48 | <iqubic> | Is Divisible the contravariant form of Applicative? |
| 01:11:01 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 01:11:05 | <edwardk> | iqubic: effectively, yes |
| 01:11:08 | <gqplox> | anyway bye for now guys |
| 01:11:13 | <dsal> | gqplox: It's not super casual, but it explains a few concepts and why it's cool to have names for things *and* reusable implementations that can be combined and optimized. |
| 01:11:17 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 01:11:29 | <gqplox> | okay |
| 01:11:37 | → | ksqsf joins (~user@134.209.106.31) |
| 01:11:49 | <mauke> | if you know the name of a thing, you have power over it |
| 01:11:50 | <edwardk> | Decidable slots in like contravariant Alternative as well |
| 01:12:28 | <iqubic> | As a wise lady once said: "fear of a name only increases fear of the thing itself" |
| 01:12:46 | <edwardk> | Divisible and Decidable are one of those rare occasion when i was comfortable making up a name. (I did a lot of that for the contravariant and comonad side of the ecosystem, because cofoo and contrafoo generally doesn't give a lot of good intuitions) |
| 01:13:33 | <yushyin> | iqubic: JKR? |
| 01:13:34 | <gqplox> | was the wise lady Dumbledore? haha |
| 01:13:37 | <iqubic> | Where can I go to learn more about how Divisible and Decidable work in Haskell? |
| 01:13:48 | <edwardk> | iqubic: re: "contravariant monads" that can't exist. |
| 01:13:54 | <iqubic> | yushyin: Yes. It's a Hermione quote. |
| 01:13:59 | <edwardk> | but the contravariant applicative/alternatives can |
| 01:14:15 | <iqubic> | edwardk: I guess that makes some sort of sence. |
| 01:14:22 | <iqubic> | s/sence/sense/ |
| 01:14:45 | <edwardk> | iqubic: https://www.youtube.com/watch?v=cB8DapKQz-I is when i introduced them |
| 01:14:56 | <gqplox> | wait really? I swear it was Dumbledore |
| 01:15:19 | <iqubic> | Thank you for that video. I'll watch it after getting dinner. |
| 01:15:24 | <iqubic> | Bye for now folks. |
| 01:16:06 | <edwardk> | later iqubic |
| 01:16:50 | <iqubic> | Thanks for helping a girl understand this stuff better. |
| 01:17:01 | <edwardk> | gqplox: re: losing context every time you log out of irc. options exist: using matrix to connect instead of an irc client is one option. using irccloud so your connection persists is another (but costs $) |
| 01:17:26 | <gqplox> | oh right nice ill look into those, thanks you |
| 01:17:35 | <gqplox> | oh i think i've used matrix before |
| 01:18:03 | <iqubic> | Also, thank you so much for making the lens package. I use it all the time in my haskell code. I love being able to do complex traversals of my data. |
| 01:18:05 | <yushyin> | gqplox: sr.ht can provide you with a free bouncer, afaik |
| 01:18:16 | <edwardk> | if you have some kind of linux server nearby you can also set up some kind of bouncer or find an irc bouncer service |
| 01:18:30 | <iqubic> | Also, I love lenses over state. |
| 01:18:39 | <gqplox> | ah right |
| 01:18:39 | <iqubic> | And now I really must go. |
| 01:18:41 | <edwardk> | i'm rather partial to them as well =) |
| 01:19:00 | → | king_gs joins (~Thunderbi@187.201.204.122) |
| 01:19:44 | <edwardk> | gqplox: in the ancient past i used to use something like screen or mosh or tmux and just keep an ircii session open on a machine somewhere, but i confess i've gotten too lazy and kind of like the conveniences of using a browser-based irc client |
| 01:19:51 | <gqplox> | oh i thinnk its for paid users |
| 01:20:34 | <gqplox> | which client do you use edward? irccloud? |
| 01:21:15 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 01:23:13 | <ephemient> | irccloud works for free users too, you just have some limitations. |
| 01:23:34 | × | ksqsf quits (~user@134.209.106.31) (Ping timeout: 256 seconds) |
| 01:25:06 | × | causal quits (~user@50.35.85.7) (Quit: WeeChat 3.7.1) |
| 01:30:01 | → | gqplox[m] joins (~gqploxmat@2001:470:69fc:105::2:d10d) |
| 01:30:20 | <dsal> | I've been using irccloud for a long time. It's pretty great. |
| 01:30:34 | <gqplox[m]> | hi |
| 01:30:37 | <gqplox> | hello |
| 01:30:58 | <EvanR> | I saw hi then hello |
| 01:31:04 | <edwardk> | i use irccloud just out of convenience |
| 01:31:05 | <EvanR> | radio check passed |
| 01:31:21 | <gqplox[m]> | nice :) |
| 01:31:23 | <edwardk> | mostly so i can flip over to check irc on my phone when i'm out and about |
| 01:31:33 | <dsal> | Yeah, while being the same user. :) |
| 01:31:36 | <gqplox[m]> | well from now on I guess ill use this |
| 01:31:44 | <gqplox[m]> | goodnight guys |
| 01:31:48 | <edwardk> | matrix has a lot of afficionados on here |
| 01:31:54 | × | gqplox quits (~textual@97e650e2.skybroadband.com) (Quit: Textual IRC Client: www.textualapp.com) |
| 01:31:54 | <edwardk> | night, ggplox[m] |
| 01:31:57 | dsal | should try matrix again sometime |
| 01:32:20 | → | king_gs1 joins (~Thunderbi@187.201.204.122) |
| 01:32:23 | × | king_gs quits (~Thunderbi@187.201.204.122) (Quit: king_gs) |
| 01:32:24 | king_gs1 | is now known as king_gs |
| 01:32:27 | <geekosaur> | yeh, I use matrix on my phone. but keep irc on the desktop because matrix sucks for admin stuff irc-side |
| 01:33:20 | × | king_gs quits (~Thunderbi@187.201.204.122) (Client Quit) |
| 01:34:07 | × | jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 252 seconds) |
| 01:34:24 | <yushyin> | weechat/glowing-bear/weechat-android for me |
| 01:36:26 | <sm> | element matrix client on all machines here. Previously/still, erc in persistent emacs/dtach/mosh on a linode |
| 01:38:00 | <dsal> | I think last time I tried running a matrix service it was… hard. I used to do everything with xmpp but for whatever reason we had to reinvent that a bunch of times. |
| 01:38:17 | <yushyin> | :D |
| 01:38:22 | → | razetime joins (~quassel@49.207.211.219) |
| 01:41:41 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Quit: ChaiTRex) |
| 01:43:05 | <yin> | anyone here using hls with neovim? |
| 01:43:33 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 01:43:49 | <yin> | all i want is to know the inferred type of a function on hover and i can't seem to do it :'( |
| 01:43:53 | <geekosaur> | luckily you don't have to run a matrix service yourself, you can use an existing one |
| 01:45:16 | <geekosaur> | sorry, never used hls with anything but vscode |
| 01:46:13 | → | ksqsf joins (~user@134.209.106.31) |
| 01:47:18 | <yushyin> | i do. yin, you can use vim.lsp.buf.code_action to insert the inferred type |
| 01:50:52 | <geekosaur> | yin, is that neovim in a terminal or as a gui app? hover actions won't work too well in the terminal version, even if it knows how to use $WINDOWID |
| 01:51:32 | <geekosaur> | (I don't even know if neovim has a gui version…) |
| 01:54:26 | → | glider_ joins (~glider@76.202.115.164) |
| 01:55:33 | × | glider_ quits (~glider@76.202.115.164) (Remote host closed the connection) |
| 01:55:46 | <dsal> | I tried vscode on my iPad, but it doesn't support hls. |
| 01:57:28 | → | anderson_ joins (~ande@76.202.115.164) |
| 01:58:08 | <yushyin> | probably wouldn't have enough ram anyway. needs about 2-3GB for a simple project |
| 02:03:53 | <dsal> | It could theoretically run it elsewhere. It was letting me edit source files on my raspberry pi via ssh. |
| 02:07:50 | → | eldritch_ joins (~eldritch@76.202.115.164) |
| 02:10:41 | → | Guest20 joins (~Guest20@2001:999:488:5cc:e5b0:b492:b43a:8f46) |
| 02:12:29 | × | tomokojun quits (~tomokojun@37.19.221.160) (Quit: じゃあね〜。) |
| 02:13:20 | <Guest20> | @pl (\x y -> intersection (fromList x) (fromList y)) |
| 02:13:20 | <lambdabot> | (. fromList) . intersection . fromList |
| 02:15:20 | <dsal> | Guest20: have x and y already be whatever `fromList` is doing. |
| 02:16:19 | <dsal> | That particular answer is amazingly bad, though. |
| 02:17:03 | <Guest20> | Why is it bad? |
| 02:17:05 | <dsal> | You might as well write `(fromList -> x) -> intersection x . fromList` but don't do that. |
| 02:17:19 | <dsal> | It's not clear at all what's happening in the @pl suggestion. |
| 02:17:25 | <yushyin> | not everything has to be pointfree ... |
| 02:17:31 | <glguy> | :t on |
| 02:17:31 | <lambdabot> | (b -> b -> c) -> (a -> b) -> a -> a -> c |
| 02:18:09 | <dsal> | :t on intersection fromList |
| 02:18:10 | <lambdabot> | error: |
| 02:18:10 | <lambdabot> | • Variable not in scope: intersection :: b0 -> b0 -> c |
| 02:18:10 | <lambdabot> | • Perhaps you meant one of these: |
| 02:18:19 | <dsal> | :t on S.intersection S.fromList |
| 02:18:20 | <lambdabot> | Ord a => [a] -> [a] -> S.Set a |
| 02:20:44 | <dsal> | `on` looks better infix there, I think. |
| 02:20:52 | <dsal> | :t S.intersection `on` S.fromList |
| 02:20:53 | <lambdabot> | Ord a => [a] -> [a] -> S.Set a |
| 02:21:45 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 02:22:12 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 248 seconds) |
| 02:24:45 | <Guest20> | Thanks, that looks better indeed. Which module has on? |
| 02:25:03 | <dsal> | @hoogle on |
| 02:25:03 | <lambdabot> | Data.Function on :: (b -> b -> c) -> (a -> b) -> a -> a -> c |
| 02:25:04 | <lambdabot> | System.Directory.Internal.Prelude on :: () => (b -> b -> c) -> (a -> b) -> a -> a -> c |
| 02:25:04 | <lambdabot> | Text.Regex.TDFA.Common on :: (t1 -> t1 -> t2) -> (t -> t1) -> t -> t -> t2 |
| 02:26:25 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Ping timeout: 260 seconds) |
| 02:28:00 | × | money quits (Guest1418@user/polo) () |
| 02:29:31 | → | money joins (~money@user/polo) |
| 02:30:06 | <Guest20> | @hoogle ord |
| 02:30:06 | <lambdabot> | Data.Char ord :: Char -> Int |
| 02:30:06 | <lambdabot> | GHC.Base ord :: Char -> Int |
| 02:30:06 | <lambdabot> | Data.Text.Internal.Unsafe.Char ord :: Char -> Int |
| 02:30:25 | × | money quits (~money@user/polo) (Client Quit) |
| 02:31:56 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 02:32:27 | × | wroathe quits (~wroathe@user/wroathe) (Quit: Reconnecting) |
| 02:32:40 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 02:32:40 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 02:32:40 | → | wroathe joins (~wroathe@user/wroathe) |
| 02:33:21 | → | money joins (money@user/polo) |
| 02:34:24 | → | Sciencentistguy4 joins (~sciencent@hacksoc/ordinary-member) |
| 02:36:05 | × | Sciencentistguy quits (~sciencent@hacksoc/ordinary-member) (Ping timeout: 246 seconds) |
| 02:36:05 | Sciencentistguy4 | is now known as Sciencentistguy |
| 02:37:18 | <mniip> | heya edwardk |
| 02:37:22 | <mniip> | long time |
| 02:39:02 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 02:40:24 | <EvanR> | edwardk, re: the loose ends in the zurihack 2015 talk, was there any progress on the unordered discrimination, or the streaming results using spooky action at a distance? |
| 02:40:46 | <iqubic> | edwardk comes in every now and then, and drops knowledge bombs! |
| 02:42:28 | × | Kaiepi quits (~Kaiepi@108.175.84.104) (Ping timeout: 248 seconds) |
| 02:51:55 | <Guest192> | https://paste.tomsmeding.com/chlrUibO |
| 02:52:09 | <edwardk> | heya mniip |
| 02:52:28 | <Guest192> | this is ihp specific but I'm having some issues rendering links and was wondering if anyone can help point out some mistakes |
| 02:52:41 | <edwardk> | evanr the promises andd discrimination packages implement a version of productive stable unordered discrimination for Grouping |
| 02:52:59 | <Guest192> | I can pass the path to the action through the view, but when i navigate to that link, I'm taken to a 404 page |
| 02:58:30 | × | beteigeuze quits (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Ping timeout: 260 seconds) |
| 02:59:54 | × | rekahsoft quits (~rekahsoft@bras-base-wdston4533w-grc-02-142-113-160-156.dsl.bell.ca) (Ping timeout: 256 seconds) |
| 03:01:56 | <EvanR> | oh wow this promise package looks fun |
| 03:05:30 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 260 seconds) |
| 03:09:08 | <iqubic> | EvanR: Are your referring to the package that provides a `Lazy s a` data type? |
| 03:09:21 | <EvanR> | yes |
| 03:09:49 | → | nate4 joins (~nate@98.45.169.16) |
| 03:10:15 | <iqubic> | I see. I'm not sure what's so interesting about it yet. |
| 03:10:44 | × | segfaultfizzbuzz quits (~segfaultf@23-93-74-212.fiber.dynamic.sonic.net) (Ping timeout: 246 seconds) |
| 03:10:57 | <EvanR> | it's like ST but you can create IVars in it |
| 03:11:19 | <iqubic> | I'm not sure what an IVar is. |
| 03:11:48 | <EvanR> | an IVar is a mutable variable which starts undefined and can only be updated once |
| 03:12:10 | <EvanR> | which allows it to be read in a pure computation |
| 03:12:11 | <iqubic> | I see. That is interesting |
| 03:13:42 | <EvanR> | Lazy s monad lets you write to it (once) also, and you can runLazy in pure code |
| 03:13:59 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 255 seconds) |
| 03:14:03 | <iqubic> | I love how the Discrimination Google Talk starts with 15 minutes of explaining the joke "Monads are monoids in the category of endofunctors" |
| 03:15:01 | <EvanR> | "Welcome to this serious talk. First, Monads are monoids in category of endofunctors what's the problem." |
| 03:16:02 | <iqubic> | I love it so much. |
| 03:19:10 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 03:19:36 | <Guest20> | @pl intersect x $ intersect y z |
| 03:19:36 | <lambdabot> | intersect x (intersect y z) |
| 03:20:08 | <EvanR> | that's already pointless |
| 03:20:23 | <EvanR> | maybe put a lambda |
| 03:20:27 | <iqubic> | @pl \x y z -> f x $ f y z |
| 03:20:27 | <lambdabot> | (. f) . (.) . f |
| 03:20:32 | <iqubic> | There we go. |
| 03:20:46 | <iqubic> | (. intersect) . (.) . intersect |
| 03:21:17 | <iqubic> | But please don't use that. Writting everything in a pointless style isn't always the best idea. |
| 03:22:01 | <EvanR> | that's code is not suitable for coders with trypophobia |
| 03:22:19 | <iqubic> | Nope. |
| 03:22:26 | <iqubic> | I don't like that code either. |
| 03:22:34 | <EvanR> | better to use fmap |
| 03:22:55 | <iqubic> | How does that make it better? |
| 03:23:16 | <EvanR> | you can use `fmap` instead of . for functions |
| 03:23:32 | <iqubic> | Right. But the clearest code here is still this: |
| 03:23:39 | <iqubic> | f x $ f y z |
| 03:23:57 | <EvanR> | if we're being serious now, I object to the use of $ there |
| 03:24:14 | <iqubic> | Do you ever find $ good at all? |
| 03:24:26 | <EvanR> | yeah |
| 03:25:51 | <EvanR> | sometimes it naturally fits in section form as a function argument, sometimes it helps open a "block argument" do, if you don't use the extension which makes the $ unnecessary |
| 03:26:53 | → | mestre joins (~mestre@191.177.185.178) |
| 03:27:15 | <EvanR> | $! can be handy instead of seq, rarely |
| 03:27:34 | <EvanR> | instead of bang patterns |
| 03:27:40 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 260 seconds) |
| 03:27:46 | <iqubic> | @src ($!) |
| 03:27:46 | <lambdabot> | f $! x = x `seq` f x |
| 03:27:51 | <iqubic> | Yeah, that's good. |
| 03:31:01 | <EvanR> | "C style function call" |
| 03:31:13 | <EvanR> | (or like, most languages) |
| 03:34:02 | × | Guest20 quits (~Guest20@2001:999:488:5cc:e5b0:b492:b43a:8f46) (Quit: Client closed) |
| 03:35:14 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija))) |
| 03:35:14 | → | finn_elija joins (~finn_elij@user/finn-elija/x-0085643) |
| 03:35:14 | finn_elija | is now known as FinnElija |
| 03:42:53 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 03:43:23 | → | Guest20 joins (~Guest20@2001:999:488:5cc:3116:f149:10de:6194) |
| 03:47:41 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 268 seconds) |
| 03:48:27 | × | mestre quits (~mestre@191.177.185.178) (Quit: Lost terminal) |
| 03:48:38 | × | ksqsf quits (~user@134.209.106.31) (Quit: ERC 5.4.1 (IRC client for GNU Emacs 29.0.60)) |
| 03:49:46 | × | td_ quits (~td@83.135.9.32) (Ping timeout: 256 seconds) |
| 03:51:22 | → | td_ joins (~td@83.135.9.35) |
| 03:53:54 | × | tomku|two quits (~tomku@user/tomku) (Read error: Connection reset by peer) |
| 03:58:32 | → | tomku joins (~tomku@user/tomku) |
| 03:59:57 | × | dtman34 quits (~dtman34@76.156.89.180) (Ping timeout: 265 seconds) |
| 04:00:01 | × | haasn quits (~nand@haasn.dev) (Quit: ZNC 1.7.5+deb4 - https://znc.in) |
| 04:01:21 | → | haasn joins (~nand@haasn.dev) |
| 04:01:59 | → | dtman34 joins (~dtman34@2601:447:d000:93c9:9211:a0f7:7474:e151) |
| 04:03:06 | × | td_ quits (~td@83.135.9.35) (Ping timeout: 268 seconds) |
| 04:03:43 | × | nate4 quits (~nate@98.45.169.16) (Ping timeout: 268 seconds) |
| 04:04:43 | → | td_ joins (~td@83.135.9.35) |
| 04:22:11 | → | lisbeths joins (uid135845@id-135845.lymington.irccloud.com) |
| 04:23:33 | × | Guest20 quits (~Guest20@2001:999:488:5cc:3116:f149:10de:6194) (Ping timeout: 260 seconds) |
| 04:25:15 | → | Kaiepi joins (~Kaiepi@108.175.84.104) |
| 04:29:53 | × | jero98772 quits (~jero98772@2800:484:1d80:d8ce:efcc:cbb3:7f2a:6dff) (Remote host closed the connection) |
| 04:33:56 | × | ddellacosta quits (~ddellacos@143.244.47.73) (Ping timeout: 248 seconds) |
| 04:34:26 | <edwardk> | i just wish $ and $! had the other fixity |
| 04:34:48 | <edwardk> | they'd be so much better |
| 04:35:50 | <edwardk> | foo $ arg 1 $ arg 2 $! you wanted arg 3 to be strict $ whatever you like |
| 04:36:24 | <edwardk> | want the other behavior? you . can still $ have it |
| 04:38:03 | <edwardk> | evanr: re: it being a serious talk, i went to a german-speaking country and gave a talk in favor of discrimination. the idea that it was serious was already out the window. |
| 04:39:43 | <int-e> | I unironically use `pure $ foo . bar $ x` |
| 04:41:02 | <int-e> | (Of course I wouldn't be doing that if the fixity of $ was different) |
| 04:41:05 | <iqubic> | What does that do? |
| 04:41:09 | × | Guest192 quits (~Guest19@69.181.32.7) (Quit: Client closed) |
| 04:41:32 | <iqubic> | Is that `pure (foo (bar x))` |
| 04:42:02 | <int-e> | iqubic: I just often type "pure $" and then start thinking about the expression. And there's no reason to go back and change the $ at that point. |
| 04:42:21 | <int-e> | I think of it as punctuation. |
| 04:42:33 | <EvanR> | one pass coding |
| 04:42:38 | <iqubic> | I don't even understand how to parse `pure $ foo . bar $ x` |
| 04:42:47 | <EvanR> | too costly to go back and change it |
| 04:42:57 | <int-e> | iqubic: pure $ ((foo . bar) $ x) |
| 04:42:58 | <EvanR> | like a subway system |
| 04:43:21 | <iqubic> | int-e: So it's just `pure (foo (bar x))` |
| 04:43:25 | <int-e> | sure |
| 04:43:37 | <int-e> | after inlining $ and . and a few reduction steps |
| 04:44:10 | <iqubic> | So, `pure $ foo . bar $ x` and `pure $ foo $ bar $ x` evaluate to the same value? |
| 04:44:17 | <int-e> | yes |
| 04:44:23 | <iqubic> | Weird... |
| 04:44:39 | <int-e> | and so do `pure . foo $ bar x` and a few more variations. |
| 04:45:53 | <iqubic> | Thinking of it as punctuation is a good idea, yeah. |
| 04:46:26 | <EvanR> | yall are nuts |
| 04:46:46 | <int-e> | said the squirrel? |
| 04:47:13 | <iqubic> | Hey, at least we aren't mocking a mockingbird here. |
| 04:47:38 | × | money quits (money@user/polo) () |
| 04:48:12 | → | money joins (money@user/polo) |
| 04:49:37 | <iqubic> | https://hackage.haskell.org/package/data-aviary-0.2.3 |
| 04:50:38 | <iqubic> | Please don't use those functions in production code. |
| 04:51:00 | × | td_ quits (~td@83.135.9.35) (Ping timeout: 248 seconds) |
| 04:51:11 | <int-e> | A starling, a kestrel and an idiot bird walk into a bar and order a combination of drinks. |
| 04:51:53 | × | pieguy128_ quits (~pieguy128@bras-base-mtrlpq5031w-grc-50-65-93-192-212.dsl.bell.ca) (Ping timeout: 246 seconds) |
| 04:52:03 | <int-e> | But if you don't like those bird names, you can use `ap`, `const`, and `id`. :) |
| 04:52:09 | <iqubic> | That make me laugh quite a bit. |
| 04:52:22 | <iqubic> | Those are all fine int-e |
| 05:01:51 | → | pieguy128 joins (~pieguy128@bras-base-mtrlpq5031w-grc-43-67-70-144-160.dsl.bell.ca) |
| 05:02:31 | → | td_ joins (~td@2001:9e8:19c5:b000:8490:da8:cd63:68ca) |
| 05:03:36 | → | Parsnip joins (~parsnip@user/parsnip) |
| 05:03:57 | → | Neuromancer joins (~Neuromanc@user/neuromancer) |
| 05:03:58 | <Parsnip> | what is that thing in haskell that swaps, like List<Future<T>> ==> Future<List<T>>? |
| 05:04:08 | <Parsnip> | traverse? |
| 05:06:29 | <c_wraith> | sequence |
| 05:06:34 | <c_wraith> | which is closely related to traverse |
| 05:07:25 | <c_wraith> | well. technically sequenceA. But meh. |
| 05:09:49 | <int-e> | :t traverse id {- which is, of course, sequenceA -} |
| 05:09:50 | <lambdabot> | (Traversable t, Applicative f) => t (f b) -> f (t b) |
| 05:15:06 | <famubu[m]> | Hi. I was trying to do bitwise AND in haskell. So I did `import qualified Data.Bits`. But how can I use the `(.&.)`? Doing `Data.Bits.(.&.) 2 3` gives error. It works if I imported with qualified though. How can we make it work with the `qualified`? |
| 05:15:56 | <iqubic> | @pl \(x, y) -> not $ f x y |
| 05:15:56 | <lambdabot> | uncurry ((not .) . f) |
| 05:16:00 | <iqubic> | Eww... |
| 05:17:50 | × | Sauvin quits (~sauvin@user/Sauvin) (Remote host closed the connection) |
| 05:18:08 | → | Sauvin joins (~sauvin@user/Sauvin) |
| 05:18:50 | <int-e> | iqubic: simplification is hard :) `not . uncurry f` should work |
| 05:20:49 | <iqubic> | (\(x, y) -> not $ f x y) |
| 05:20:55 | <iqubic> | That's what I have |
| 05:21:07 | <int-e> | :t not . uncurry f` should work |
| 05:21:07 | <int-e> | 06:20:49 <iqubic> (\(x, y) -> not $ f x y) |
| 05:21:08 | <lambdabot> | error: parse error on input ‘work’ |
| 05:21:12 | <iqubic> | I think that's cleaner than trying to stick an uncurr in there. |
| 05:21:12 | <int-e> | ugh |
| 05:21:22 | <int-e> | :t not . uncurry ?f |
| 05:21:23 | <lambdabot> | (?f::a -> b -> Bool) => (a, b) -> Bool |
| 05:21:40 | <int-e> | :t uncurry ((not .) . ?f) |
| 05:21:40 | <lambdabot> | (?f::a1 -> a2 -> Bool) => (a1, a2) -> Bool |
| 05:22:21 | <int-e> | iqubic: sure, but *if* you want point-free code, the version that @pl gave is inferior. |
| 05:22:26 | <iqubic> | I'm delibrately not stating what f is, because I don't want to give away what I did for Advent of Code Day 2. |
| 05:22:29 | <iqubic> | Part 2 |
| 05:22:43 | <iqubic> | Day 4, Part 2 used code of that form |
| 05:23:20 | <int-e> | odd. |
| 05:25:20 | <money> | f**k or f*p |
| 05:27:41 | <iqubic> | My part 2 for today includes this: `not . uncurry IS.disjoint` |
| 05:29:05 | <int-e> | ah, the k-IS-s principle. |
| 05:29:24 | <iqubic> | what's the k-IS-s principle? |
| 05:30:04 | <int-e> | KISS is "keep it simple and stupid" (or a comma instead of `and` if you want more emphasis). "IS" is your IntSet. |
| 05:30:20 | <iqubic> | Right, I see. |
| 05:30:31 | <iqubic> | Yeah. IS is IntSet here |
| 05:30:51 | × | wroathe quits (~wroathe@user/wroathe) (Quit: leaving) |
| 05:33:45 | × | tomku quits (~tomku@user/tomku) (Ping timeout: 268 seconds) |
| 05:33:54 | → | tomku joins (~tomku@user/tomku) |
| 05:34:07 | <iqubic> | There's got to be a more efficient data structure for when I know the set contains all the integers between N and M inclusive and nothing more. |
| 05:35:03 | <iqubic> | But I don't know it. |
| 05:35:24 | <EvanR> | a one dimensional quadtree of some sort |
| 05:35:34 | <c_wraith> | Is (m, n) not sufficient? |
| 05:35:43 | <EvanR> | hah |
| 05:36:43 | <c_wraith> | I sort of accidentally nailed part 2. From part 1 to part 2, I changed two &&s to ||s |
| 05:36:52 | <iqubic> | c_wraith: It is, but then I'm not sure how to implement isSubsetOf and intersection. Those are the two set operations I used today. |
| 05:38:34 | → | bontaq joins (~user@ool-45779fe5.dyn.optonline.net) |
| 05:40:02 | <EvanR> | > intersect [1..3] [4..6] |
| 05:40:04 | <lambdabot> | [] |
| 05:40:08 | <EvanR> | > intersect [1..5] [4..6] |
| 05:40:10 | <lambdabot> | [4,5] |
| 05:41:40 | <EvanR> | > [3..4] `isSubsequenceOf` [1..8] |
| 05:41:41 | <lambdabot> | True |
| 05:42:44 | <iqubic> | Is that just using standard List operations? |
| 05:42:47 | <EvanR> | yeah |
| 05:43:13 | <iqubic> | So, IntSets are overkill? |
| 05:43:22 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 05:44:15 | <int-e> | Oooh. intersect xs ys `elem` [xs, ys] |
| 05:44:25 | <EvanR> | like c_wraith was saying, sets are probably overkill xD |
| 05:44:53 | <c_wraith> | these are ranges. you can represent them as sets, but it's *way* more information than you need. |
| 05:45:03 | <int-e> | Anyway, interval arithmetic isn't hard either. |
| 05:45:04 | <EvanR> | imagine if they said it was a range of real numbers |
| 05:45:12 | <EvanR> | then you'd need RealSet |
| 05:45:18 | <EvanR> | and countable memory |
| 05:45:21 | <EvanR> | uncountable |
| 05:46:17 | <int-e> | Part 1 was harder than part 2. Change my mind. :-P |
| 05:46:23 | <iqubic> | Yeah, at that point you'd switch to just storing the endpoints. |
| 05:46:28 | <EvanR> | overlaps = not . apart xD |
| 05:46:47 | <iqubic> | int-e: No, that seems right |
| 05:46:47 | <EvanR> | would fail if it was reals, depending on your logic |
| 05:46:52 | <iqubic> | What is apart? |
| 05:47:15 | <int-e> | apart = disjoint |
| 05:47:22 | <EvanR> | apart means there's a gap between them |
| 05:47:24 | <int-e> | miles apart |
| 05:49:20 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
| 05:53:58 | → | fizbin joins (~fizbin@c-76-116-163-70.hsd1.nj.comcast.net) |
| 05:56:57 | × | Neuromancer quits (~Neuromanc@user/neuromancer) (Quit: Going offline, see ya! (www.adiirc.com)) |
| 05:59:32 | × | fizbin quits (~fizbin@c-76-116-163-70.hsd1.nj.comcast.net) (Quit: Leaving...) |
| 05:59:56 | × | td_ quits (~td@2001:9e8:19c5:b000:8490:da8:cd63:68ca) (Ping timeout: 255 seconds) |
| 06:00:37 | → | td_ joins (~td@83.135.9.35) |
| 06:01:38 | × | anderson_ quits (~ande@76.202.115.164) (Quit: bye) |
| 06:01:38 | × | eldritch_ quits (~eldritch@76.202.115.164) (Quit: bye) |
| 06:02:51 | → | fizbin joins (~fizbin@c-76-116-163-70.hsd1.nj.comcast.net) |
| 06:06:49 | × | monochrom quits (trebla@216.138.220.146) (Quit: NO CARRIER) |
| 06:08:19 | → | anderson_ joins (~ande@76.202.115.164) |
| 06:08:54 | × | tomku quits (~tomku@user/tomku) (Ping timeout: 260 seconds) |
| 06:09:15 | × | fizbin quits (~fizbin@c-76-116-163-70.hsd1.nj.comcast.net) (Quit: Leaving...) |
| 06:10:21 | → | eldritch_ joins (~eldritch@76.202.115.164) |
| 06:12:15 | → | Guest|71 joins (~Guest|71@217-121-107-193.cable.dynamic.v4.ziggo.nl) |
| 06:13:09 | → | monochrom joins (trebla@216.138.220.146) |
| 06:14:49 | → | tomku joins (~tomku@user/tomku) |
| 06:14:49 | × | Guest|71 quits (~Guest|71@217-121-107-193.cable.dynamic.v4.ziggo.nl) (Remote host closed the connection) |
| 06:15:30 | × | anderson_ quits (~ande@76.202.115.164) (Quit: bye) |
| 06:15:30 | × | eldritch_ quits (~eldritch@76.202.115.164) (Quit: bye) |
| 06:15:36 | → | fizbin joins (~fizbin@user/fizbin) |
| 06:17:16 | <fizbin> | glguy, question about advent of code (if you're around). What language are you doing it in for time? (I'm doing it in python for speed, and then in haskell after) |
| 06:22:48 | → | eldritch_ joins (~eldritch@76.202.115.164) |
| 06:26:23 | × | rburkholder quits (~blurb@96.45.2.121) (Remote host closed the connection) |
| 06:28:26 | → | anderson_ joins (~ande@76.202.115.164) |
| 06:35:49 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 06:39:56 | × | eldritch_ quits (~eldritch@76.202.115.164) (Quit: bye) |
| 06:40:30 | × | anderson_ quits (~ande@76.202.115.164) (Quit: bye) |
| 06:45:05 | × | Unicorn_Princess quits (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Quit: Leaving) |
| 06:50:50 | × | razetime quits (~quassel@49.207.211.219) (Ping timeout: 268 seconds) |
| 06:52:48 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 256 seconds) |
| 06:53:37 | <phma> | I'm writing a library which is at version 0.1.0.0. I need to add and export another function and think it would be wise to rename the functions. I've uploaded it to Hackage only as a candidate. Which number should I bump? |
| 06:56:11 | Parsnip | is now known as parsnip |
| 06:56:57 | <maerwald[m]> | phma: you're renaming existing functions? |
| 06:58:31 | <phma> | probably |
| 06:59:04 | <maerwald[m]> | I don't understand |
| 06:59:05 | <phma> | I have to add another argument to the function |
| 06:59:22 | <phma> | but I want to keep the version which doesn't have the new argument |
| 06:59:33 | <phma> | so I'm going to rename it |
| 06:59:33 | <maerwald[m]> | Are you keeping the existing functions as they are or not? |
| 07:00:02 | <phma> | the existing function will have a modified name |
| 07:00:22 | <maerwald[m]> | That's a breaking change, so major bump |
| 07:00:47 | <phma> | so 1.0.0.0? |
| 07:03:42 | <maerwald[m]> | https://pvp.haskell.org/ |
| 07:05:18 | <phma> | what's the difference between bumping to 0.2.0.0 and bumping to 1.0.0.0? |
| 07:08:56 | <maerwald[m]> | Those are different versions |
| 07:09:12 | <maerwald[m]> | PVP doesn't assign semantics to the difference |
| 07:10:25 | <jackdk> | both 0.1.0.0 -> 0.2.0.0 and 0.1.0.0 -> 1.0.0.0 are a large major version bump as PVP says versions are major.major.minor.patch |
| 07:11:06 | <phma> | If I add a benchmark or test, which number do I have to bunp? |
| 07:14:00 | <c_wraith> | if they don't affect the API at all, they're patch level |
| 07:15:32 | <phma> | okay, I'll go with 0.2 |
| 07:16:25 | → | razetime joins (~quassel@49.207.211.219) |
| 07:17:20 | <jackdk> | That's not a patch-level version change |
| 07:17:52 | <jackdk> | Going from 0.1 to 0.2 is a major version bump. If you don't change the API at all, you could go from 0.1.0.0 to 0.1.0.1 |
| 07:22:23 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 07:24:50 | <phma> | no, I can't, because I added a function. Once I add the benchmark, I can go to 0.2.0.1. |
| 07:25:27 | <phma> | Technical difficulties. I have to restart my IRC client. |
| 07:25:41 | × | phma quits (~phma@host-67-44-208-217.hnremote.net) (Quit: Konversation terminated!) |
| 07:26:32 | → | phma joins (phma@2001:5b0:2172:df88:5a01:89c1:b39c:c87d) |
| 07:27:55 | <phma> | I have to add the function in order to use a library; the benchmark will test my library's use of that other library. |
| 07:30:40 | <maerwald[m]> | phma: adding a function is not a breaking change |
| 07:30:58 | <maerwald[m]> | Did you look at the link? |
| 07:33:16 | <phma> | yes, and as I'm adding an argument to a function, that is a breaking change |
| 07:35:35 | <maerwald[m]> | Yes, but adding a function is not |
| 07:36:45 | <phma> | renaming a function is a breaking change, right? |
| 07:37:54 | <maerwald[m]> | phma: renaming a function as in: removing an existing one and adding a new one yes |
| 07:39:13 | <phma> | so I have to bump it from 0.1.0.0 to 0.2.0.0 when I rename the function and add a new function with an additional argument with the previous name, |
| 07:39:24 | <phma> | then 0.2.0.1 when I add the benchmark |
| 07:40:43 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 07:43:15 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 07:44:29 | → | opticblast joins (~Thunderbi@secure-165.caltech.edu) |
| 07:44:48 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 07:53:48 | × | phma quits (phma@2001:5b0:2172:df88:5a01:89c1:b39c:c87d) (Read error: Connection reset by peer) |
| 07:54:44 | → | phma joins (phma@2001:5b0:210b:fa28:7bf5:3e57:e59:39a9) |
| 08:00:13 | × | lisbeths quits (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 08:00:19 | × | bontaq quits (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 260 seconds) |
| 08:03:38 | × | razetime quits (~quassel@49.207.211.219) (Ping timeout: 256 seconds) |
| 08:04:10 | × | machinedgod quits (~machinedg@d198-53-218-113.abhsia.telus.net) (Ping timeout: 260 seconds) |
| 08:07:23 | × | yuribarros quits (~yuribarro@2804:14c:65e4:865c::1000) (Remote host closed the connection) |
| 08:08:52 | → | Tuplanolla joins (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) |
| 08:12:34 | <jackdk> | Or you do it all at once and go to 0.2.0.0 |
| 08:19:30 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 08:23:48 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 08:28:16 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 252 seconds) |
| 08:34:13 | → | titibandit joins (~titibandi@xdsl-78-35-173-119.nc.de) |
| 08:35:59 | → | pagnol joins (~user@213-205-209-87.ftth.glasoperator.nl) |
| 08:36:16 | <pagnol> | What's the best setup nowadays for Haskell on Emacs? |
| 08:36:59 | × | hpc quits (~juzz@ip98-169-35-163.dc.dc.cox.net) (Ping timeout: 246 seconds) |
| 08:38:54 | → | hpc joins (~juzz@ip98-169-35-163.dc.dc.cox.net) |
| 08:39:42 | <jackdk> | I'm still on dante, but I hear lsp is pretty good. eglot's about to get into mainline emacs but I'm not across the latest emacs<->lsp stuff |
| 08:40:47 | × | nek0 quits (~nek0@2a01:4f8:222:2b41::12) (Quit: The Lounge - https://thelounge.chat) |
| 09:06:30 | × | money quits (money@user/polo) () |
| 09:06:46 | → | tcard joins (~tcard@2400:4051:5801:7500:cf17:befc:ff82:5303) |
| 09:07:18 | → | money joins (money@user/polo) |
| 09:08:00 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
| 09:08:00 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 09:08:00 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Read error: Connection reset by peer) |
| 09:08:43 | → | Chai-T-Rex joins (~ChaiTRex@user/chaitrex) |
| 09:08:48 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 09:09:08 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 09:09:47 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 09:10:19 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 09:14:26 | → | acidjnk joins (~acidjnk@p200300d6e7137a51c5d563f76206e160.dip0.t-ipconnect.de) |
| 09:16:58 | → | Guest4143 joins (~Guest41@212.164.64.82) |
| 09:18:00 | × | Guest4143 quits (~Guest41@212.164.64.82) (Client Quit) |
| 09:32:37 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 09:38:31 | → | instantaphex joins (~jb@c-73-171-252-84.hsd1.fl.comcast.net) |
| 09:43:07 | × | instantaphex quits (~jb@c-73-171-252-84.hsd1.fl.comcast.net) (Ping timeout: 265 seconds) |
| 09:46:53 | × | talismanick quits (~talismani@76.133.152.122) (Remote host closed the connection) |
| 09:47:01 | → | kenran joins (~user@user/kenran) |
| 09:47:14 | <albet70> | is '\e' a character? |
| 09:47:15 | → | bontaq joins (~user@ool-45779fe5.dyn.optonline.net) |
| 09:47:18 | <albet70> | or '\3' |
| 09:47:35 | <albet70> | any start with backslash is a character? |
| 09:48:40 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 09:49:13 | → | nihonium joins (~nihonium@46.148.105.76) |
| 09:51:43 | <mauke> | > '\K' |
| 09:51:44 | <lambdabot> | <hint>:1:3: error: |
| 09:51:44 | <lambdabot> | lexical error in string/character literal at character 'K' |
| 09:52:00 | <mauke> | > ('\e', '\3') |
| 09:52:02 | <lambdabot> | <hint>:1:4: error: |
| 09:52:02 | <lambdabot> | lexical error in string/character literal at character 'e' |
| 09:52:06 | <tomsmeding> | > '\ESC' |
| 09:52:08 | <lambdabot> | '\ESC' |
| 09:52:08 | <albet70> | there're some characters like \xXX or \uXXXX in javascript escape strings, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#escape_sequences but '\x' or '\u' aren't characters in Haskell, how I suppose to capture characters like that '\xXX'? |
| 09:52:22 | <tomsmeding> | > '\x40' |
| 09:52:23 | <lambdabot> | '@' |
| 09:52:43 | <albet70> | tomsmeding, how to capture '\xAny' in haskell? |
| 09:52:44 | <mauke> | > '\o33' |
| 09:52:46 | <lambdabot> | '\ESC' |
| 09:52:53 | <mauke> | "where is the any char"? |
| 09:53:09 | <albet70> | tomsmeding, is there a table have all this special characters? |
| 09:53:10 | <tomsmeding> | albet70: see section 2.6 here https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-140002 |
| 09:53:30 | <tomsmeding> | that's the haskell 2010 report, i.e. as close to a standard as we have |
| 09:53:52 | <mauke> | direct link: https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6 |
| 09:55:05 | × | nihonium quits (~nihonium@46.148.105.76) (Ping timeout: 256 seconds) |
| 09:55:35 | <mauke> | > '\^[' |
| 09:55:36 | <lambdabot> | '\ESC' |
| 09:55:38 | <mauke> | neat |
| 09:55:56 | <tomsmeding> | nice |
| 09:56:32 | <mauke> | I think the only thing that's missing from Perl is named characters |
| 09:56:34 | <albet70> | escape → \ ( charesc | ascii | decimal | o octal | x hexadecimal ) |
| 09:56:44 | <albet70> | those number has a range? |
| 09:56:55 | <mauke> | it has to be valid unicode |
| 09:56:56 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 09:57:03 | <mauke> | > maxBound :: Char |
| 09:57:05 | <lambdabot> | '\1114111' |
| 09:57:36 | <mauke> | > '\1114112' |
| 09:57:37 | <lambdabot> | <hint>:1:9: error: |
| 09:57:38 | <lambdabot> | numeric escape sequence out of range at character '2' |
| 09:57:56 | <tomsmeding> | > 0x10FFFF |
| 09:57:57 | <lambdabot> | 1114111 |
| 09:58:06 | <albet70> | if the whole unicode is a range, how I suppose to filter that haskell string to javascript string... that's huge |
| 09:58:16 | <mauke> | huh? |
| 09:58:29 | <tomsmeding> | JS has \u <hexdigits> |
| 09:58:40 | <tomsmeding> | also, watch what you're doing |
| 09:58:50 | <tomsmeding> | if you have a string in a haskell program, you don't have \ x 1 2 3 4 |
| 09:58:53 | <albet70> | I'm reading haskell strings and turn it to javascript string |
| 09:58:57 | <tomsmeding> | you have one character with value 1234 |
| 09:59:19 | <tomsmeding> | though if you want to parse haskell strings _yourself_, then yes you'll have to deal with this |
| 09:59:53 | <albet70> | current so far https://paste.tomsmeding.com/ifYQB2k5 |
| 10:00:40 | <tomsmeding> | do you care about getting natural and readable js out? |
| 10:00:46 | <tomsmeding> | otherwise you can make your life easy |
| 10:01:00 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 10:01:24 | <albet70> | how so? |
| 10:02:20 | <albet70> | elaboration? |
| 10:02:49 | <c_wraith> | escape every character. |
| 10:02:59 | <c_wraith> | if it doesn't need to be readable, that's easy to get it right |
| 10:03:12 | × | Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 256 seconds) |
| 10:03:23 | <albet70> | examples, please |
| 10:03:25 | <mauke> | > concatMap (printf "\\u{%x}" . ord) "yo\n\"☺️\"" |
| 10:03:26 | <lambdabot> | error: |
| 10:03:26 | <lambdabot> | • Ambiguous type variable ‘b0’ arising from a use of ‘show_M510490830068... |
| 10:03:26 | <lambdabot> | prevents the constraint ‘(Show b0)’ from being solved. |
| 10:03:30 | <mauke> | oh? |
| 10:03:35 | <mauke> | > concatMap (printf "\\u{%x}" . ord) "yo\n\"☺️\"" :: String |
| 10:03:36 | <lambdabot> | "\\u{79}\\u{6f}\\u{a}\\u{22}\\u{263a}\\u{fe0f}\\u{22}" |
| 10:03:41 | <tomsmeding> | \c -> if ' ' <= c && c < '\DEL' && c /= '"' then [c] else "\\u{" ++ Numeric.showHex (fromEnum c) "}" |
| 10:03:54 | <tomsmeding> | or use printf lol |
| 10:03:56 | × | neminis quits (~neminis@43.21.135.77.rev.sfr.net) (Quit: Client closed) |
| 10:04:05 | → | nek0 joins (~nek0@2a01:4f8:222:2b41::12) |
| 10:04:08 | <mauke> | look at this guy, trying to leave ASCII all readable and stuff |
| 10:04:23 | <mauke> | but that's tricky because you must escape \ |
| 10:04:27 | <tomsmeding> | ooooo |
| 10:04:30 | <mauke> | and if you're embedding in HTML, you better escape < too |
| 10:04:42 | <tomsmeding> | \c -> if ' ' <= c && c < '\DEL' && c `notElem` '"\\<' then [c] else "\\u{" ++ Numeric.showHex (fromEnum c) "}" |
| 10:04:45 | <tomsmeding> | gotcha |
| 10:05:38 | <albet70> | what about that \xXX? |
| 10:06:10 | <albet70> | \xXX …where XX is exactly 2 hex digits in the range 00–FF |
| 10:06:11 | <tomsmeding> | albet70: but I want to reiterate again: you are converting a string value in haskell to javascript code. And you come here asking "how do I deal with the various kinds of escape characters that haskell strings have, like \x, \u, \^, etc" |
| 10:06:15 | <tomsmeding> | _that's the wrong question_ |
| 10:06:22 | <tomsmeding> | your input is not haskell code |
| 10:06:32 | <tomsmeding> | hence you do not care about how haskell _code_ is written |
| 10:07:06 | <tomsmeding> | you care about the API of haskell strings in Haskell -- which is easy, it's [Char], and Char is Enum from 0 to 0x10FFFF -- and you care about how JS code is written |
| 10:08:17 | <tomsmeding> | whether the user passed you "\x40" or "@" or "\64" is all the same to you -- it's [c] where fromEnum c == 64 |
| 10:08:54 | <tomsmeding> | difference between syntax (= code) and values (= data) |
| 10:11:13 | <mauke> | > "String.fromCodepoint(" ++ intercalate ", " (map (show . ord) "yo\n\"☺️\"") ++ ")" |
| 10:11:14 | <lambdabot> | "String.fromCodepoint(121, 111, 10, 34, 9786, 65039, 34)" |
| 10:11:30 | <mauke> | oops, should be fromCodePoint |
| 10:11:34 | <tomsmeding> | TIL that takes multiple arguments |
| 10:11:58 | <mauke> | it even takes 0 arguments, contrary to what MDN says |
| 10:12:05 | → | Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915) |
| 10:12:08 | <mauke> | (a good chunk of MDN is written by baboons) |
| 10:12:26 | <tomsmeding> | maybe the standard doesn't require it to take 0 arguments but your particular JS implementation does? |
| 10:12:39 | <tomsmeding> | wouldn't be the first time implementation diverged from standard |
| 10:12:44 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 260 seconds) |
| 10:13:09 | <mauke> | nah: https://tc39.es/ecma262/multipage/text-processing.html#sec-string.fromcodepoint |
| 10:13:39 | <mauke> | (step 3) |
| 10:14:12 | → | acidjnk_new joins (~acidjnk@p200300d6e7137a5181fc87d2e5daef70.dip0.t-ipconnect.de) |
| 10:14:53 | Lord_of_Life_ | is now known as Lord_of_Life |
| 10:15:57 | → | gmg joins (~user@user/gehmehgeh) |
| 10:16:17 | <tomsmeding> | I mean, mdn doesn't explicitly say that 0 arguments is _disallowed_ :p |
| 10:16:28 | <tomsmeding> | but it sure suggests it indeed |
| 10:16:43 | → | gurkenglas joins (~gurkengla@p548ac72e.dip0.t-ipconnect.de) |
| 10:17:47 | × | acidjnk quits (~acidjnk@p200300d6e7137a51c5d563f76206e160.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
| 10:18:27 | <tomsmeding> | mdn doesn't give the full spec anyway, it doesn't specify that it throws RangeError for <0 or >0x10ffff |
| 10:18:30 | × | son0p quits (~ff@2604:3d08:5b7f:5540::a58f) (Ping timeout: 256 seconds) |
| 10:19:38 | <mauke> | MDN used to say that the syntax of new was 'object = new Class(arguments)' |
| 10:19:47 | <mauke> | as if the 'object =' part was required |
| 10:20:18 | <money> | Psh whatever |
| 10:20:37 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 10:21:17 | → | zeenk joins (~zeenk@2a02:2f04:a30d:4300::7fe) |
| 10:21:50 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 10:22:52 | → | nihonium joins (~nihonium@46.148.105.76) |
| 10:23:35 | → | kenran joins (~user@user/kenran) |
| 10:23:42 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 10:23:50 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 10:25:12 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 10:26:09 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 260 seconds) |
| 10:27:19 | × | nihonium quits (~nihonium@46.148.105.76) (Ping timeout: 260 seconds) |
| 10:28:04 | → | nihonium joins (~nihonium@46.148.105.76) |
| 10:29:38 | → | Inst_ joins (~Inst@2601:6c4:4081:54f0:e862:ffc4:e60e:d92f) |
| 10:33:23 | × | Inst quits (~Inst@2601:6c4:4081:54f0:c5ff:1cee:beb9:d04b) (Ping timeout: 260 seconds) |
| 10:35:31 | × | zer0bitz quits (~zer0bitz@196.244.192.58) (Read error: Connection reset by peer) |
| 10:36:29 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds) |
| 10:44:03 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 10:44:58 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 10:46:11 | <tomsmeding> | some of the pkg-config files on my machine are apparently borked, and this completely and utterly breaks pkg-config support in cabal |
| 10:46:23 | <tomsmeding> | is there work in cabal to improve this situation |
| 10:46:55 | <tomsmeding> | like, getting pkg-config module versions on-demand instead of "everything on the system" |
| 10:48:28 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 10:48:35 | × | zeenk quits (~zeenk@2a02:2f04:a30d:4300::7fe) (Quit: Konversation terminated!) |
| 10:49:06 | <[Leary]> | tomsmeding: I remember reading a cabal issue about that: <https://github.com/haskell/cabal/issues/8494>. Supposed to be fixed by: <https://github.com/haskell/cabal/pull/8496>. |
| 10:49:42 | <tomsmeding> | [Leary]: thanks, that's precisely my issue! |
| 10:50:52 | × | img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in) |
| 10:51:27 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 10:51:36 | <tomsmeding> | not sure why they insist on getting the entire bloody database before starting the solver :p |
| 10:51:51 | × | tzh quits (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) (Quit: zzz) |
| 10:52:00 | <tomsmeding> | I know, purity in the solver, but if I really modify the pkgconfig database halfway through cabal solving, I _expect_ cabal solving to break |
| 10:52:16 | <maerwald[m]> | tomsmeding: the db is part of the solver |
| 10:52:45 | <tomsmeding> | maerwald[m]: I expect the solver to query the pkg-config db every time it needs info about a package that it hasn't queried yet, and cache the result |
| 10:52:46 | <tomsmeding> | s |
| 10:52:59 | <tomsmeding> | it's impure, yes |
| 10:53:25 | <tomsmeding> | but anyway getting packages one-by-one before starting build _works_, just quite a lot slower than it needs to be :) |
| 10:53:37 | <tomsmeding> | and significantly better to have as a fallback than to have no fallback at all |
| 10:54:48 | <maerwald[m]> | I think it might just be an implementation difficulty |
| 10:55:17 | → | freeside joins (~mengwong@103.252.202.193) |
| 10:55:36 | → | kuribas joins (~user@ptr-17d51emajr6v18pa5yl.18120a2.ip6.access.telenet.be) |
| 10:55:48 | <maerwald[m]> | Needing lazy IO or so |
| 10:56:02 | <tomsmeding> | ... lazy IO? |
| 10:56:17 | <tomsmeding> | I get that making the solver monadic is a change that people won't make lightly |
| 10:56:52 | <tomsmeding> | honestly personally I would unsafePerformIO my way out of this, caching results as I go, but I understand if people don't want that in cabal :) |
| 10:59:47 | <tomsmeding> | maaan I'm running the XDG test cabal which is just 10 days too old to have this PR >.< |
| 11:00:04 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 248 seconds) |
| 11:00:59 | × | econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity) |
| 11:04:57 | → | lisbeths joins (uid135845@id-135845.lymington.irccloud.com) |
| 11:05:03 | → | img joins (~img@user/img) |
| 11:09:30 | → | wootehfoot joins (~wootehfoo@user/wootehfoot) |
| 11:10:06 | × | img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in) |
| 11:11:00 | → | mc47 joins (~mc47@xmonad/TheMC47) |
| 11:16:58 | → | freeside joins (~mengwong@103.252.202.193) |
| 11:21:41 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 255 seconds) |
| 11:22:35 | → | kenaryn joins (~aurele@cre71-h03-89-88-44-27.dsl.sta.abo.bbox.fr) |
| 11:23:31 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 11:25:41 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 11:25:53 | × | dextaa quits (~DV@user/dextaa) (Quit: Ping timeout (120 seconds)) |
| 11:26:14 | → | dextaa joins (~DV@user/dextaa) |
| 11:29:21 | → | img joins (~img@user/img) |
| 11:30:15 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Ping timeout: 255 seconds) |
| 11:30:37 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 11:31:50 | × | anpad quits (~pandeyan@user/anpad) (Read error: Connection reset by peer) |
| 11:34:12 | → | anpad joins (~pandeyan@user/anpad) |
| 11:35:30 | → | pyrex_ joins (~pyrex@2601:645:8781:1c90:a460:e23d:4864:da00) |
| 11:37:41 | → | freeside joins (~mengwong@103.252.202.193) |
| 11:39:39 | × | pyrex quits (~pyrex@user/pyrex) (Ping timeout: 260 seconds) |
| 11:47:22 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
| 11:48:04 | × | opticblast quits (~Thunderbi@secure-165.caltech.edu) (Ping timeout: 268 seconds) |
| 11:51:13 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 11:51:47 | × | anpad quits (~pandeyan@user/anpad) (Quit: ZNC 1.8.2 - https://znc.in) |
| 11:52:16 | → | kenran joins (~user@user/kenran) |
| 11:52:34 | → | anpad joins (~pandeyan@user/anpad) |
| 11:53:46 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 11:54:43 | → | califax joins (~califax@user/califx) |
| 11:55:44 | × | money quits (money@user/polo) () |
| 11:56:16 | → | money joins (money@user/polo) |
| 11:58:01 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 12:00:14 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 12:00:29 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Ping timeout: 255 seconds) |
| 12:00:38 | <darkling> | Noob question: I've found (via Hoogle) a function in GHC.Utils.Misc that I want to use, but cabal says it's not in scope. If I try to import GHC.Utils.Misc, it says the module's not found. What am I missing? |
| 12:01:24 | <darkling> | (ghc --version says 8.8.4; cabal --version is 3.0.0.0; build-depends says base >= 4.13 && <4.14) |
| 12:01:28 | <c_wraith> | what package is hoogle telling you that function is in? |
| 12:01:55 | × | img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in) |
| 12:01:57 | <darkling> | https://hackage.haskell.org/package/ghc-9.4.2/docs/GHC-Utils-Misc.html |
| 12:02:05 | <c_wraith> | what *package* is that? |
| 12:02:06 | <darkling> | (I want "count") |
| 12:02:17 | <darkling> | I don't know. It took me to that page. |
| 12:02:32 | <c_wraith> | look in the top left corner of the page |
| 12:02:51 | <darkling> | "ghc-9.4.2: The GHC API" |
| 12:03:17 | <c_wraith> | So... that'd be version 9.4.2 of the ghc library |
| 12:03:29 | <c_wraith> | which is in the package "ghc" |
| 12:03:36 | → | opticblast joins (~Thunderbi@secure-165.caltech.edu) |
| 12:03:50 | <c_wraith> | you could add "ghc" to your build-depends, but... I wouldn't |
| 12:03:58 | <darkling> | Oh. I see. It feel like those functions are sufficiently basic and useful that they'd be a part of a standard library. |
| 12:04:34 | <mauke> | eh. isn't count just length (filter ...)? |
| 12:04:51 | <kjlid[m]> | What does the error "(case ... of ...)-syntax in pattern" even mean? |
| 12:05:07 | × | sayola quits (~sayola@dslb-088-064-186-217.088.064.pools.vodafone-ip.de) (Quit: Leaving.) |
| 12:05:18 | <mauke> | > let f (case () of () -> ()) in () |
| 12:05:19 | <lambdabot> | <hint>:1:29: error: parse error on input ‘in’ |
| 12:05:37 | <mauke> | > let f (case () of () -> ()) = () in () |
| 12:05:38 | <lambdabot> | <hint>:1:8: error: (case ... of ...)-syntax in pattern |
| 12:05:43 | → | sayola joins (~sayola@dslb-088-064-186-217.088.064.pools.vodafone-ip.de) |
| 12:05:52 | <darkling> | mauke: Yes, it is, but I've found enough useful functions already that shaved off a word or two of implementation, I went looking for one here, and apparently found it but I shouldn't use it. :( |
| 12:06:36 | <mauke> | kjlid[m]: apparently it means you put a case/of expression inside a pattern |
| 12:07:26 | <kjlid[m]> | hmm |
| 12:08:23 | <mauke> | > case () of case () of () -> () -> () |
| 12:08:25 | <lambdabot> | <hint>:1:12: error: (case ... of ...)-syntax in pattern |
| 12:08:34 | → | CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
| 12:09:29 | <kjlid[m]> | https://paste.tomsmeding.com/j2RmKuD0 |
| 12:09:59 | <kjlid[m]> | Is this inside a pattern? |
| 12:10:13 | → | Unicorn_Princess joins (~Unicorn_P@user/Unicorn-Princess/x-3540542) |
| 12:10:24 | <mauke> | what's the error message? |
| 12:10:36 | <kjlid[m]> | What I just told you |
| 12:10:45 | <kjlid[m]> | (case ... of ...)-syntax in pattern |
| 12:11:03 | <kjlid[m]> | On that case |
| 12:11:04 | → | razetime joins (~quassel@49.207.211.219) |
| 12:11:06 | <mauke> | no, the actual error message |
| 12:11:41 | <kjlid[m]> | https://paste.tomsmeding.com/rWJ7N4ly |
| 12:12:52 | <mauke> | what's in lines 1 .. 28? |
| 12:13:00 | <mauke> | also, is that the first error? |
| 12:13:17 | <kjlid[m]> | That's the only error |
| 12:14:17 | <kjlid[m]> | https://paste.tomsmeding.com/IPnFuenn <- That's the whole file |
| 12:15:30 | → | beteigeuze joins (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
| 12:16:47 | × | CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
| 12:16:57 | <mauke> | missing 'do' after 'Just k ->' |
| 12:17:21 | <kjlid[m]> | ooooh, ofcourse |
| 12:17:28 | <mauke> | I get a different error, though |
| 12:17:49 | <mauke> | "Parse error in pattern: ... Possibly caused by a missing 'do'?" |
| 12:18:01 | <kjlid[m]> | Weird |
| 12:18:17 | <mauke> | ooh, I think I see what's going on |
| 12:18:35 | <kjlid[m]> | Alright |
| 12:18:53 | <mauke> | you can't have <- in the middle of an expression |
| 12:19:13 | <mauke> | it's special syntax in do blocks and list comprehensions (and pattern guards) |
| 12:19:27 | <kjlid[m]> | I do? |
| 12:19:47 | <kjlid[m]> | Oh yeah |
| 12:19:50 | <kjlid[m]> | You mean without the 'do'? |
| 12:20:18 | <mauke> | so: case (getKey ...) of Nothing -> ...; Just k -> userIds <- ... can't be parsed as a single expression |
| 12:20:58 | <mauke> | so I think it just turns into: case (getKey ...) of { Nothing -> ...; Just k -> userIds } <- ... |
| 12:20:58 | <kjlid[m]> | Makes sense |
| 12:21:24 | <mauke> | and then you have a case expression as a pattern on the left hand side of <- in the outer do block |
| 12:21:42 | <kjlid[m]> | Ah yeah, suddenly the error makes some sense |
| 12:23:44 | <mauke> | it is of course rather misleading that the error location points at "case" (line 28) instead of "<-" (line 31) |
| 12:23:50 | × | Kaiepi quits (~Kaiepi@108.175.84.104) (Ping timeout: 268 seconds) |
| 12:25:28 | <mauke> | kjlid[m]: my error message: https://paste.tomsmeding.com/pxEgrt9y |
| 12:26:06 | <kjlid[m]> | Interesting. I'm using ghc 9.4.2 |
| 12:26:49 | → | son0p joins (~ff@2604:3d08:5b7f:5540::37af) |
| 12:27:50 | <pagnol> | is there something more idomatic for (\a b -> f b) ? |
| 12:28:23 | <pagnol> | and more idiomatic than (\_ a -> f a) |
| 12:30:31 | × | kenaryn quits (~aurele@cre71-h03-89-88-44-27.dsl.sta.abo.bbox.fr) (Quit: leaving) |
| 12:31:20 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 260 seconds) |
| 12:31:39 | <mauke> | const f? |
| 12:31:41 | <jackdk> | `const f`? |
| 12:31:53 | <jackdk> | yeah |
| 12:33:19 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 12:34:21 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 12:34:37 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 12:35:07 | <kjlid[m]> | Is there something like mapM that only ignores some values? Or should I just run a filter on the result? |
| 12:35:20 | → | machinedgod joins (~machinedg@d198-53-218-113.abhsia.telus.net) |
| 12:36:50 | <freeside> | in the same module where mapM is defined, I see filterM |
| 12:37:22 | <kjlid[m]> | You do? |
| 12:37:23 | × | califax quits (~califax@user/califx) (Ping timeout: 255 seconds) |
| 12:37:26 | <freeside> | ahem. Let me rephrase in Gen Z speak. From the people who brought you mapM, just dropped filterM, YASS QUEEN |
| 12:37:36 | <freeside> | https://hackage.haskell.org/package/base-4.17.0.0/docs/Control-Monad.html |
| 12:38:12 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 248 seconds) |
| 12:38:25 | <freeside> | also mfilter |
| 12:38:28 | <kjlid[m]> | "If you want more functions like this then hit like and subcribe?" |
| 12:38:54 | <kjlid[m]> | I was actually looking in https://hackage.haskell.org/package/base-4.17.0.0/docs/Prelude.html |
| 12:38:57 | <freeside> | "you asked and WE DELIVERED! bonus content for first 1000 followers, mfilter!!!" |
| 12:39:53 | <freeside> | Prelude = free substack. Control.Monad = paid substack, extra content, NSFW, subscribers only! |
| 12:40:30 | <freeside> | literally defines mapAndUnzipM |
| 12:40:56 | <darkling> | unzip? That's the NSFW bit, right? :) |
| 12:41:36 | <freeside> | the really NSFW bits are `join` and (>=>) |
| 12:41:39 | <mauke> | touch && unzip && finger && mount && yes |
| 12:42:01 | <mauke> | that's why I don't use shell scripts. it's dirty. |
| 12:42:21 | <freeside> | remember to use protection! (touch && unzip && finger && mount && yes) > /dev/null 2>&1 |
| 12:43:52 | × | perrierjouet quits (~perrier-j@modemcable048.127-56-74.mc.videotron.ca) (Quit: WeeChat 3.7.1) |
| 12:44:24 | <kjlid[m]> | Speaking of NSFW, is import Package () the same as import Package or does it import nothing at all from Package? |
| 12:44:25 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 12:44:39 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 12:44:54 | <geekosaur> | it imports only instances |
| 12:45:10 | <kjlid[m]> | Alright |
| 12:45:11 | → | crazazy`` joins (~user@130.89.171.62) |
| 12:47:13 | × | gmg quits (~user@user/gehmehgeh) (Remote host closed the connection) |
| 12:47:19 | × | crazazy` quits (~user@130.89.173.127) (Ping timeout: 260 seconds) |
| 12:48:50 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Write error: Connection reset by peer) |
| 12:49:48 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 12:50:36 | → | perrierjouet joins (~perrier-j@modemcable048.127-56-74.mc.videotron.ca) |
| 12:54:03 | <mauke> | huh. I never questioned it because that's basically how perl works, too |
| 12:55:53 | <freeside> | orly |
| 12:56:13 | → | zant joins (~zant@62.214.20.26) |
| 12:56:22 | <freeside> | So I've spent the last few days on a university discord watching some of the CS undergrads work on AdventOfCode in various languages including Rust, C++, and Haskell |
| 12:57:11 | <freeside> | it was interesting to watch them present Haskell solutions because, TBH, the code didn't look that different from the more imperative languages |
| 12:57:20 | <freeside> | and I was reminded of the quip "you can write FORTRAN in any language". |
| 12:58:26 | <freeside> | It occurs to me that Haskell feels like it has a much larger working vocabulary because there are so many more "words" to learn, from mapM_ to runParser to <- ask, and that doesn't even get into the Lens stuff |
| 12:59:16 | <freeside> | whereas most other OOPy languages would involve some amount of setup after importing a library -- you'd need to instantiate some kind of swiss-army-interface, and then you'd need to find ways to wire up your existing problem to the solution API |
| 12:59:54 | <freeside> | in Haskell, thanks to typeclasses, you can just do the import and be about your business, adding a fair amount of functionality in just another line or two of code. This takes some getting used to. |
| 13:00:07 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 13:01:28 | <[exa]> | not sure that the lack of a framework setup is a typeclass-induced feature |
| 13:01:35 | <[exa]> | freeside: did you see servant import lists? :D |
| 13:01:44 | <freeside> | something i haven't touched yet |
| 13:02:06 | <mauke> | .oO( agda sunt servanda ) |
| 13:02:20 | → | califax joins (~califax@user/califx) |
| 13:02:27 | <[exa]> | as with fortran, you can write the brutal framework setup boilerplate in any language. :D |
| 13:02:43 | <freeside> | I was quite happy with being able to leverage Megaparsec to say ( (int `separatedBy` char '-') `separatedBy` char ',' ) |
| 13:03:46 | <mauke> | http://sprunge.us/e5GE8P base only |
| 13:03:52 | <mauke> | no items. final destination. |
| 13:03:54 | <freeside> | I have no objection to the way Rust does it: scan_fmt!(l, "{d}-{d},{d}-{d}", i32, i32, i32, i32).ok() ... but I kind of prefer how Haskell lets me phrase the semantics of the solution in a more declarative way |
| 13:03:56 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
| 13:03:57 | → | Kaiepi joins (~Kaiepi@108.175.84.104) |
| 13:05:13 | <mauke> | oh yeah, you could do it in C with repeated calls to scanf("%u-%u,%u-%u", ...) |
| 13:05:18 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 13:05:35 | ← | parsnip parts (~parsnip@user/parsnip) (i shall miss thee) |
| 13:06:38 | <[exa]> | freeside: oh how nice they finally got rid of the scanf scourge with this new cool completely different syntax, right |
| 13:07:26 | → | fizbin joins (~fizbin@user/fizbin) |
| 13:09:16 | <freeside> | heh |
| 13:10:06 | <mauke> | while (scanf("%u-%u,%u-%u", &a, &b, &c, &d) == sizeof "OK\n") { |
| 13:10:33 | <mauke> | self-mockumenting code |
| 13:11:34 | <yin> | yushyin: unfortunately i'm getting `No code actions available` |
| 13:12:27 | <yin> | maybe this hls version doesn't support it... |
| 13:17:42 | → | jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
| 13:18:18 | → | gmg joins (~user@user/gehmehgeh) |
| 13:20:16 | <freeside> | yin: what version of hls are you running, against what version of ghc? |
| 13:21:06 | <yin> | hls 1.8.0.0 on ghc 9.4.2 |
| 13:21:47 | <freeside> | any better luck with other editors? |
| 13:22:15 | <freeside> | that reminds me, i should boot up vs code. i just got HLS working with 9.2.5 with emacs yesterday |
| 13:22:49 | <fizbin> | I can get vs code to do everything with haskell except actually run it. |
| 13:22:55 | <yin> | i'm now getting inferred type sigratures with vim.lsp.buf.hover. i don't think i was earlier, maybe it takes time to load (?) |
| 13:23:26 | <fizbin> | Which is fine because I have a terminal and I can run "stack runhaskell myfile.hs", but a bit weird and annoying. |
| 13:23:59 | <mauke> | I just remembered Text.ParserCombinators.ReadP |
| 13:24:57 | <fizbin> | Yeah, remembering ReadP last night with aoc would have been better. My hand-rolled parsing was... well, I guess it worked. |
| 13:25:44 | <fizbin> | read and weep: https://github.com/fizbin/aoc2022/blob/main/aoc4.hs |
| 13:26:30 | <mauke> | handrolled: http://sprunge.us/e5GE8P |
| 13:26:35 | <mauke> | with ReadP: http://sprunge.us/M0TVci |
| 13:26:54 | × | bontaq quits (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 265 seconds) |
| 13:27:14 | <freeside> | mmm. I did a version using List.Data.Split, and a version using Megaparsec. https://github.com/mengwong/adventofcode/blob/2022/apps/aoc2022-day04-megaparsec.hs |
| 13:28:39 | <yin> | -- parse numbers from a string |
| 13:28:39 | <yin> | parseNums :: (Read a,Num a) => String -> [a] |
| 13:28:39 | <yin> | parseNums xs | null n = [] | otherwise = read n : parseNums r where (n,r) = span isDigit $ dropWhile (not . isDigit) xs |
| 13:29:26 | <fizbin> | Oooh. I have a similar utility function for python that is quite useful during aoc. |
| 13:29:30 | <freeside> | splitOn was as low-level as I wanted to get ... https://github.com/mengwong/adventofcode/blob/2022/apps/aoc2022-day04.hs |
| 13:29:57 | <mauke> | fizbin: I think do notation and better names would clean that up a lot |
| 13:30:46 | × | nihonium quits (~nihonium@46.148.105.76) (Quit: leaving) |
| 13:31:29 | <mauke> | yin: that looks like it should be split into two parts, extracting substrings and mapping read over them |
| 13:32:12 | <yin> | mauke: what do you mean? |
| 13:32:35 | → | img joins (~img@user/img) |
| 13:33:24 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 13:33:47 | <mauke> | parseNums = map read . extractRuns isDigit |
| 13:33:55 | <mauke> | with extractRuns to be written separately |
| 13:34:20 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 260 seconds) |
| 13:34:23 | <yin> | would that get fused or otherwise optimized? |
| 13:34:26 | <mauke> | I think that would make it simpler |
| 13:35:18 | <mauke> | > groupBy ((==) `on` isDigit) "1-2,69-420" |
| 13:35:20 | <lambdabot> | ["1","-","2",",","69","-","420"] |
| 13:36:41 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 13:37:12 | <mauke> | > [n | w <- groupBy ((==) `on` isDigit) "1-2,69-420", [(n, "")] <- reads w] |
| 13:37:13 | <lambdabot> | error: |
| 13:37:13 | <lambdabot> | • Couldn't match expected type ‘(a0, String)’ |
| 13:37:13 | <lambdabot> | with actual type ‘[(a, [Char])]’ |
| 13:37:24 | <mauke> | > [n | w <- groupBy ((==) `on` isDigit) "1-2,69-420", (n, "") <- reads w] |
| 13:37:25 | <lambdabot> | [] |
| 13:37:56 | <mauke> | > [n | w <- groupBy ((==) `on` isDigit) "1-2,69-420", (n, "") <- reads w] :: [Int] |
| 13:37:58 | <lambdabot> | [1,2,69,420] |
| 13:38:13 | <mauke> | ew |
| 13:38:14 | <yin> | i'm prioritizing time efficiency over readability in my utility functions. you can convince me your way is better if you show me the perf :) |
| 13:38:37 | → | __monty__ joins (~toonn@user/toonn) |
| 13:38:40 | <mauke> | yin: dude, you're operating on a singly-linked list of unicode codepoints |
| 13:38:41 | <freeside> | performance of the $1000 CPU, or performance of the $100,000/year engineer? |
| 13:38:55 | <mauke> | this is very much the opposite of efficiency |
| 13:39:55 | <yin> | performance the dinner my leaderboard is betting |
| 13:41:08 | <freeside> | what other languages are in the running? |
| 13:42:25 | <yin> | mauke: yeah but on a 32bit 512MB eeePC :) |
| 13:44:40 | <yin> | freeside: off the top of my head python ruby scala java APL J and i suspect processing maybe |
| 13:45:58 | <yin> | oh! and excel :D |
| 13:51:23 | × | L29Ah quits (~L29Ah@wikipedia/L29Ah) (Ping timeout: 256 seconds) |
| 13:51:29 | <yin> | we have some rules and each one of us has a limitation (the excel guy's being the fact that he's doing it in excel) and our metric is (t part2 - t part1) |
| 13:56:20 | × | jmdaemon quits (~jmdaemon@user/jmdaemon) (Ping timeout: 268 seconds) |
| 13:59:39 | <yin> | excel guy started strong championing day 1 with just a few seconds from part1 to part2 |
| 14:03:17 | <yin> | i'm on a beaten up slow machine with a broken s key and *very* fragile charger cable and just a couple of minutes of battery |
| 14:05:14 | <yin> | on day 13 we have to switch to an unfamiliar language |
| 14:05:44 | <yin> | etc |
| 14:09:23 | × | wootehfoot quits (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer) |
| 14:10:35 | <freeside> | wait, how do you measure t part2 - t part1? specifically what is t |
| 14:11:04 | <freeside> | like, wall clock time for the human to extend the code? |
| 14:11:04 | <yin> | just the timestamp, you can fetch it from the API |
| 14:11:47 | <freeside> | time part1 is released to the human, to the time part2 is released? |
| 14:12:13 | <freeside> | then wouldn't it make sense to optimize for programmer efficiency rather than cpu time? |
| 14:13:40 | × | acidjnk_new quits (~acidjnk@p200300d6e7137a5181fc87d2e5daef70.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 14:14:03 | <yin> | it's the time we take to do part2, so much of that optimization can be prepared in part1 as we try to predict what part2 can be |
| 14:14:12 | × | lisbeths quits (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 14:14:38 | <yin> | if that makes sense |
| 14:15:25 | <freeside> | definitely makes sense ... it's the reason i started optimizing for generality and optionality |
| 14:16:03 | <freeside> | i was expecting today's part2 to have multiple ranges per elf, but it turned out to be a different extension |
| 14:16:39 | <yin> | just to clarify, we measure the delta between stars, so if i finish part1 now and part2 10 minutes later, my score is 10m |
| 14:17:03 | <yin> | i can take my time with part1 |
| 14:17:10 | <yin> | doesn't count |
| 14:18:01 | <freeside> | gotcha. yeah, i like that about aoc, it's a clever way to get people used to the idea that requirements evolve |
| 14:19:20 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 256 seconds) |
| 14:21:14 | <yin> | yes. around day 15 spending time outdoors starts being a serious requirement :D |
| 14:24:19 | <freeside> | hm. now i'm tempted to back and do previous years |
| 14:27:48 | × | shailangsa quits (~shailangs@host86-185-98-123.range86-185.btcentralplus.com) (Ping timeout: 265 seconds) |
| 14:28:56 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 14:38:58 | <freeside> | Part 2: Surprise! Elon Musk has bought your company. His new instructions are: ... |
| 14:39:26 | → | L29Ah joins (~L29Ah@wikipedia/L29Ah) |
| 14:40:44 | <yin> | that's why we're spending a few days here x |
| 14:41:02 | <yin> | https://i.pinimg.com/474x/d2/dc/46/d2dc4643b891b3b6b4b86e35e0c19af2--serra.jpg |
| 14:42:07 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 14:42:14 | × | sammelweis quits (~quassel@c-68-48-18-140.hsd1.mi.comcast.net) (Ping timeout: 260 seconds) |
| 14:42:29 | <yin> | up in the mountains, no people in sight |
| 14:42:39 | <yin> | just fresh air and aoc |
| 14:43:21 | <freeside> | Y'all are two Netflix showrunners away from a horror murder mystery |
| 14:43:44 | <freeside> | Every night, the slowest programmer is mysteriously murdered |
| 14:44:04 | <yin> | :D |
| 14:44:05 | <freeside> | "an a.out thriller" |
| 14:46:03 | <yin> | gladly the cell phone reception there is not nearly enough for netflix |
| 14:46:19 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 14:46:30 | <freeside> | (Spoiler: the killer turned out to be the Excel accountant) |
| 14:49:35 | → | acidjnk_new joins (~acidjnk@p200300d6e7137a41a959b7c74413fccb.dip0.t-ipconnect.de) |
| 14:51:00 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 248 seconds) |
| 14:52:15 | <yin> | fun fact. do you know what the people from this schist village are called? |
| 14:52:49 | <yin> | Paul. no kidding. Popupation = 1 |
| 14:59:44 | × | jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 260 seconds) |
| 15:01:20 | → | zant joins (~zant@62.214.20.26) |
| 15:03:27 | <tomsmeding> | yin: just clarifying, you aren't trying to run HLS on said eeePC right? |
| 15:04:21 | <geekosaur> | heh |
| 15:04:46 | geekosaur | has such an eeepc just over a meter from him, in fact |
| 15:04:48 | <tomsmeding> | because if so, I know the source of your issues with HLS |
| 15:05:14 | <tomsmeding> | and no, it's not the 32-bit or the slow cpu |
| 15:05:14 | <geekosaur> | battery's shot though, but unlike modern machines it will run without a battery if connected to AC |
| 15:05:24 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 248 seconds) |
| 15:06:30 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 15:09:46 | × | shriekingnoise quits (~shrieking@186.137.167.202) (Quit: Quit) |
| 15:10:54 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 256 seconds) |
| 15:20:09 | → | shailangsa joins (~shailangs@host86-186-136-124.range86-186.btcentralplus.com) |
| 15:22:09 | × | rembo10 quits (~rembo10@main.remulis.com) (Quit: ZNC 1.8.2 - https://znc.in) |
| 15:23:22 | × | img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in) |
| 15:24:18 | → | rembo10 joins (~rembo10@main.remulis.com) |
| 15:26:34 | → | seydar joins (~seydar@154-27-113-252.starry-inc.net) |
| 15:27:54 | × | opticblast quits (~Thunderbi@secure-165.caltech.edu) (Ping timeout: 256 seconds) |
| 15:28:15 | → | opticblast joins (~Thunderbi@secure-165.caltech.edu) |
| 15:28:27 | <seydar> | I'm trying to make my do-notation a one-liner so that the perl gods of old will smile upon me: https://paste.tomsmeding.com/UyDtPcq0 |
| 15:29:03 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 15:29:12 | <seydar> | but the commented out line doesn't work, because "Couldn't match type ‘IO’ with ‘[]’ Expected: [String] Actual: IO String" |
| 15:29:40 | → | zant joins (~zant@62.214.20.26) |
| 15:30:20 | <tomsmeding> | seydar: do A <- B ; C === B >>= \A -> C |
| 15:30:36 | <geekosaur> | `getContents >>= return . lines`, or `fmap lines getContents` |
| 15:30:42 | <tomsmeding> | so: str <- getContents ; return (lines str) === getContents >>= \str -> return (lines str) |
| 15:33:07 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 15:33:29 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Ping timeout: 246 seconds) |
| 15:33:43 | <seydar> | tomsmeding: I think that's what I'm doing, which is why I'm confused that it's not working |
| 15:34:19 | <geekosaur> | you have the return in the wrong placre |
| 15:34:21 | <seydar> | geekosaur: ah, it looks like I needed to put return before line, as opposed to before everything (as you have it vs. return . getContents >>= lines) |
| 15:34:25 | <seydar> | yep |
| 15:34:27 | <tomsmeding> | seydar: you wrote: return $ getContents >>= lines |
| 15:34:27 | <tomsmeding> | whereas I wrote: getContents >>= return . lines |
| 15:34:38 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 15:35:12 | <tomsmeding> | in essence you put the whole do-block inside 'return' |
| 15:35:37 | × | opticblast quits (~Thunderbi@secure-165.caltech.edu) (Ping timeout: 268 seconds) |
| 15:35:54 | × | shailangsa quits (~shailangs@host86-186-136-124.range86-186.btcentralplus.com) (Ping timeout: 260 seconds) |
| 15:36:03 | → | freeside joins (~mengwong@103.252.202.193) |
| 15:37:02 | <seydar> | tomsmeding: ah gotcha gotcha |
| 15:37:06 | <seydar> | thank you |
| 15:37:31 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 15:38:02 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 15:40:53 | × | acidjnk_new quits (~acidjnk@p200300d6e7137a41a959b7c74413fccb.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 15:41:09 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 260 seconds) |
| 15:41:15 | → | acidjnk_new joins (~acidjnk@p200300d6e7137a416972f28bfc035f03.dip0.t-ipconnect.de) |
| 15:42:29 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 15:43:26 | → | califax joins (~califax@user/califx) |
| 15:53:17 | → | zer0bitz joins (~zer0bitz@196.244.192.57) |
| 15:55:06 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 15:55:42 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 15:57:57 | <chymera> | how do I do `make clean` for a haskell project? do I need cabal? |
| 15:58:26 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 268 seconds) |
| 15:59:01 | <tomsmeding> | chymera: rm *.hi *.o and any executables? |
| 15:59:31 | <tomsmeding> | (assuming you're compiling with ghc directly) |
| 15:59:59 | <tomsmeding> | chymera: you may also be interested in the -odir and -hidir options of ghc in that case |
| 16:02:16 | → | zant joins (~zant@62.214.20.26) |
| 16:04:26 | → | Erutuon joins (~Erutuon@user/erutuon) |
| 16:05:44 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
| 16:06:01 | × | seydar quits (~seydar@154-27-113-252.starry-inc.net) (Quit: leaving) |
| 16:07:10 | <ksu> | if compilation time is not an issue, you could use -no-keep-hi-files -no-keep-o-files |
| 16:07:58 | → | segfaultfizzbuzz joins (~segfaultf@23-93-74-212.fiber.dynamic.sonic.net) |
| 16:08:00 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 16:08:00 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 16:08:02 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 16:08:26 | → | freeside joins (~mengwong@103.252.202.193) |
| 16:09:59 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 16:13:10 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 265 seconds) |
| 16:13:23 | × | jinsl quits (~jinsl@2408:8207:2559:28e0:211:32ff:fec8:6aea) (Ping timeout: 264 seconds) |
| 16:13:34 | → | jinsl- joins (~jinsl@2408:8207:2554:1a50:211:32ff:fec8:6aea) |
| 16:15:45 | → | zeenk joins (~zeenk@2a02:2f04:a30d:4300::7fe) |
| 16:17:35 | → | califax joins (~califax@user/califx) |
| 16:19:00 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 248 seconds) |
| 16:22:52 | → | ddellacosta joins (~ddellacos@143.244.47.100) |
| 16:24:32 | → | Guest11 joins (~Guest11@2001:1c02:2b2e:5600:81ea:2a62:9134:c75e) |
| 16:25:09 | × | Guest11 quits (~Guest11@2001:1c02:2b2e:5600:81ea:2a62:9134:c75e) (Client Quit) |
| 16:25:32 | → | CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
| 16:29:05 | × | pagnol quits (~user@213-205-209-87.ftth.glasoperator.nl) (Remote host closed the connection) |
| 16:31:40 | <yin> | tomsmeding: ha! not a chance |
| 16:33:58 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 16:34:00 | <tomsmeding> | phew |
| 16:34:05 | yin | is now known as zzz |
| 16:34:09 | → | chexum_ joins (~quassel@gateway/tor-sasl/chexum) |
| 16:34:51 | <chymera> | tomsmeding: thanks, -odir and -hdir sound nice in principle, but the man page says e.g. odir is the “object” directory? |
| 16:35:04 | <chymera> | I actually thought it would be an object dir |
| 16:35:10 | <tomsmeding> | chymera: -odir is the place where the .o files are put, -hidir is the place where the .hi files are put ;) |
| 16:35:15 | <chymera> | so I can keep my source and compiler output separate |
| 16:35:17 | <chymera> | ah |
| 16:35:19 | <chymera> | cool |
| 16:35:27 | <chymera> | do I need any of them to execute the applicaion? |
| 16:35:31 | <tomsmeding> | no |
| 16:35:39 | → | Guest5 joins (~Guest5@250.79-105-213.static.virginmediabusiness.co.uk) |
| 16:35:42 | <chymera> | cool |
| 16:35:43 | <tomsmeding> | treat them as .o files in the C world |
| 16:35:48 | <tomsmeding> | if that means anything to you |
| 16:35:50 | <Guest5> | Hello Haskell folks |
| 16:36:33 | <Guest5> | I have done the unthinkable, and replaced my windows build with Ubuntu. It has not internet now! |
| 16:36:41 | <Guest5> | I'm on my phone... |
| 16:36:59 | <Guest5> | I can download GHC, but I also want cabal |
| 16:37:07 | <Guest5> | What should I do!? |
| 16:37:14 | <chymera> | yep, makes sense, I'm really new to haskell life and thus far it's been pretty rough so I treat everything like it's going to blow up in my face :D |
| 16:37:26 | <sclv> | ghcup installs both |
| 16:37:33 | <Guest5> | No internet |
| 16:37:46 | <tomsmeding> | Guest5: https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-x86_64-linux-deb10.tar.xz ? |
| 16:37:58 | <Guest5> | Have to download things on my phone and copy them over by USB |
| 16:38:25 | <Guest5> | Tom, do you think it will work with the debian binary on Ubuntu? |
| 16:38:34 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 16:38:41 | <tomsmeding> | ubuntu is practically debian, wich a bunch of surface-level changes |
| 16:38:43 | <Guest5> | That would save trying to build it at least... |
| 16:38:44 | <tomsmeding> | so yes |
| 16:38:55 | <tomsmeding> | s/wich/with/ |
| 16:38:57 | <Guest5> | Ok awesome I'll try that and get back to you |
| 16:39:16 | <Guest5> | Chimera, don't worry, Haskell is friendly |
| 16:39:40 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 16:40:45 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 16:40:46 | <Guest5> | Also, how can I get things off of hackage? |
| 16:41:12 | <Guest5> | Do I just find the repo in "contents" somehow? |
| 16:41:42 | <tomsmeding> | Guest5: there's a .tar.gz link under the Downloads heading, above the readme |
| 16:42:05 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 16:42:14 | <tomsmeding> | but you'll have to compile the thing yourself (should just be 'cabal build'), and get and compile dependencies yourself :p |
| 16:42:15 | <Guest5> | Obviously this is only going to work for things without too many dependencies, but I at least want to use things like System.Random |
| 16:42:59 | <Guest5> | Nothing with like a million layers of semigroups and profunctor lenses... |
| 16:43:04 | → | fizbin joins (~fizbin@user/fizbin) |
| 16:43:27 | <Guest5> | (arguably these should be in base?) |
| 16:43:38 | <tomsmeding> | Guest5: for 'random' you'll only need 'splitmix', the rest are ghc boot libs (i.e. installed with ghc) |
| 16:44:07 | <tomsmeding> | (also, for a *significant* quality of life improvement, try to get internet working...) |
| 16:44:52 | <Guest5> | I'm making differentiable random sequences for a Cartesian product dictionary frame for machine learning |
| 16:45:14 | → | freeside joins (~mengwong@103.252.202.193) |
| 16:45:37 | <Guest5> | Does anyone know of an effecient 'divmod' implementation? |
| 16:45:50 | <tomsmeding> | :t divMod |
| 16:45:51 | <lambdabot> | Integral a => a -> a -> (a, a) |
| 16:45:58 | <tomsmeding> | see also |
| 16:46:00 | <tomsmeding> | :t quotRem |
| 16:46:01 | <lambdabot> | Integral a => a -> a -> (a, a) |
| 16:46:25 | <tomsmeding> | which is slightly more efficient than divMod, but divMod ensures that the remainder is always positive, even for negative inputs |
| 16:46:40 | <Guest5> | Yeah, I have no idea why installing the most up to date Ubuntu on a shop bought machine would destroy the wifi drivers |
| 16:46:57 | <Guest5> | Very disappointed in the gnu Cru for this |
| 16:46:58 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 16:47:11 | <kjlid[m]> | How do I specify a bitfield in a C foreign type? If I set the fields to CUInt it tried to get the address of it and that is invalid |
| 16:47:50 | <kjlid[m]> | I have a #starttype struct foo with a bunch of #field bar , CUint right now |
| 16:47:52 | × | Guest5 quits (~Guest5@250.79-105-213.static.virginmediabusiness.co.uk) (Quit: Client closed) |
| 16:50:14 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 268 seconds) |
| 16:52:23 | → | jonathanx joins (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
| 16:53:28 | → | Scraeling joins (~Scraeling@user/scraeling) |
| 16:53:47 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 16:55:38 | × | kuribas quits (~user@ptr-17d51emajr6v18pa5yl.18120a2.ip6.access.telenet.be) (Quit: ERC (IRC client for Emacs 27.1)) |
| 16:59:47 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 17:00:13 | → | nate4 joins (~nate@98.45.169.16) |
| 17:04:20 | × | nate4 quits (~nate@98.45.169.16) (Ping timeout: 248 seconds) |
| 17:05:13 | <mauke> | generally, you don't |
| 17:05:50 | <kjlid[m]> | Alright. What are my options then? |
| 17:06:10 | <mauke> | cry |
| 17:06:31 | <kjlid[m]> | Already tried that |
| 17:08:19 | <glguy> | fizbin: I'm doing them in Haskell on the day and then sometimes I add them to my C++ repo later |
| 17:11:58 | <kjlid[m]> | Would it work if i created a couple of C functions that takes the struct and returns the values within them and then us me those whenever i want to get those values? |
| 17:12:17 | <mauke> | kjlid[m]: yes, accessor functions seem to be the only workaround |
| 17:12:20 | <kjlid[m]> | And then use those* |
| 17:12:23 | → | sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) |
| 17:12:43 | <mauke> | I don't see any GHC extension that would cover bitfields |
| 17:13:02 | <mauke> | (which is why bitfields rarely appear in interfaces) |
| 17:13:20 | <kjlid[m]> | Yeah I just found a six year old ghc ticket about it that referenced a mailing list discussion from 2008 |
| 17:13:38 | <tomsmeding> | sounds legit |
| 17:16:28 | → | freeside joins (~mengwong@103.252.202.193) |
| 17:19:04 | × | titibandit quits (~titibandi@xdsl-78-35-173-119.nc.de) (Quit: Leaving.) |
| 17:21:14 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 256 seconds) |
| 17:21:48 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 17:23:49 | → | zant joins (~zant@62.214.20.26) |
| 17:23:53 | <fizbin> | glguy: huh. I was trying to figure out how you were doing things like today's star 1 in 2:20 in haskell as your solution on the day, but maybe with enough of a library ready to go ahead of time, it's doable. |
| 17:24:21 | <glguy> | fizbin: did you look at the solution I posted? |
| 17:27:58 | → | akegalj joins (~akegalj@188.252.198.134) |
| 17:28:53 | <glguy> | for a quick-and-dirty parse without any library helpers, you can go with something like |
| 17:28:54 | <glguy> | > let { parse :: String -> [Int]; parse = map read . words . map (\x -> if isDigit x then x else ' ') } in parse "0-1,2-3" |
| 17:28:55 | <lambdabot> | [0,1,2,3] |
| 17:29:03 | <glguy> | and then all that's left is using <= |
| 17:32:03 | <mauke> | is there a way to do part 1 without doing two sets of comparisons? |
| 17:32:55 | <fizbin> | Yeah, that makes sense. I've got a similar utility function in python (finds all numbers with \b\d+\b and converts them to ints) |
| 17:33:30 | × | razetime quits (~quassel@49.207.211.219) (Ping timeout: 260 seconds) |
| 17:34:24 | <mauke> | my @n = $str =~ /\d+/ag; |
| 17:34:52 | → | freeside joins (~mengwong@103.252.202.193) |
| 17:36:57 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 17:37:25 | × | dolio quits (~dolio@130.44.134.54) (Quit: ZNC 1.8.2 - https://znc.in) |
| 17:39:44 | <fizbin> | > let { p1judge :: Int->Int->Int->Int->Bool; p1judge a b c d = (\x y -> (x `Data.Set.isSubsetOf` y) || (y `Data.Set.isSubsetOf` x)) (Data.Set.fromList [a..b]) (Data.Set.fromList [c..d]) } in [p1judge 0 1 2 3, p1judge 0 4 2 4] |
| 17:39:46 | <lambdabot> | [False,True] |
| 17:39:52 | <fizbin> | mauke: ^^^ |
| 17:41:04 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 17:41:12 | <fizbin> | Depends on what you consider "doing two sets of comparisons" means, I suppose. |
| 17:41:13 | <mauke> | yeah, that's two sets of comparisons with || |
| 17:42:48 | <glguy> | mauke: you could do something like: case compare a c of LT -> d <= b; EQ -> True; GT -> b <= d |
| 17:44:19 | <fizbin> | > let { p1judge :: Int->Int->Int->Int->Bool; p1judge a b c d = ((a-c)*(b-d)) <= 0 } in [p1judge 0 1 2 3, p1judge 0 4 2 4, p1judge 0 5 2 3, p1judge 0 3 2 5] |
| 17:44:20 | <mauke> | hmm |
| 17:44:20 | <lambdabot> | [False,True,True,False] |
| 17:44:40 | → | [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 17:45:47 | <fizbin> | How about that ^^^ ? |
| 17:46:45 | → | causal joins (~user@50.35.85.7) |
| 17:46:46 | → | trev joins (~trev@user/trev) |
| 17:46:48 | <mauke> | nice |
| 17:48:06 | × | Scraeling quits (~Scraeling@user/scraeling) (Quit: Scraeling) |
| 17:48:27 | → | Scraeling joins (~Scraeling@user/scraeling) |
| 17:48:36 | <trev> | sorry for the drive-by question, but can someone just tell me what the sweet version combo of ghc + hls + a formatter [fourmolu?]. i can't seem to get everything working together |
| 17:50:08 | × | acidjnk_new quits (~acidjnk@p200300d6e7137a416972f28bfc035f03.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 17:51:07 | <Scraeling> | ghcup shows 9.2.2 as the latest version available with hls |
| 17:51:19 | <Scraeling> | 8.10.7 if you need 8.x |
| 17:51:38 | <Scraeling> | Or you can build latest with hls yourself |
| 17:52:44 | <trev> | Scraeling mine shows 9.4.2 as latest with hls |
| 17:52:47 | → | wootehfoot joins (~wootehfoo@user/wootehfoot) |
| 17:53:23 | <trev> | but when i use that then the formatter doesn't work, so i hunted down the supported version and it doesn't support ghc 9.4 lol |
| 17:54:18 | <trev> | then i tried ghc 9.2.4 and HLS had some bug telling me i didn't add a config for MinGQ but i'm on linux and that's some windows crap! |
| 17:55:23 | <fizbin> | I'm using stack with LTS 19.33 so that I get ghc 9.0.2 which is supported by hls and everything else I want. But I don't need the latest features for this. |
| 17:56:12 | <trev> | let me jump to that version and see. i don't need any new features either, just want to do AoC and tinker with Haskell a bit |
| 17:56:16 | → | dolio joins (~dolio@130.44.134.54) |
| 18:01:15 | × | sammelweis quits (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) (Ping timeout: 260 seconds) |
| 18:01:28 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 18:04:37 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 18:05:33 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 18:05:45 | <trev> | nope, i still get some missing setInitialDynFlags in my ghc settings errors when the HLS starts up |
| 18:06:30 | <trev> | oh well..i will just live without formatting on save for now...like a peasant |
| 18:12:18 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
| 18:13:36 | → | acidjnk joins (~acidjnk@p200300d6e7137a4188c21b5678eecc17.dip0.t-ipconnect.de) |
| 18:15:12 | × | ddellacosta quits (~ddellacos@143.244.47.100) (Quit: WeeChat 3.7.1) |
| 18:17:06 | → | rburkholder joins (~blurb@96.45.2.121) |
| 18:18:27 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 18:19:20 | → | ddellacosta joins (~ddellacos@143.244.47.100) |
| 18:20:20 | <tomsmeding> | trev: ghcup upgrade / ghcup update? |
| 18:20:30 | <tomsmeding> | which hls version are you getting |
| 18:21:34 | <trev> | tomsmeding i was trying to get 9.2.4 cause that seems to have HLS with formatter support |
| 18:21:40 | <tomsmeding> | trev: which _HLS_ version |
| 18:21:43 | <tomsmeding> | 1.8.0.0? |
| 18:21:47 | <trev> | yes |
| 18:22:01 | <tomsmeding> | ah, okay I was thinking you might be getting an old hls version |
| 18:22:08 | <tomsmeding> | 9.2.4 should work with hls though??? |
| 18:22:15 | <tomsmeding> | works perfectly over here |
| 18:22:27 | <trev> | yes, i had some other issues so i did ghcup nuke and now i'm starting over |
| 18:22:32 | <tomsmeding> | :') |
| 18:22:55 | <trev> | is there a reason why the default ghc is 9.2.5 with no HLS support? |
| 18:23:12 | <glguy> | time |
| 18:23:37 | <trev> | fair enough |
| 18:24:55 | <trev> | now i get this error: ghcide compiled against GHC 9.4.2 but currently using 9.0.2 |
| 18:25:28 | <tomsmeding> | trev: restart your editor |
| 18:25:49 | <tomsmeding> | every ghc version needs a separately compiled hls executable, so you have a couple executables on your machine |
| 18:26:04 | <tomsmeding> | changing the ghc version in a project probably doesn't automatically restart hls, so you end up with the wrong executable running |
| 18:26:16 | <trev> | makes sense. |
| 18:26:48 | <trev> | lol restarted and it doesn't seem to be running at all now |
| 18:27:46 | <trev> | oh wait, now it jumped a version |
| 18:27:47 | <trev> | ghcide compiled against GHC 9.4.2 but currently using 9.2.5 |
| 18:28:11 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 18:28:18 | <trev> | maybe i need to get rid of ghcide compiled with 9.4.2 |
| 18:29:05 | <gurkenglas> | Is stack solver not a thing anymore? |
| 18:29:36 | <tomsmeding> | trev: try running 'haskell-language-server-wrapper' in a terminal in your project directory |
| 18:29:43 | <glguy> | gurkenglas: I thought that died years ago |
| 18:29:43 | <tomsmeding> | does that detect the used ghc version correctly? |
| 18:30:47 | <gurkenglas> | so the thing to do now is... run stack build, get dozens of lines to "try adding to extra-deps", repeat until convergence? |
| 18:31:32 | × | akegalj quits (~akegalj@188.252.198.134) (Quit: leaving) |
| 18:31:37 | <glguy> | gurkenglas: I think for people who use stack they just try to stay mostly in a resolver |
| 18:32:13 | <gurkenglas> | makes sense, maybe i can find the place where i left that trodden path |
| 18:33:46 | × | Scraeling quits (~Scraeling@user/scraeling) (Quit: Scraeling) |
| 18:35:42 | <gurkenglas> | Given a folder with hundreds of "could not find module" errors upon stack build and no stack.yaml except the fresh one i just put there, how should I approach those errors? |
| 18:36:46 | <gurkenglas> | There's apparently a lot of places you can talk about what other packages to look up those modules in |
| 18:39:06 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 18:39:25 | <tomsmeding> | gurkenglas: there's no .cabal file that lists dependencies? |
| 18:39:30 | <gurkenglas> | nope |
| 18:39:37 | <tomsmeding> | hackage has a whole bunch of packages with overlapping modules, so good luck :p |
| 18:39:45 | <geekosaur> | package.yaml? |
| 18:39:59 | <gurkenglas> | nope |
| 18:40:14 | <tomsmeding> | not sure if there are overlapping modules in stackage, but I would be surprised if there aren't |
| 18:40:25 | <tomsmeding> | but hoogle may help |
| 18:40:34 | <tomsmeding> | @hoogle Control.Monad.Reader.Trans |
| 18:40:35 | <lambdabot> | Control.Monad.Reader.Has class MonadTrans (t :: Type -> Type -> Type -> Type) |
| 18:40:40 | <tomsmeding> | oh that's not very helpful |
| 18:41:08 | <gurkenglas> | tomsmeding: that seems like a premature worry, first we can see whether telling it "just get those modules whereever they're defined" reduces the errors from 211 to 30 |
| 18:41:28 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 252 seconds) |
| 18:41:32 | <tomsmeding> | hm, I thought hoogle could search for module names, apparently not |
| 18:41:41 | → | bobbingbob joins (~dfadsva@2604:3d09:207f:f650::7b3a) |
| 18:42:32 | <tomsmeding> | https://docs.haskellstack.org/en/latest/script_command/ |
| 18:42:46 | <tomsmeding> | 'stack script' is apparently able to look up packages exposing the imported modules |
| 18:42:54 | <geekosaur> | @hoogle module Control.Monad.Reader.Trans |
| 18:42:54 | <lambdabot> | No results found |
| 18:43:13 | <gurkenglas> | Neat. Can I tell vscode to treat these .hs files as scripts? |
| 18:43:38 | <tomsmeding> | I guess you'd hope that 'stack script something.hs' would somehow print the packages being resolv.ed |
| 18:43:42 | <tomsmeding> | s/\.// |
| 18:49:11 | × | chexum_ quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 18:50:29 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 268 seconds) |
| 18:50:43 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 18:51:55 | <iqubic> | Is there a point to Divisble and Decidable beyond just "This lets me do linear time discrimination?" |
| 18:52:27 | → | freeside joins (~mengwong@103.252.202.193) |
| 18:55:49 | → | zant joins (~zant@62.214.20.26) |
| 18:55:56 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 18:56:00 | × | Chai-T-Rex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 18:56:40 | → | Chai-T-Rex joins (~ChaiTRex@user/chaitrex) |
| 18:57:09 | × | ddellacosta quits (~ddellacos@143.244.47.100) (Ping timeout: 260 seconds) |
| 18:57:23 | → | michalz joins (~michalz@185.246.204.90) |
| 18:57:25 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 18:58:06 | → | califax joins (~califax@user/califx) |
| 18:59:18 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 19:00:41 | <EvanR> | Divisible represents the contravariant version of applicative, so it completes a categorical puzzle |
| 19:00:52 | <EvanR> | that it has at least 1 use makes it cool |
| 19:01:01 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 19:01:37 | <sm> | gurkenglas: I think you can't make HLS handle stack/cabal scripts yet |
| 19:03:02 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 19:05:14 | <kjlid[m]> | Where do I put `packages` in my cabal file? No matter where I put it I get `Unknown field: "packages"` |
| 19:05:34 | <glguy> | packages: is from cabal.project - the configuration for your build workspace |
| 19:05:48 | <glguy> | build-depends: is for your .cabal file, the packages that package depends on |
| 19:06:22 | <kjlid[m]> | Oh. Duuh |
| 19:09:48 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 19:09:58 | → | chomwitt joins (~chomwitt@2a02:587:7a0c:6a00:1ac0:4dff:fedb:a3f1) |
| 19:11:53 | → | neminis joins (~neminis@43.21.135.77.rev.sfr.net) |
| 19:14:01 | → | bontaq joins (~user@ool-45779fe5.dyn.optonline.net) |
| 19:18:18 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 19:26:05 | <iqubic> | EvanR: are there any real world situations where Divisible and/or Decidable are useful? |
| 19:26:25 | <EvanR> | on this subject you probably know as much as me |
| 19:30:44 | → | tzh joins (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
| 19:32:46 | → | jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
| 19:33:16 | × | jonathanx quits (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
| 19:33:40 | → | jonathanx joins (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
| 19:34:59 | → | Kaipei joins (~Kaiepi@108.175.84.104) |
| 19:37:19 | → | fockerize joins (~finn@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 19:37:59 | → | thyriaen joins (~thyriaen@2a01:aea0:dd4:470d:6245:cbff:fe9f:48b1) |
| 19:37:59 | × | machinedgod quits (~machinedg@d198-53-218-113.abhsia.telus.net) (Ping timeout: 264 seconds) |
| 19:38:55 | × | Kaiepi quits (~Kaiepi@108.175.84.104) (Ping timeout: 260 seconds) |
| 19:41:04 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 19:42:05 | → | sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) |
| 19:42:05 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 19:44:05 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 19:46:52 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
| 19:48:48 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 19:51:58 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 256 seconds) |
| 19:54:21 | <tomsmeding> | gurkenglas: sqlite3 ~/.stack/pantry/pantry.sqlite3 "select distinct package_name.name from hackage_cabal join package_name on hackage_cabal.name = package_name.id where (select contents from blob where id = hackage_cabal.cabal) like '%Control.Monad.Reader' || char(10) || '%';" |
| 19:54:54 | <tomsmeding> | replace module name with the thing you're looking for |
| 19:55:57 | <tomsmeding> | I believe this searches all packages on hackage, not just stackage, so there will be duplicates, but at least it's something |
| 19:56:53 | <tomsmeding> | the char(10) is to ensure there's nothing after the module name, i.e. don't match Control.Monad.Reader.Trans |
| 19:58:10 | × | neminis quits (~neminis@43.21.135.77.rev.sfr.net) (Quit: Client closed) |
| 20:01:25 | × | trev quits (~trev@user/trev) (Quit: trev) |
| 20:02:37 | <gurkenglas> | tomsmeding: not bad, though small misunderstanding. i was already able to extract the module names from the errors and feed them through a language model to get guesses at package names. i was not able to use that to get rid of the errors. stack install pandoc did not make vscode see Text.Pandoc. |
| 20:03:18 | × | acidjnk quits (~acidjnk@p200300d6e7137a4188c21b5678eecc17.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 20:03:28 | × | perrierjouet quits (~perrier-j@modemcable048.127-56-74.mc.videotron.ca) (Quit: WeeChat 3.7.1) |
| 20:04:55 | <gurkenglas> | i tried a number of things involving stack.yaml and package.yaml and .cabal files. i'd like something that uses tools instead of having me interact with files |
| 20:05:32 | → | opticblast joins (~Thunderbi@secure-165.caltech.edu) |
| 20:06:09 | → | perrierjouet joins (~perrier-j@modemcable048.127-56-74.mc.videotron.ca) |
| 20:06:44 | × | Xeroine quits (~Xeroine@user/xeroine) (Excess Flood) |
| 20:07:03 | → | Xeroine joins (~Xeroine@user/xeroine) |
| 20:09:08 | <gurkenglas> | (because that tends to result in more comprehensible errors) |
| 20:10:47 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 20:14:02 | → | acidjnk joins (~acidjnk@p200300d6e7137a4188c21b5678eecc17.dip0.t-ipconnect.de) |
| 20:14:44 | <tomsmeding> | gurkenglas: ah :) |
| 20:14:58 | <tomsmeding> | the whole design of haskell packaging tools is that you must list your dependencies in a file |
| 20:15:04 | <tomsmeding> | so you aren't going to get around that :) |
| 20:15:13 | <tomsmeding> | be it a *.cabal file or package.yaml |
| 20:15:57 | <tomsmeding> | gurkenglas: 'stack install <libraryname>' and 'cabal install <libraryname>' are usually ineffective and sometimes actively harmful, please avoid running those commands at all costs |
| 20:15:58 | <gurkenglas> | or a .hs file |
| 20:16:10 | <tomsmeding> | not to be confused with 'cabal install <executablename>', which is totally fine, by the way |
| 20:17:09 | <tomsmeding> | gurkenglas: the major build tools in haskell-land, stack and cabal, both take package dependencies from a *.cabal file, not from a .hs file. 'hpack' is a tool that automatically generates a *.cabal file from a package.yaml file, and hpack is automatically invoked by stack |
| 20:17:29 | <tomsmeding> | so, what you want is impossible, I think |
| 20:17:44 | <tomsmeding> | aside from using 'stack script', which is useful only for single-file programs |
| 20:19:42 | <tomsmeding> | <gurkenglas> i tried a number of things involving stack.yaml and package.yaml and .cabal files. |
| 20:19:44 | <tomsmeding> | wait, that didn't work? |
| 20:19:53 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 255 seconds) |
| 20:20:07 | <tomsmeding> | stack.yaml is not the right place, though if you insist on using stack, you'll need to add extra-deps entries there for non-stackage packages |
| 20:21:19 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 252 seconds) |
| 20:21:27 | <gurkenglas> | you just wait what's impossible with next year's tech ^^ if i can mechanically look through a *.hs file to assemble the corresponding *.cabal/package.yaml, so can a tool |
| 20:25:43 | <sm> | nifty sqlite querying of pantry tomsmeding, I haven't seen that before |
| 20:26:02 | <sm> | pantry is a cache of hackage metadata, roughly ? |
| 20:26:15 | → | pavonia joins (~user@user/siracusa) |
| 20:29:24 | × | fizbin quits (~fizbin@user/fizbin) (Remote host closed the connection) |
| 20:29:43 | → | fizbin joins (~fizbin@user/fizbin) |
| 20:32:15 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 20:32:35 | × | jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 260 seconds) |
| 20:33:36 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 20:38:14 | → | Bocaneri joins (~sauvin@user/Sauvin) |
| 20:38:38 | Bocaneri | is now known as Guest3282 |
| 20:39:49 | × | Sauvin quits (~sauvin@user/Sauvin) (Killed (NickServ (GHOST command used by Guest3282))) |
| 20:39:53 | Guest3282 | is now known as Sauvin |
| 20:42:23 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 20:42:56 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
| 20:43:37 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 20:44:15 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 260 seconds) |
| 20:45:03 | → | zant joins (~zant@62.214.20.26) |
| 20:50:31 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 20:52:40 | <gurkenglas> | Oh, idea. Probably I can ask the originator of this folder of *.hs files to run a command that will return what packages he has at what versions, then I can put that in the package.yaml. What command does he need to run? |
| 20:53:18 | <geekosaur> | if he's not using stack.yaml or *.cabal then ghc-pkg list --user |
| 20:53:58 | → | coot joins (~coot@213.134.171.3) |
| 20:53:59 | <geekosaur> | (here's hoping he isn't using nix) |
| 20:54:06 | <gurkenglas> | hmm when i run that it returns nothing |
| 20:54:17 | <geekosaur> | it won't if you have a cabal or stack based setup |
| 20:54:18 | <gurkenglas> | (unless i leave out the --user) |
| 20:54:28 | <geekosaur> | they both replace the user db |
| 20:54:35 | × | zeenk quits (~zeenk@2a02:2f04:a30d:4300::7fe) (Quit: Konversation terminated!) |
| 20:54:55 | <gurkenglas> | i see, thanks. |
| 20:55:08 | <geekosaur> | and the global db should only be occupied by the packages that ship with ghc, although I suppose he might have installed some packages there too so maybe leave off the --user |
| 20:56:56 | <gurkenglas> | geekosaur: does that mean he'd need to run both, or is one a subset of the other? |
| 20:57:22 | <geekosaur> | without any option it lists both global and user dbs |
| 20:57:33 | <geekosaur> | or you can specify --global or --user |
| 20:58:38 | → | Guest11 joins (~Guest11@2001:1c02:2b2e:5600:cbae:a56e:e19b:fcee) |
| 20:59:34 | <geekosaur> | I don't know if or how stack would do this, but cabal does keep a package db of its own. I just did: ghc-pkg list -f ~/.local/state/cabal/store/ghc-9.2.5/package.db |
| 21:00:00 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 260 seconds) |
| 21:00:18 | <geekosaur> | note that that's with cabal 3.10-pre in XDG mode; it'll be ~/.cabal/store instead of ~/.local/state/cabal/store for released versions |
| 21:00:34 | <geekosaur> | and of course whatever compiler version you have/use |
| 21:02:10 | → | oldsk00l joins (~znc@ec2-3-125-42-182.eu-central-1.compute.amazonaws.com) |
| 21:03:58 | <geekosaur> | it copies entries from that into a project's private package db, iirc, so the project sees only the packages compatible with it and not other versions |
| 21:04:25 | × | Guest11 quits (~Guest11@2001:1c02:2b2e:5600:cbae:a56e:e19b:fcee) (Quit: Client closed) |
| 21:05:50 | × | sammelweis quits (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) (Ping timeout: 260 seconds) |
| 21:05:54 | → | kenran joins (~user@user/kenran) |
| 21:07:02 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 21:09:47 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 264 seconds) |
| 21:09:51 | → | jmdaemon joins (~jmdaemon@user/jmdaemon) |
| 21:10:35 | → | zant joins (~zant@62.214.20.26) |
| 21:17:40 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 248 seconds) |
| 21:19:10 | → | sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) |
| 21:20:36 | → | tomokojun joins (~tomokojun@37.19.210.31) |
| 21:26:27 | → | jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
| 21:28:11 | → | freeside joins (~mengwong@103.252.202.193) |
| 21:31:18 | × | biberu quits (~biberu@user/biberu) (Read error: Connection reset by peer) |
| 21:35:18 | → | biberu joins (~biberu@user/biberu) |
| 21:36:05 | × | Sciencentistguy quits (~sciencent@hacksoc/ordinary-member) (Quit: o/) |
| 21:37:16 | → | ballast joins (~ballast@rrcs-24-43-123-92.west.biz.rr.com) |
| 21:39:11 | × | CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 264 seconds) |
| 21:39:23 | → | zant joins (~zant@62.214.20.26) |
| 21:40:09 | × | ballast quits (~ballast@rrcs-24-43-123-92.west.biz.rr.com) (Client Quit) |
| 21:42:45 | → | ballast joins (~ballast@rrcs-24-43-123-92.west.biz.rr.com) |
| 21:46:23 | <ballast> | How do you avoid cyclic dependencies in this case? https://paste.tomsmeding.com/N5f7opAT |
| 21:47:01 | <ballast> | I could just throw BResource into A.hs but it morally belongs in B.hs |
| 21:47:26 | <geekosaur> | there are .hs-boot files. I would strenuously avoid using them |
| 21:47:39 | → | mikoto-chan joins (~mikoto-ch@2001:999:680:9f4:6a82:d55c:feff:5f4) |
| 21:48:01 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 21:48:29 | → | merijn joins (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) |
| 21:48:33 | <EvanR> | since the data types are not mutually recursive you can put them in separate files, and the functions in a third file |
| 21:49:01 | <ballast> | Yeah I was thinking of like making a B.Types module. I saw some comments that it was an antipattern and I kind of agree. |
| 21:49:09 | <EvanR> | worst case scenario* |
| 21:49:14 | × | opticblast quits (~Thunderbi@secure-165.caltech.edu) (Ping timeout: 260 seconds) |
| 21:49:50 | <EvanR> | it's kind of hard to tell what's going on since BResource seems pointless where it is |
| 21:50:07 | <ballast> | Was wondering what the best practices would be in this case. I could for example just make Resource parameterized and just have an alias for Resource BResource |
| 21:50:27 | <EvanR> | why are the operations for Resource not in the file for Resource |
| 21:51:32 | <ballast> | In this case it's because I want to separate B.hs into its own package eventually. i guess if I were to do that I would need to parameterize in B.hs instead of importing Resource. So I guess that solves my question lol |
| 21:51:48 | → | opticblast joins (~Thunderbi@secure-165.caltech.edu) |
| 21:51:58 | <EvanR> | XY problem complete xD |
| 21:53:53 | <EvanR> | yeah if func won't actually use details of Resource better to be parametric |
| 21:54:56 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 256 seconds) |
| 21:55:41 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 21:56:43 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) |
| 21:59:18 | → | zant joins (~zant@62.214.20.26) |
| 22:01:00 | → | Sciencentistguy joins (~sciencent@hacksoc/ordinary-member) |
| 22:02:15 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 22:02:35 | → | califax joins (~califax@user/califx) |
| 22:04:36 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 248 seconds) |
| 22:05:23 | → | shriekingnoise joins (~shrieking@186.137.167.202) |
| 22:08:40 | → | bilegeek joins (~bilegeek@2600:1008:b020:f89e:4697:1f09:bb25:aea6) |
| 22:14:45 | → | machinedgod joins (~machinedg@d198-53-218-113.abhsia.telus.net) |
| 22:15:52 | <gqplox[m]> | hi guys |
| 22:15:56 | <gqplox[m]> | how's it going? |
| 22:17:27 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 22:19:22 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 22:19:30 | → | califax joins (~califax@user/califx) |
| 22:20:57 | → | titibandit joins (~titibandi@xdsl-78-35-173-119.nc.de) |
| 22:21:57 | × | merijn quits (~merijn@c-001-001-017.client.esciencecenter.eduvpn.nl) (Ping timeout: 252 seconds) |
| 22:22:55 | <dsal> | Not bad. Went efoiling yesterday and found out that what seemed to be the laziest thing was actually exhausting. This is slightly on topic. |
| 22:23:32 | <ballast> | is there a way to make an alias so I can stop writing (Ord a, Show a) => a -> ... |
| 22:23:43 | <dsal> | ballast: yeah, there's ConstraintKinds |
| 22:23:47 | → | caryhartline joins (~caryhartl@2600:1700:2d0:8d30:b403:2f20:d663:1bea) |
| 22:24:20 | <ballast> | Thanks |
| 22:24:38 | <dsal> | I wouldn't use it for that, though. I've used it where I had a lot of constraints in a lot of places |
| 22:24:57 | <gqplox[m]> | oh wow that looks fun |
| 22:25:04 | → | bjourne2 joins (~bjorn@94.191.136.212.mobile.tre.se) |
| 22:25:13 | × | gmg quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 22:25:55 | <gqplox[m]> | i didn't have much time for advent of code today so my solution is a bit hacky with the parsing, i said i was gonna do it properly but didn't :( |
| 22:25:57 | <gqplox[m]> | http://sprunge.us/1EsWOa |
| 22:26:01 | <gqplox[m]> | can I see yours? |
| 22:26:43 | × | TonyStone quits (~TonyStone@cpe-74-76-57-186.nycap.res.rr.com) (Remote host closed the connection) |
| 22:27:02 | <ballast> | dsal: if i have to use a bazooka to swat a fly until i get lsp working then so it shall be |
| 22:27:24 | <dsal> | heh |
| 22:27:41 | <ballast> | a little surprised there isn't a simple syntactic extension along those lines though |
| 22:27:51 | <dsal> | gqplox[m]: this was mine from yesterday https://www.irccloud.com/pastebin/ijCxTrwy/day4.hs |
| 22:27:53 | <ballast> | suppose ghc's extensions are bloated enough as-is |
| 22:28:01 | <darkling> | gqplox[m]: Mine's here: https://github.com/darkling/AoC2022/blob/main/day04/Main.hs |
| 22:28:12 | <dsal> | I tend to use megaparsec for everything, though. |
| 22:28:17 | <EvanR> | ballast, seems like an odd combination of constraints to be using over and over |
| 22:28:31 | <ballast> | i just used an example |
| 22:28:49 | → | fizbin joins (~fizbin@user/fizbin) |
| 22:29:10 | → | TonyStone joins (~TonyStone@cpe-74-76-57-186.nycap.res.rr.com) |
| 22:29:13 | <EvanR> | you can also define a class with all those classes as prereqs |
| 22:29:28 | <dsal> | The one time I used ConstraintKinds, it was for a specific part of an application that I had to plumb through about 13 times: type PublishConstraint m = (MonadLogger m, MonadFail m, MonadMask m, MonadUnliftIO m, MonadIO m) |
| 22:29:49 | <mauke> | gqplox[m]: http://sprunge.us/M0TVci |
| 22:29:58 | <dsal> | Having MonadUnliftIO and MonadIO looks pretty dumb. |
| 22:30:10 | × | chomwitt quits (~chomwitt@2a02:587:7a0c:6a00:1ac0:4dff:fedb:a3f1) (Ping timeout: 265 seconds) |
| 22:30:37 | <mauke> | gqplox[m]: and http://sprunge.us/jUHW9Q for part 2 |
| 22:31:30 | <EvanR> | just use the constraint EveryClassEver m => |
| 22:31:46 | × | michalz quits (~michalz@185.246.204.90) (Remote host closed the connection) |
| 22:31:48 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 248 seconds) |
| 22:32:06 | <ballast> | is there a monad other than Identity satisfying (Monad* m) => m a -> ... |
| 22:32:16 | <gqplox[m]> | ah nice thanks for sharing guys |
| 22:33:06 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 268 seconds) |
| 22:34:12 | <mauke> | gqplox[m]: length . filter id . map f is a weird way to write length . filter f |
| 22:36:04 | × | sammelweis quits (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) (Quit: No Ping reply in 180 seconds.) |
| 22:36:12 | → | sammelweis joins (~quassel@2601:401:8200:2d4c:bd9:d04c:7f69:eb10) |
| 22:36:50 | × | Kaipei quits (~Kaiepi@108.175.84.104) (Ping timeout: 260 seconds) |
| 22:36:50 | <dsal> | (`countIf f` is `length . filter f` -- I just gave it a name because I used it a lot) |
| 22:37:20 | × | fizbin quits (~fizbin@user/fizbin) (Remote host closed the connection) |
| 22:37:38 | → | fizbin joins (~fizbin@user/fizbin) |
| 22:37:52 | <dsal> | @pl solve f x = (length . filter id) $ map (uncurry f . parse) x |
| 22:37:52 | <lambdabot> | solve = ((length . filter id) .) . map . (. parse) . uncurry |
| 22:37:58 | <dsal> | grosss |
| 22:38:13 | <dsal> | Oh, a single eta reduction is fine there |
| 22:38:25 | → | zant joins (~zant@62.214.20.26) |
| 22:38:32 | <EvanR> | a soup of ), (, and . |
| 22:38:54 | <EvanR> | with combinators thrown in for taste |
| 22:40:50 | × | mikoto-chan quits (~mikoto-ch@2001:999:680:9f4:6a82:d55c:feff:5f4) (Ping timeout: 246 seconds) |
| 22:42:45 | × | shriekingnoise quits (~shrieking@186.137.167.202) (Quit: Quit) |
| 22:44:34 | → | money_ joins (~money@user/polo) |
| 22:45:09 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 22:45:30 | × | titibandit quits (~titibandi@xdsl-78-35-173-119.nc.de) (Quit: Leaving.) |
| 22:47:04 | × | bobbingbob quits (~dfadsva@2604:3d09:207f:f650::7b3a) (Ping timeout: 256 seconds) |
| 22:47:16 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 22:48:01 | × | mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
| 22:48:18 | → | shriekingnoise joins (~shrieking@186.137.167.202) |
| 22:50:51 | × | money_ quits (~money@user/polo) (Ping timeout: 256 seconds) |
| 22:51:09 | × | shriekingnoise quits (~shrieking@186.137.167.202) (Client Quit) |
| 22:51:16 | × | fizbin quits (~fizbin@user/fizbin) (Read error: Connection reset by peer) |
| 22:51:52 | <gqplox[m]> | oh |
| 22:51:56 | <gqplox[m]> | res f x = length $ filter (uncurry f) (map parse x) |
| 22:52:03 | <gqplox[m]> | this right? |
| 22:52:47 | <dsal> | it'll fuse, but you don't need to explicitly run three passes. |
| 22:53:01 | <dsal> | something like: res f = length . filter (uncurry f . parse) |
| 22:54:26 | <gqplox[m]> | ohhhh |
| 22:54:32 | <gqplox[m]> | i get it |
| 22:54:32 | <gqplox[m]> | thank you |
| 22:55:30 | × | jmdaemon quits (~jmdaemon@user/jmdaemon) (Quit: ZNC 1.8.2 - https://znc.in) |
| 22:55:49 | <dsal> | I like that `length . filter f` abstraction, but you could also do it with a single foldMap if you construct a `String -> Sum Int` |
| 22:56:50 | <gqplox[m]> | hmm ill look into that |
| 22:57:36 | <dsal> | > foldMap (bool 0 1 . even) [1..11] :: Sum Int |
| 22:57:37 | <lambdabot> | Sum {getSum = 5} |
| 22:57:57 | <dsal> | Not exactly a recommendation, but I like monoids. |
| 22:58:18 | <dsal> | I think people pretty universally hate `bool` as a function. Not enough people hate Bool as a concept. |
| 22:58:19 | <gqplox[m]> | ok seems like this might require some reading |
| 22:58:42 | <dsal> | > Sum 1 <> Sum 2 |
| 22:58:43 | <lambdabot> | Sum {getSum = 3} |
| 22:58:57 | <dsal> | > fold [1, 2, 3] :: Sum Int |
| 22:58:59 | <lambdabot> | Sum {getSum = 6} |
| 22:59:02 | <dsal> | > fold [1, 2, 3] :: Product Int |
| 22:59:03 | <lambdabot> | Product {getProduct = 6} |
| 22:59:06 | <dsal> | haha |
| 22:59:30 | <dsal> | > (fold [1..10], fold [1..10]) :: (Sum Int, Product Int) |
| 22:59:32 | <lambdabot> | error: |
| 22:59:32 | <lambdabot> | • No instance for (Enum (Sum Int)) |
| 22:59:32 | <lambdabot> | arising from the arithmetic sequence ‘1 .. 10’ |
| 22:59:53 | <dsal> | Interesting |
| 23:00:07 | <dsal> | > (foldMap Sum [1..10], foldMap Product [1..10]) |
| 23:00:09 | <lambdabot> | (Sum {getSum = 55},Product {getProduct = 3628800}) |
| 23:01:01 | <gqplox[m]> | idk why but if feels a bit strange the res function |
| 23:01:02 | <dsal> | The implementation of `sum` is `sum = getSum #. foldMap' Sum` |
| 23:01:10 | <gqplox[m]> | like it has two inputs but its written as res f |
| 23:01:17 | → | freeside joins (~mengwong@103.252.202.193) |
| 23:01:27 | <dsal> | Every function has one input and one result. |
| 23:01:28 | <gqplox[m]> | feels fine when simplifying from 1 input to 0 but this looks weird haha |
| 23:01:37 | <gqplox[m]> | yeah I know |
| 23:01:50 | <gqplox[m]> | it just threw me off a bit |
| 23:02:21 | <gqplox[m]> | anyway i have to go early today so cya, thanks for the help simplify my solution |
| 23:02:36 | × | coot quits (~coot@213.134.171.3) (Quit: coot) |
| 23:02:38 | <dsal> | I'm trying to make it more complex… |
| 23:02:39 | × | oldsk00l quits (~znc@ec2-3-125-42-182.eu-central-1.compute.amazonaws.com) (Remote host closed the connection) |
| 23:03:04 | dsal | isn't usually serious |
| 23:03:10 | <gqplox[m]> | so much stuff to do, might not be able to do advent of code this week :( |
| 23:03:17 | → | shriekingnoise joins (~shrieking@186.137.167.202) |
| 23:03:19 | × | fockerize quits (~finn@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 260 seconds) |
| 23:03:19 | × | zant quits (~zant@62.214.20.26) (Ping timeout: 268 seconds) |
| 23:03:22 | <dsal> | But monoids… They're pretty great. |
| 23:03:34 | <dsal> | Yeah, I didn't have a job last year during aoc |
| 23:03:42 | <dsal> | Was so much easier. |
| 23:04:23 | <gqplox[m]> | i want to find time to go through all the cool haskell stuff too |
| 23:04:26 | <gqplox[m]> | like that paper you linked |
| 23:04:55 | <dsal> | @hackage recursion-schemes |
| 23:04:55 | <lambdabot> | https://hackage.haskell.org/package/recursion-schemes |
| 23:04:59 | × | wootehfoot quits (~wootehfoo@user/wootehfoot) (Ping timeout: 264 seconds) |
| 23:05:00 | <dsal> | ^ implementation of that paper |
| 23:05:56 | × | freeside quits (~mengwong@103.252.202.193) (Ping timeout: 255 seconds) |
| 23:07:35 | → | huskle joins (~huskle@250.79-105-213.static.virginmediabusiness.co.uk) |
| 23:07:41 | <huskle> | HI! |
| 23:08:35 | <huskle> | i have downloaded ghcup |
| 23:08:56 | <huskle> | i want to use the option for getting it to install a specific version of ghc/ghci |
| 23:09:04 | <huskle> | which version do i choose!? |
| 23:09:13 | <huskle> | what features do the newer versions have? |
| 23:09:24 | <dsal> | Same as the previous ones but more. |
| 23:09:34 | <dsal> | Is there a particular feature you're looking for? |
| 23:10:03 | <huskle> | well im not sure, wasnt it something like odd numbers are "experimental" or something? |
| 23:10:17 | <geekosaur> | development versions |
| 23:10:34 | <geekosaur> | ghcup usually doesnt have those, you'd build ghc HEAD from gitlab for them |
| 23:11:11 | <huskle> | so if you google ghc, it has a shortcut to 9.2.4, but right at the top of the main page its 9.2.5 |
| 23:11:34 | <huskle> | geekosaur: ahh, thats basically exactly the information i needed, thanks |
| 23:11:45 | <huskle> | but im still interested as to what all these new versions have |
| 23:11:48 | <monochrom> | 2 is an even number. |
| 23:11:49 | <geekosaur> | the odd versioning is in the second component |
| 23:11:54 | <huskle> | i think last i had was some 8.something version |
| 23:12:05 | <geekosaur> | so 9.3 is a devel version, but 9.2.5 is the latest point release |
| 23:12:19 | <huskle> | ooh, i thought the .5 was odd |
| 23:12:36 | <geekosaur> | as yet hls doesn't support it so it may not be recommended yet? |
| 23:12:41 | <monochrom> | Although, in reality, the latest even number is also experimental. |
| 23:12:50 | <huskle> | so i can get that on ghcup? ill try and see, one sec |
| 23:12:53 | <dsal> | This is all a series of experiments. |
| 23:13:23 | <huskle> | ah! says its already installed that version |
| 23:13:46 | <huskle> | okok, so what about new features of these recent releases |
| 23:13:59 | <monochrom> | Hrm, experiments are concurrent, you can't serialize it. :) |
| 23:14:03 | <geekosaur> | point releases are bugfixes. |
| 23:14:06 | <monochrom> | err, s/it/them/ |
| 23:14:07 | <huskle> | basically i havnt heard much since linear types |
| 23:14:16 | × | jonathanx quits (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
| 23:14:33 | → | jonathanx joins (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
| 23:14:40 | <huskle> | nothing exciting like that? |
| 23:15:34 | <geekosaur> | not really. 9.2's big thing was native M1 support. 9.4 was mostly bugfixes. 9.6 should have wasm and js backends, but they haven't cut a release branch yet |
| 23:16:16 | <huskle> | wtf is web assembly!? sounds mad |
| 23:16:32 | × | kadobanana quits (~mud@user/kadoban) (Ping timeout: 256 seconds) |
| 23:16:43 | <huskle> | m1 is a mac thing by the sounds of it |
| 23:16:49 | <geekosaur> | oh, 9.2 also added LANGUAGE GHC2021 which defaults a number of extensions "on", since standardization is pretty much stuck |
| 23:17:00 | <huskle> | yes! finally |
| 23:17:06 | <dsal> | m1 is aarch64. I also build stuff native for my raspberry pi |
| 23:17:09 | <huskle> | do i specify that in the cabal file |
| 23:17:16 | <geekosaur> | yes, Apple came up with its own odd calling conventions for AArch64 MacOS |
| 23:17:41 | <dsal> | Oh. So it's similar, but different from my linux box? |
| 23:17:47 | <dsal> | I'm pretty high level these days. |
| 23:17:49 | <geekosaur> | it required some internal redesign that should mostly be invisible to the user |
| 23:17:54 | × | ballast quits (~ballast@rrcs-24-43-123-92.west.biz.rr.com) (Quit: Client closed) |
| 23:18:00 | <huskle> | oh wait what, its just arm64 - what did we have before!? |
| 23:18:21 | <huskle> | ok, thats actually pretty important then, well, glad to hear that, but i have an intel chip, so... |
| 23:18:25 | <monochrom> | raspberry pi and most ARMs are probably called arm64 |
| 23:19:18 | <dsal> | ARM macs are a *huge* upgrade. ARM other things are… fine. I've been running Haskell code on arm32 and arm64 for years. It sometimes involved compiling compilers under qemu or something. |
| 23:19:27 | <huskle> | i was hoping for "the next TypeApplications" or something that would actually change how i write code |
| 23:19:39 | <huskle> | wasnt there anything to do with levity polymorphism or something? |
| 23:19:40 | → | kadobanana joins (~mud@user/kadoban) |
| 23:19:53 | → | zant joins (~zant@62.214.20.26) |
| 23:20:11 | <geekosaur> | levity polymorphism is I think 9.0 or 9.2, but means less than you think because there are still levity restrictions in other places |
| 23:20:11 | <huskle> | dsal: less crosscomplilation for you then! decent |
| 23:20:32 | → | freeside joins (~mengwong@103.252.202.193) |
| 23:20:39 | <huskle> | its been ages since i can even remember what i was doing at all these levities |
| 23:20:46 | <geekosaur> | hm, I don't recall if `forall a ->` is 9.4 or 9.6 |
| 23:20:55 | <huskle> | that might be new |
| 23:21:00 | <huskle> | (to me) |
| 23:21:04 | <dsal> | geekosaur: what's that? |
| 23:21:39 | <huskle> | some explicit quantification thingamagig |
| 23:22:06 | <geekosaur> | \cases went in in 9.4 |
| 23:22:15 | <huskle> | ski kept on about "exists" a while back, not sure if they were getting at something in particular |
| 23:22:21 | <dsal> | We started using OverloadedRecordDot at work and I appreciate the benefits but really don't like it. |
| 23:22:30 | <geekosaur> | types that can be passed as parameters, which is one of the leadups to Dependent Haskell |
| 23:22:49 | <huskle> | something about impredictive types i guess is the breakthrough we are all waiting for |
| 23:22:56 | <geekosaur> | that was in 9.0 |
| 23:23:18 | → | Guest20 joins (~Guest20@2001:999:488:5cc:3116:f149:10de:6194) |
| 23:23:19 | <geekosaur> | they're not as big a change as you might think either, unless you regularly mess with rank-n types |
| 23:23:19 | <dsal> | Heh. s/through// |
| 23:23:20 | <huskle> | dsal: makes it like jave or something! |
| 23:23:24 | <huskle> | java* |
| 23:23:30 | <Guest20> | @pl map (groupBy ((==) `on` isNumber ) ) |
| 23:23:30 | <lambdabot> | map (groupBy ((==) `on` isNumber)) |
| 23:23:39 | <huskle> | like object component dereferenching |
| 23:24:16 | <dsal> | You can do a little bit of magic with it, but mostly it's just a small part of lens that makes syntax behave strangely. |
| 23:24:16 | <huskle> | "types that can be passed as parameters", what it is? |
| 23:24:22 | <geekosaur> | okay, the new forall usage didn't make 9.4 so maybe it's in 9.6 |
| 23:24:31 | <dsal> | geekosaur: what's the new forall thing? |
| 23:24:50 | <geekosaur> | [04 23:22:30] <geekosaur> types that can be passed as parameters, which is one of the leadups to Dependent Haskell |
| 23:24:53 | <dsal> | ooh |
| 23:25:14 | <geekosaur> | you could say it's visible visible type application 🙂 |
| 23:25:51 | <huskle> | so like if i had Functor f => f a, it would "capture" `a' or something, and allow type inference to weild it somehow? |
| 23:26:04 | × | Tuplanolla quits (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) (Quit: Leaving.) |
| 23:26:05 | <huskle> | or am i completely missing the point? |
| 23:26:37 | <huskle> | thats just how i think i would understand "typees that can be passed *as* parameters" |
| 23:27:17 | <huskle> | maybe if i understood how it was part of "dependant" types, which i never understood |
| 23:27:18 | <geekosaur> | instead of writing `foo @Int` you could write `foo Int` for something using the new syntax |
| 23:27:43 | <geekosaur> | unfortunately my own understanding ends there; dependent types are mostly over my head still |
| 23:27:53 | <huskle> | ahhh.. ok so types appearing at value level |
| 23:28:04 | <huskle> | yeah, i guess thats how the levity collapse would end up |
| 23:28:18 | <huskle> | but that kind of messes with our "types have capitals" thing |
| 23:28:27 | <huskle> | i guess thats why thats not a feature of idris, iirc |
| 23:29:00 | <huskle> | id rather use the @ symbol tbh |
| 23:29:13 | <huskle> | but then idk what id do if i was wanting to write the same expression at type level! |
| 23:29:33 | <huskle> | "KindApplications" ? |
| 23:29:40 | <geekosaur> | types don't have capitals. type constructors have capitals, just as data constructors do. `a` can be either a type variable or a value variable depending on context |
| 23:29:49 | <huskle> | oh right yeah, sorry |
| 23:29:58 | <geekosaur> | that kinda went away with TypeInType |
| 23:30:17 | <huskle> | wait, whats a type constructor? |
| 23:30:30 | <huskle> | i thought we only had data constructors and all type statements were synonyms |
| 23:31:00 | <geekosaur> | `Int` (fully saturated), `Maybe` (kind `Type -> Type`, requires a type parameter), etc. |
| 23:31:30 | <huskle> | func :: forall a f. Functor f => f a -> f a; func = id "a |
| 23:31:44 | <geekosaur> | `data Foo a = Bar | Baz a` defines a type constructor `Foo` and data/value constructors `Bar` and `Baz` |
| 23:31:47 | <huskle> | func :: forall a f. Functor f => f a -> f a; func = id @a |
| 23:32:22 | <huskle> | (stupid linux keyboard swaps the at and quotemark round) |
| 23:33:08 | <huskle> | (but at least i finally got rid of that asus bloatware - a windows update made it so you couldnt kill it in taskmanager, and it took so much ram as taskmanager wouldnt even open, even if nothing else was running!) |
| 23:33:31 | <huskle> | (at some point i might ask how to set up emacs with haskell) |
| 23:34:04 | <huskle> | geekosaur: ok, i understand this termanology |
| 23:34:54 | <huskle> | anyway, id be supprised to see an un "type applicationed" type constructor at value level |
| 23:35:18 | <huskle> | foo Int |
| 23:35:29 | <huskle> | is there really an argument for this? |
| 23:35:58 | <huskle> | a fucntion taking as an argument, something like a proxy? |
| 23:36:12 | <huskle> | foo :: Proxy Int -> ... |
| 23:37:28 | <geekosaur> | I think at least at first it would let you specify where in an argument list you want the type, which at the moment is somewhat out of your control with VTA |
| 23:37:33 | <huskle> | normally it would be like foo :: forall a. SomeTypeSignature a, and you would use type applications |
| 23:38:26 | <huskle> | geekosaur: only if you let it do the forall implicity, and then its just order of appearence normally, but gets complicated if it has to infer those from other types |
| 23:38:26 | → | bgs joins (~bgs@212-85-160-171.dynamic.telemach.net) |
| 23:38:27 | <geekosaur> | `mumble Int a Foo` instead of `mumble @Int @Foo` and hoping you got the order right or having to use `forall {a} {b}` or whatever to pin it |
| 23:39:30 | <huskle> | i mean, its good practice to write the foralls yourself and keep track of what order the arguments are in, just like how you would have to keep track of the order the functions arguments appear |
| 23:39:49 | <huskle> | i cant see why you would want to mix up these kind of proxies into the actual arguments in the type signature |
| 23:40:48 | <geekosaur> | I can't really either, since I mostly avoid that level of type hackery anyway. eisenberg has some reason for them but I have little hope of understanding it 🙂 |
| 23:40:50 | <huskle> | foo :: forall a. Proxy a -> SomeTypeSignature a |
| 23:41:02 | <huskle> | i never use proxies like this |
| 23:41:41 | <huskle> | but then, i think im occasionally causght out where you would *have* too, but i cant figure out if thats just me getting bugridden |
| 23:42:26 | <huskle> | you shouldnt ever *have* too right? or is there some example of some place where the weakness of inference causes a bug where the user specify the proxy directly fixes the bug |
| 23:42:40 | <huskle> | (im kind of sure iv come accross such a situation, but i cant actually be sure..) |
| 23:43:21 | <huskle> | (i think it was when trying to write a simple kind of type level compiler - dont ask, i near went spare) |
| 23:44:07 | <huskle> | yeah, so actually, either, figuring out exactly where the typechecker struggles with inference and fixing that, with at least better indications to the user as to how to guide the typechecker with annotations |
| 23:44:14 | <huskle> | sorry i cant be more exact |
| 23:44:39 | <huskle> | because at the moment its just like "nope - denied" |
| 23:45:15 | <huskle> | and its very difficult to approach it with a coding methodology which allows this to be avoided |
| 23:45:50 | <huskle> | anywaay, i should get back to whatever it is i was doing... |
| 23:45:53 | geekosaur | is really the wrong one to be asking about this… |
| 23:46:06 | <geekosaur> | *to ask |
| 23:46:53 | <huskle> | whatever, maybe somehow the strange failings will guide the comunity like a lighthouse from jagged coral |
| 23:47:39 | <huskle> | type level graphs of function programs... not yet. basically |
| 23:48:20 | <huskle> | like, a dot list (list of functions to be dotted together) can be given hetrogenous style constructors |
| 23:48:32 | × | bjourne2 quits (~bjorn@94.191.136.212.mobile.tre.se) (Read error: Connection reset by peer) |
| 23:48:33 | <huskle> | but when you start trying to elaborate on that your head could explode. |
| 23:50:25 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:dc47:5d05:725b:66f2) (Remote host closed the connection) |
| 23:50:41 | × | kadobanana quits (~mud@user/kadoban) (Remote host closed the connection) |
| 23:51:06 | → | kadobanana joins (~mud@user/kadoban) |
| 23:51:37 | → | Guest|43 joins (~Guest|43@c-73-182-192-142.hsd1.ma.comcast.net) |
| 23:52:14 | <Guest|43> | Hi I'm facing an issue in downloading haskell on my mac |
| 23:53:26 | <huskle> | last type i got the compiler to return to me was this; https://paste.tomsmeding.com/uGyb8Z0d |
| 23:54:12 | <huskle> | :'-( |
| 23:54:16 | × | Guest20 quits (~Guest20@2001:999:488:5cc:3116:f149:10de:6194) (Quit: Client closed) |
| 23:54:46 | <huskle> | i didnt think it could actually blow up the world, i thought that was just some joke edkmett would make |
| 23:56:06 | <huskle> | im afraid i may have spoiled the ol' "if it compiles ship it" addage |
| 23:56:42 | <huskle> | Guest|43 : go on! whats the issue? |
| 23:57:50 | × | acidjnk quits (~acidjnk@p200300d6e7137a4188c21b5678eecc17.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
| 23:58:28 | × | huskle quits (~huskle@250.79-105-213.static.virginmediabusiness.co.uk) (Quit: Connection closed) |
| 23:58:42 | × | iqubic quits (~avi@2601:601:1100:edd0:7a35:ede8:5354:af72) (Read error: Connection reset by peer) |
All times are in UTC on 2022-12-04.