Logs on 2023-12-03 (liberachat/#haskell)
| 00:20:24 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 00:22:09 | × | Eoco quits (~ian@128.101.131.218) (Quit: WeeChat 4.1.1) |
| 00:23:01 | → | Eoco joins (~ian@128.101.131.218) |
| 00:24:56 | × | Eoco quits (~ian@128.101.131.218) (Client Quit) |
| 00:25:16 | → | Eoco joins (~ian@128.101.131.218) |
| 00:25:57 | × | Eoco quits (~ian@128.101.131.218) (Client Quit) |
| 00:26:25 | → | Eoco joins (~ian@128.101.131.218) |
| 00:27:09 | → | mobivme joins (~mobivme@112.201.111.217) |
| 00:50:11 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 260 seconds) |
| 00:51:00 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 00:55:12 | × | idgaen quits (~idgaen@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) (Quit: WeeChat 4.1.1) |
| 01:03:41 | → | mobivme joins (~mobivme@112.201.111.217) |
| 01:07:28 | → | notzmv joins (~zmv@user/notzmv) |
| 01:07:43 | × | mobivme quits (~mobivme@112.201.111.217) (Remote host closed the connection) |
| 01:09:40 | × | oo_miguel quits (~Thunderbi@78-11-179-96.static.ip.netia.com.pl) (Ping timeout: 255 seconds) |
| 01:10:00 | × | mrmr15533 quits (~mrmr@user/mrmr) (Quit: Bye, See ya later!) |
| 01:10:37 | → | mobivme joins (~mobivme@112.201.111.217) |
| 01:19:41 | → | zetef joins (~quassel@2a02:2f00:5201:4b00:7fc8:6fbe:33d9:ba2a) |
| 01:21:58 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 268 seconds) |
| 01:24:15 | × | zetef quits (~quassel@2a02:2f00:5201:4b00:7fc8:6fbe:33d9:ba2a) (Remote host closed the connection) |
| 01:24:26 | → | mobivme joins (~mobivme@112.201.111.217) |
| 01:25:06 | × | Lycurgus quits (~georg@user/Lycurgus) (Quit: leaving) |
| 01:25:40 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 01:25:40 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 01:25:40 | → | wroathe joins (~wroathe@user/wroathe) |
| 01:27:02 | <wroathe> | Hey guys, does withBinaryFile and h{Get/Set}Buf ignore the handles buffering mode? I've got this bit of code here that seems to work, but when I look at the system calls being made with strace it only writes 8192 bytes at a time: https://gist.github.com/JustinChristensen/5e20f9ed6f5e73738be736e4efe5a162 |
| 01:30:51 | <wroathe> | h{Get/Put}Buf, I mean |
| 01:32:21 | × | tremon quits (~tremon@83.80.159.219) (Quit: getting boxed in) |
| 01:33:04 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 255 seconds) |
| 01:40:12 | × | remexre quits (~remexre@user/remexre) (Remote host closed the connection) |
| 01:44:18 | → | remexre joins (~remexre@user/remexre) |
| 01:47:28 | × | benjaminl quits (~benjaminl@user/benjaminl) (Remote host closed the connection) |
| 01:47:59 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 01:48:27 | → | benjaminl joins (~benjaminl@user/benjaminl) |
| 01:48:52 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 01:49:58 | → | evil_ joins (~evil@5.151.177.139) |
| 01:52:19 | <evil_> | Hi, I am trying to do some math operatio on integers and struggling converting between Fraction and Integer. Code for Refrence: https://paste.tomsmeding.com/PC5fbRyj |
| 01:52:26 | <evil_> | mainly getCal function |
| 01:52:35 | × | remexre quits (~remexre@user/remexre) (Remote host closed the connection) |
| 01:52:38 | evil_ | is now known as hasevil |
| 01:52:43 | → | remexre joins (~remexre@user/remexre) |
| 01:52:48 | → | mobivme joins (~mobivme@112.201.111.217) |
| 01:57:14 | → | mobounce joins (~mobivme@112.201.111.217) |
| 01:58:26 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 260 seconds) |
| 02:00:04 | × | sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 255 seconds) |
| 02:02:46 | × | mobounce quits (~mobivme@112.201.111.217) (Ping timeout: 255 seconds) |
| 02:03:41 | × | pretty_dumm_guy quits (~trottel@2a02:810b:43bf:aba0:436e:e1e6:f8d4:a6aa) (Quit: WeeChat 3.5) |
| 02:03:44 | <geekosaur> | `/` is not defined for Integer. `div` is, or you can use `fromInteger` |
| 02:04:03 | <geekosaur> | the same issue will bite you on line 5 |
| 02:04:28 | <geekosaur> | > 5 `div` 2 |
| 02:04:30 | <lambdabot> | 2 |
| 02:05:16 | <geekosaur> | > 5 / 2 -- "5" here is a `Double`, because numeric literals are in effect wrapped in `fromInteger` or `fromRational` |
| 02:05:17 | <lambdabot> | 2.5 |
| 02:06:42 | <geekosaur> | > 5 `divMod` 2 |
| 02:06:43 | <lambdabot> | (2,1) |
| 02:09:46 | <hasevil> | geekosaur: k, I still don't get why it wouldn't type cast that |
| 02:10:09 | <geekosaur> | there is no automatic "casting" in Haskell, aside from the special handling of literals |
| 02:12:41 | → | mobivme joins (~mobivme@112.201.111.217) |
| 02:13:17 | × | chomwitt quits (~chomwitt@2a02:587:7a09:c300:1ac0:4dff:fedb:a3f1) (Ping timeout: 240 seconds) |
| 02:13:23 | <geekosaur> | @quote monochrom fromIntegral |
| 02:13:23 | <lambdabot> | monochrom says: You've got an Int / But you want Double / Who do you call? / "fromIntegral!" |
| 02:13:56 | <hasevil> | wait, isn't it oposite in my case |
| 02:14:35 | <geekosaur> | no, you're doing `x / 10` where `x` is an `Integer` but you need an instance of `Fractional` for `/` to work |
| 02:14:58 | <hasevil> | k, but can I type cast it back to int by dooing `:: Int` |
| 02:15:00 | <hasevil> | ? |
| 02:15:03 | <geekosaur> | no |
| 02:15:25 | <hasevil> | so I have to use fromInteger |
| 02:15:26 | <geekosaur> | use one of `floor` or `ceiling` |
| 02:15:44 | <wroathe> | So I've had a look at Base, and unless I'm misreading it seems that hSetBuffering only works for get/PutChar, and it doesn't actually change the Handle's buffer size at all |
| 02:15:45 | <geekosaur> | `:: Int` says "I know this is an `Int`", not "make this an `Int`: |
| 02:15:54 | <wroathe> | Which... if that's true... just wow |
| 02:16:01 | × | shapr quits (~user@2600:1700:c640:3100:bb5e:f749:fac6:1840) (Remote host closed the connection) |
| 02:16:07 | <geekosaur> | the compiler will complain if you say `:: Int` and it's a `Double` |
| 02:16:15 | → | shapr joins (~user@2600:1700:c640:3100:6b1f:4416:e400:c56a) |
| 02:16:57 | → | mobounce joins (~mobivme@112.201.111.217) |
| 02:17:27 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 252 seconds) |
| 02:18:51 | <hasevil> | geekosaur: ok, got it |
| 02:19:25 | <hasevil> | thx, I misunderstood what `:: Int` does. |
| 02:22:00 | <geekosaur> | you can create new types in Haskell, including new numeric types. How would the compiler know how to extend `::` to include them? Whereas with a conversion function you just write a new one. There are also typeclasses (which is what the `Fractional` thing is about), but there you provide the function in the typeclass instance |
| 02:22:38 | <geekosaur> | don't worry about typeclasses for now, though |
| 02:22:48 | <hasevil> | what it means by `Couldn't match expected type 'Int' with actual type 'a0 -> a0'` |
| 02:23:05 | × | Unicorn_Princess quits (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection) |
| 02:23:14 | <hasevil> | geekosaur: ok, so :: itself is a predefined function |
| 02:23:20 | <geekosaur> | you're missing a parameter somewhere |
| 02:23:43 | <geekosaur> | it's syntax, not a function. which is why it's not really extendable that way |
| 02:23:47 | <hasevil> | `getCal num = (\x -> (x `mod` 10) * 10 ) + getLastDigit num |
| 02:23:47 | <hasevil> | ` |
| 02:23:51 | <hasevil> | I/m dooing this |
| 02:23:53 | <geekosaur> | so we use things that can be extended, like typeclasses |
| 02:24:21 | <hasevil> | k, got it. I think I'm too used to other langage dooing this for me |
| 02:25:18 | <geekosaur> | okay, your problem there is that you have defined an anonymous function and are trying to use it as a number |
| 02:25:24 | × | mobounce quits (~mobivme@112.201.111.217) (Remote host closed the connection) |
| 02:25:36 | <hasevil> | my understanding of above lamda is. (x is a Int) mod by 10. which returns an Integal then multipy by 10 |
| 02:25:52 | <geekosaur> | right, but you don't apply it to anything |
| 02:26:06 | <geekosaur> | so it's trying to use the lambda itself as a number |
| 02:26:13 | <hasevil> | ? sorry, I'm lost define applying |
| 02:26:28 | <hasevil> | k, so problem is `+` |
| 02:26:31 | <geekosaur> | :t \x -> (x `mod` 10) * 10 |
| 02:26:32 | <lambdabot> | Integral a => a -> a |
| 02:26:42 | × | Tuplanolla quits (~Tuplanoll@91-159-68-236.elisa-laajakaista.fi) (Quit: Leaving.) |
| 02:26:46 | <monochrom> | How about: Do you intend that line of code to mean? |
| 02:26:52 | <geekosaur> | so now you have to supply a value for x |
| 02:27:02 | <monochrom> | Err, What do you ... |
| 02:27:13 | <hasevil> | monochrom: modx then multiply result with 10 |
| 02:27:27 | <monochrom> | And x is defined where? |
| 02:27:28 | <geekosaur> | but what is x supposed to be? |
| 02:27:32 | <hasevil> | num |
| 02:27:43 | <hasevil> | k, i see the prblm |
| 02:27:47 | <hasevil> | i'm dumb |
| 02:28:05 | <monochrom> | OK, why is it not the much lower-tech (num `mod` 10) * 10 + getLastDigit num ? |
| 02:28:57 | <hasevil> | cause I'm trying to understand how lamda functions work |
| 02:29:28 | <geekosaur> | the best place to experiment with lambdas is probably `map` |
| 02:29:35 | <geekosaur> | > map (\ |
| 02:29:36 | <lambdabot> | <hint>:1:7: error: |
| 02:29:36 | <lambdabot> | parse error (possibly incorrect indentation or mismatched brackets) |
| 02:29:56 | <geekosaur> | > map (\x -> x + 1) [3,4,5] |
| 02:29:57 | <lambdabot> | [4,5,6] |
| 02:31:45 | <monochrom> | (\x -> (x `mod` 10) * 10 ) num + getLastDigit num |
| 02:33:59 | <hasevil> | monochrom: thx. |
| 02:35:14 | <geekosaur> | that is what I was trying to guide you toward when I asked what you were applying the lambda to |
| 02:35:37 | → | mobivme joins (~mobivme@112.201.111.217) |
| 02:37:47 | → | [_] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 02:38:15 | <hasevil> | geekosaur: yeah, I figured that |
| 02:41:50 | × | [itchTheBroken] quits (~itchyjunk@user/itchyjunk/x-7353470) (Ping timeout: 268 seconds) |
| 02:45:22 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 02:46:52 | <hasevil> | Int is an Integral? |
| 02:47:08 | <hasevil> | cause fromIntregal works but fromInteger errors out |
| 02:47:29 | <hasevil> | and looking at the defination's that make sense |
| 02:47:43 | <geekosaur> | yes. and Int and Integer are different things (Int is a machine word, Integer is a "bignum") |
| 02:47:55 | <geekosaur> | so fromInteger won't work on an Int |
| 02:48:10 | <geekosaur> | but fromIntegral will, because both Int and Integer have Integral instances |
| 02:48:27 | <hasevil> | geekosaur: k, that's intresting. yeah I got the last part |
| 02:48:57 | <hasevil> | but found it confusing. Reading up on it. Int doesn't have a maxBound right? |
| 02:49:08 | <geekosaur> | > maxBound :: Int |
| 02:49:10 | <lambdabot> | 9223372036854775807 |
| 02:49:19 | <geekosaur> | > maxBound :: Integer -- nope |
| 02:49:20 | <lambdabot> | error: |
| 02:49:20 | <lambdabot> | • No instance for (Bounded Integer) |
| 02:49:20 | <lambdabot> | arising from a use of ‘maxBound’ |
| 02:50:28 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 255 seconds) |
| 02:50:33 | <hasevil> | so Integer can extend to infinity and Int is a fraction? |
| 02:50:33 | × | adanwan quits (~adanwan@gateway/tor-sasl/adanwan) (Remote host closed the connection) |
| 02:50:49 | <geekosaur> | Integer can be as big as you have memory for |
| 02:51:26 | → | adanwan joins (~adanwan@gateway/tor-sasl/adanwan) |
| 02:51:48 | <hasevil> | ok, and to be clear Int and Int8 are differnt things |
| 02:52:04 | <geekosaur> | Int8 is an 8-bit value |
| 02:52:05 | <hasevil> | one is bounded while other is a float |
| 02:52:17 | <hasevil> | *bounded Integer |
| 02:52:19 | <geekosaur> | Int and Int64 are treated distinctly but have the same ranges |
| 02:52:37 | <geekosaur> | > maxBound :: Int8 |
| 02:52:39 | <lambdabot> | 127 |
| 02:52:45 | <hasevil> | can Int store decimals ".xxx" |
| 02:52:54 | <geekosaur> | no |
| 02:53:04 | <geekosaur> | you need FLoat or Double for that |
| 02:53:12 | <geekosaur> | er, Float |
| 02:56:47 | <hasevil> | so, how Int and Int64 trated differently. https://hackage.haskell.org/package/base-4.19.0.0/docs/Data-Int.html this says it's "fixed-precision" so I thought it's a fraction |
| 02:57:37 | <geekosaur> | fixed precision there means it has 64 bits, no more, no less |
| 02:57:50 | <geekosaur> | (one of which is the sign bit) |
| 02:58:09 | × | wroathe quits (~wroathe@user/wroathe) (Quit: leaving) |
| 02:58:56 | <geekosaur> | > (5 :: Int64) + (2 :: Int) |
| 02:58:56 | × | ph88 quits (~ph88@ip5b40e272.dynamic.kabel-deutschland.de) (Remote host closed the connection) |
| 02:58:58 | <lambdabot> | error: |
| 02:58:58 | <lambdabot> | • Couldn't match expected type ‘Int64’ with actual type ‘Int’ |
| 02:58:58 | <lambdabot> | • In the second argument of ‘(+)’, namely ‘(2 :: Int)’ |
| 02:59:11 | <geekosaur> | they're the same size but are distinct types |
| 02:59:29 | <geekosaur> | (Because on a 32 bit system Int is equivalent to Int32, not Int64) |
| 03:00:30 | <geekosaur> | if we just aliased Int to whichever size it is on the current machine, code would silently break on machines with a different word size, so if word size matters you should use the explicitly sized type |
| 03:08:16 | × | Eoco quits (~ian@128.101.131.218) (Quit: WeeChat 4.1.1) |
| 03:09:27 | → | Eoco joins (~ian@128.101.131.218) |
| 03:09:28 | × | Eoco quits (~ian@128.101.131.218) (Client Quit) |
| 03:17:10 | <hasevil> | geekosaur: got it. thanks for the help. |
| 03:18:08 | → | Eoco joins (~ian@128.101.131.218) |
| 03:19:10 | × | Eoco quits (~ian@128.101.131.218) (Client Quit) |
| 03:19:35 | → | Eoco joins (~ian@128.101.131.218) |
| 03:21:43 | × | Eoco quits (~ian@128.101.131.218) (Client Quit) |
| 03:22:10 | → | Eoco joins (~ian@128.101.131.218) |
| 03:23:58 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 256 seconds) |
| 03:28:46 | → | mobivme joins (~mobivme@112.201.111.217) |
| 03:29:38 | → | Xyloes joins (~wyx@2400:dd01:103a:1012:5923:33ce:7857:fc04) |
| 03:31:24 | <EvanR> | hasevil, the reason fromInteger doesn't work on Int can be explained by its type signature, which is a good way to answer a lot of things in haskell |
| 03:31:26 | <EvanR> | :t fromInteger |
| 03:31:27 | <lambdabot> | Num a => Integer -> a |
| 03:31:56 | <EvanR> | (takes Integer only) |
| 03:32:22 | <EvanR> | which luckily is consistent with the naming of the function |
| 03:33:47 | <EvanR> | (for counterexample of sensible naming, see the Real class... toRational :: Real a => a -> Rational ?? |
| 03:34:53 | <EvanR> | I guess pascal was still a thing when the standard classes were named |
| 03:41:36 | <hasevil> | thx EvanR, yeah I saw that. was just curious why Int wasn't in Integral |
| 03:41:48 | <EvanR> | it is |
| 03:42:10 | <hasevil> | yeah, |
| 03:42:10 | <EvanR> | > (10 :: Int) `div` 3 |
| 03:42:11 | <lambdabot> | 3 |
| 03:42:21 | <hasevil> | geek osaur helped me |
| 03:42:42 | <hasevil> | I was trying |
| 03:43:03 | <hasevil> | > floor ((10 :: Int) / 3)) |
| 03:43:05 | <lambdabot> | <hint>:1:24: error: parse error on input ‘)’ |
| 03:43:25 | <hasevil> | > floor ((10 :: Int) / 3) |
| 03:43:27 | <lambdabot> | error: |
| 03:43:27 | <lambdabot> | • Could not deduce (RealFrac Int) arising from a use of ‘floor’ |
| 03:43:27 | <lambdabot> | from the context: Integral b |
| 03:43:47 | <EvanR> | :t floor |
| 03:43:48 | <lambdabot> | (RealFrac a, Integral b) => a -> b |
| 03:44:02 | <hasevil> | :t (/) |
| 03:44:03 | <lambdabot> | Fractional a => a -> a -> a |
| 03:44:23 | <EvanR> | yeah you can't use / on an Int |
| 03:44:30 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija))) |
| 03:44:30 | → | finn_elija joins (~finn_elij@user/finn-elija/x-0085643) |
| 03:44:30 | finn_elija | is now known as FinnElija |
| 03:44:40 | <EvanR> | you have to promote it to a Fractional first |
| 03:44:42 | <hasevil> | anyway, new prob, In ghci I can't use tail withouth specifing `Prelude.tail` Is that common |
| 03:44:57 | <EvanR> | if you defined something else called tail yeah |
| 03:45:00 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 03:45:01 | <hasevil> | EvanR: yeah, did that all sorted now. but took me a minute |
| 03:45:05 | <hasevil> | I'm new to this |
| 03:45:18 | <hasevil> | EvanR: no, just using regular tail |
| 03:45:22 | <hasevil> | it won't let me |
| 03:45:45 | <EvanR> | > tail [1,2,3] -- works for me after starting a new ghci session |
| 03:45:46 | <lambdabot> | [2,3] |
| 03:46:00 | <hasevil> | gives ghci> tail [11, 2, 4] |
| 03:46:00 | <hasevil> | <interactive>:27:1: error: [GHC-87543] |
| 03:46:00 | <hasevil> | Ambiguous occurrence |
| 03:46:34 | <hasevil> | maybe it's because I Imported bunch of things |
| 03:46:34 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 03:47:04 | <EvanR> | try :i tail |
| 03:47:30 | <hasevil> | nope, does this on new session too |
| 03:47:55 | <hasevil> | https://paste.tomsmeding.com/PGqNkIiD |
| 03:48:54 | <hasevil> | :i tail |
| 03:48:54 | <hasevil> | tail :: GHC.Stack.Types.HasCallStack => [a] -> [a] |
| 03:48:54 | <hasevil> | -- Defined in |
| 03:49:04 | <EvanR> | ok this isn't ambiguous occurrence anymore at least |
| 03:49:29 | <EvanR> | it's giving (unsolicited?) advice but working? |
| 03:49:37 | <hasevil> | now, it throws a warning |
| 03:49:50 | × | td_ quits (~td@i5387091D.versanet.de) (Ping timeout: 252 seconds) |
| 03:49:55 | <hasevil> | saying it's a partial function |
| 03:50:03 | <EvanR> | I'm not sure where -Wx-partial is coming frmo |
| 03:50:09 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 03:50:10 | <EvanR> | doesn't happen in my environment |
| 03:50:33 | <EvanR> | could be a configuration thing |
| 03:51:52 | → | td_ joins (~td@83.135.9.0) |
| 03:57:02 | <hasevil> | hmm, I haven't changed anything. whatever ghcup set me up with. |
| 03:58:12 | <EvanR> | I'm using ghci 9.6.3 |
| 03:58:27 | <EvanR> | could be a new "feature" |
| 04:00:46 | <hasevil> | yeah, I'm using 9.8.1 |
| 04:02:39 | × | Eoco quits (~ian@128.101.131.218) (Quit: WeeChat 4.1.1) |
| 04:02:46 | <hasevil> | btw, why I can't pattern match this. https://paste.tomsmeding.com/vgqaCfah |
| 04:03:15 | <EvanR> | > let (x:xs) = "hello" in (x, xs) |
| 04:03:15 | <hasevil> | I know It's not a sting but it's a list should be able to do `x:xs` |
| 04:03:16 | <lambdabot> | ('h',"ello") |
| 04:03:46 | <EvanR> | need parentheses around the pattern |
| 04:04:24 | <hasevil> | nope |
| 04:04:39 | <hasevil> | ern binding: (basePwd : day) = splitFileName pwd |
| 04:04:39 | <hasevil> | In the expression: |
| 04:04:39 | <hasevil> | do pwd <- getCurrentDirectory |
| 04:04:40 | <hasevil> | let (basePwd : day) = splitFileName pwd |
| 04:04:40 | <hasevil> | print (show day) |
| 04:04:40 | <hasevil> | | |
| 04:04:40 | <hasevil> | 9 | let (basePwd:day) = splitFileName pwd |
| 04:04:55 | <EvanR> | splitFilename doesn't seem to return a list |
| 04:05:08 | <EvanR> | so you should get a type error? |
| 04:05:38 | <hasevil> | ../file.hs:9:8: error: [GHC-83865] |
| 04:05:38 | <hasevil> | |
| 04:07:11 | × | waleee quits (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) (Ping timeout: 264 seconds) |
| 04:08:10 | <EvanR> | ghci> splitFileName "/home/evan/bin/doom" |
| 04:08:11 | <EvanR> | ("/home/evan/bin/","doom") |
| 04:09:46 | → | peterbecich joins (~Thunderbi@047-229-123-186.res.spectrum.com) |
| 04:09:48 | <EvanR> | splitFileName :: FilePath -> (String, String) -- use the types ! |
| 04:14:00 | × | _xor quits (~xor@72.49.195.41) (Quit: brb/bbiab) |
| 04:14:07 | × | jle` quits (~jle`@2603-8001-3b02-84d4-10d7-ccb2-03d8-4763.res6.spectrum.com) (Ping timeout: 260 seconds) |
| 04:15:06 | hasevil | facepalm |
| 04:15:09 | <hasevil> | it's a tupple |
| 04:24:30 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 252 seconds) |
| 04:26:06 | → | mobivme joins (~mobivme@112.201.111.217) |
| 04:36:47 | → | Eoco joins (~ian@128.101.131.218) |
| 04:42:00 | → | machinedgod joins (~machinedg@modemcable243.147-130-66.mc.videotron.ca) |
| 04:47:13 | → | aforemny joins (~aforemny@i59F516CC.versanet.de) |
| 04:47:40 | × | aforemny_ quits (~aforemny@2001:9e8:6cc6:6d00:7f41:9fb0:8b7b:8b35) (Ping timeout: 246 seconds) |
| 04:49:10 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 268 seconds) |
| 04:55:35 | → | travgm joins (~travgm@fsf/member/travgm) |
| 04:57:34 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 04:57:37 | × | johnw quits (~johnw@69.62.242.138) (Quit: ZNC - http://znc.in) |
| 04:58:05 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Client Quit) |
| 05:01:22 | × | machinedgod quits (~machinedg@modemcable243.147-130-66.mc.videotron.ca) (Ping timeout: 260 seconds) |
| 05:11:21 | <hasevil> | hey, so I'm trying to make a shell script in haskell using `runghc` in the shebang. and was wondering if there's a way to either do Network Request or call external shell programs. |
| 05:11:37 | <hasevil> | So like cmd "curl https://http.bin" |
| 05:12:19 | <hasevil> | cause afaik there is no way to import cabal modules into a shell script |
| 05:13:07 | × | ddellacosta quits (~ddellacos@ool-44c73d16.dyn.optonline.net) (Ping timeout: 255 seconds) |
| 05:15:07 | → | ddellacosta joins (~ddellacos@ool-44c73d16.dyn.optonline.net) |
| 05:25:58 | → | _xor joins (~xor@72.49.195.41) |
| 05:26:18 | × | travgm quits (~travgm@fsf/member/travgm) (Quit: Textual IRC Client: www.textualapp.com) |
| 05:31:38 | <glguy> | I liked today's problem |
| 05:32:08 | <EvanR> | always need a bad excuse to use comonads! |
| 05:32:44 | <glguy> | I need a pretty good reason to use something that's not in containers or base |
| 05:33:15 | → | trev joins (~trev@user/trev) |
| 05:33:18 | <EvanR> | I lost several minutes to building vector and vector-stream... |
| 05:34:48 | <int-e> | but why, you can index into lists just fine at this size |
| 05:35:01 | → | _xor3 joins (~xor@72.49.195.41) |
| 05:35:16 | <EvanR> | more like why do I not already have a Grid ready to copy and paste |
| 05:35:26 | <int-e> | the code I wrote for part 1 did not prepare me well for part 2 today |
| 05:35:37 | × | peterbecich quits (~Thunderbi@047-229-123-186.res.spectrum.com) (Ping timeout: 255 seconds) |
| 05:36:02 | <glguy> | I default to (Map Coord) for these kinds of problems |
| 05:37:01 | × | _xor quits (~xor@72.49.195.41) (Ping timeout: 276 seconds) |
| 05:37:01 | _xor3 | is now known as _xor |
| 05:38:51 | <xerox> | liked it as well |
| 05:42:31 | <glguy> | advent of list comprehensions for me |
| 05:43:03 | <glguy> | https://github.com/glguy/advent/blob/main/solutions/src/2023/03.hs |
| 05:44:36 | → | hays joins (rootvegeta@fsf/member/hays) |
| 05:47:23 | → | johnw joins (~johnw@69.62.242.138) |
| 05:49:41 | → | rosco joins (~rosco@175.136.158.171) |
| 05:52:14 | → | alp_ joins (~alp@2001:861:e3d6:8f80:6297:ed9b:7930:d8f) |
| 05:52:49 | <EvanR> | that's cool totally misread the question xD |
| 05:55:30 | × | iqubic quits (~avi@2601:602:9502:c70:cb59:8f8d:7da8:6547) (Ping timeout: 260 seconds) |
| 05:57:45 | <int-e> | glguy: Ah, of course today was the day where they do *not* explore corner cases like two parts sharing the same part number. Or parts on the boundary of the input. |
| 06:02:09 | <glguy> | Well, I was ready for borders but I didn't know what it could mean to have shared part numbers, so I crossed my fingers |
| 06:03:29 | <int-e> | well in schematics this easily happens... stuff like having 3 identical screws... |
| 06:03:52 | <EvanR> | 123 is clearly 3 part numbers next to each other |
| 06:04:00 | <EvanR> | 1, 2, and 3 |
| 06:04:11 | <int-e> | It's fine of course, just something that /might/ have saved me time if I hadn't worried about it. |
| 06:07:07 | → | dikiaap joins (~dikiaap@user/dikiaap) |
| 06:09:41 | <EvanR> | make sure you account for negative part numbers lol |
| 06:10:12 | <EvanR> | luckily there are no letters so you can't get complex part numbers |
| 06:10:42 | <int-e> | Or go back to the problem, s/gears/bars/g and denote bars by '-'. |
| 06:16:05 | → | travgm joins (~travgm@fsf/member/travgm) |
| 06:34:55 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 240 seconds) |
| 06:42:30 | × | hasevil quits (~evil@5.151.177.139) (Quit: nyaa~) |
| 06:45:45 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 06:46:39 | → | iqubic joins (~avi@2607:fb91:1515:5d1c:16ae:37fc:2df2:7707) |
| 06:47:40 | <ski> | > let x:xs = "hello" in (x,xs) -- "<EvanR> need parentheses around the pattern" -- nope (not with `case' either) |
| 06:47:42 | <lambdabot> | ('h',"ello") |
| 06:48:17 | <ski> | (something i'm commonly a bit annoyed at, when people insert those) |
| 06:48:31 | <iqubic> | Is it possible to take a [(a,b)] and create an indexed fold where the first of each pair is the index and the second is the value? |
| 06:48:47 | <int-e> | > let ((42)) = 23 in (()) |
| 06:48:48 | <lambdabot> | () |
| 06:48:55 | <ski> | "indexed fold" meaning ? |
| 06:48:56 | <iqubic> | Or is that not possible with the Lens library? |
| 06:49:50 | <int-e> | ski: a fold that also passes the index along with each list element, so similar to tucking "zip [0..]" onto the list before folding |
| 06:49:54 | <iqubic> | indexed fold meaning this, from the Lens Library: https://hackage.haskell.org/package/lens-5.2.3/docs/Control-Lens-Combinators.html#t:IndexedFold |
| 06:50:15 | <iqubic> | I'm trying to do fancy Lens things here. |
| 06:50:20 | <int-e> | unless Lens distorts that beyond recognition |
| 06:50:25 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 255 seconds) |
| 06:50:34 | <int-e> | as it does, of course. |
| 06:52:31 | <ski> | hm, i guess you could convert to `Map' or so ? |
| 06:54:06 | <int-e> | I see, p a (f a) is, more or less, i -> a -> f a. So you do get an index along with the element. |
| 06:54:15 | <iqubic> | You do. |
| 06:57:43 | <EvanR> | oops |
| 07:00:36 | <int-e> | :t indexed |
| 07:00:37 | <lambdabot> | Indexable i p => p a b -> i -> a -> b |
| 07:01:00 | × | alp_ quits (~alp@2001:861:e3d6:8f80:6297:ed9b:7930:d8f) (Ping timeout: 256 seconds) |
| 07:01:32 | <iqubic> | I figured it out. |
| 07:01:33 | <ski> | > Data.Map.fromList [(2,"hello"),(1,"world")] ^. ifolded |
| 07:01:35 | <lambdabot> | "worldhello" |
| 07:01:51 | <iqubic> | It's just (folded . ifolded) |
| 07:02:01 | <iqubic> | ski: I figured it out. |
| 07:02:01 | <iqubic> | It's just (folded . ifolded) |
| 07:02:09 | <ski> | which is ? |
| 07:02:28 | <ski> | > [(2,"hello"),(1,"world")] ^. folded . ifolded |
| 07:02:29 | <lambdabot> | "helloworld" |
| 07:02:30 | <ski> | mhm |
| 07:02:30 | <iqubic> | [(2,"hello"),(1,"world")] ^. folded . ifolded |
| 07:02:41 | <iqubic> | That is. |
| 07:02:43 | × | anderson quits (~anderson@user/anderson) (Quit: bye) |
| 07:03:54 | × | poscat quits (~poscat@user/poscat) (Quit: Bye) |
| 07:06:01 | <ski> | @type folded |
| 07:06:02 | <lambdabot> | (Indexable Int p, Contravariant f1, Foldable f2, Applicative f1) => p a (f1 a) -> f2 a -> f1 (f2 a) |
| 07:06:08 | <ski> | @type ifolded |
| 07:06:09 | <lambdabot> | (FoldableWithIndex i f1, Indexable i p, Contravariant f2, Applicative f2) => p a (f2 a) -> f1 a -> f2 (f1 a) |
| 07:06:17 | → | anderson joins (~anderson@user/anderson) |
| 07:06:20 | <ski> | now i'm wondering why the former uses `Int' |
| 07:07:19 | <ski> | > [(2,"hello"),(1 :: Integer,"world")] ^. folded . ifolded |
| 07:07:20 | <lambdabot> | "helloworld" |
| 07:07:34 | → | machinedgod joins (~machinedg@modemcable243.147-130-66.mc.videotron.ca) |
| 07:08:01 | <iqubic> | Because folded by default just creates an indexed fold that assigns [0..] to the elements |
| 07:08:29 | <ski> | oh |
| 07:08:49 | <iqubic> | > ["hello","world","example"] ^@.. folded |
| 07:08:51 | <lambdabot> | [(0,"hello"),(1,"world"),(2,"example")] |
| 07:08:54 | <ski> | oh, right .. the ordering differed |
| 07:09:53 | <ski> | (`"worldhello"' with `Map', `"helloworld"' with `folded') |
| 07:11:02 | → | poscat joins (~poscat@user/poscat) |
| 07:11:45 | <ski> | > Data.Map.fromList [(2,"hello"),(1,"world")] ^.. ifolded . asIndex |
| 07:11:46 | <lambdabot> | [1,2] |
| 07:11:48 | <ski> | > [(2,"hello"),(1,"world")] ^.. folded . ifolded . asIndex |
| 07:11:50 | <lambdabot> | [2,1] |
| 07:13:47 | × | machinedgod quits (~machinedg@modemcable243.147-130-66.mc.videotron.ca) (Ping timeout: 264 seconds) |
| 07:14:10 | → | Katarushisu18 joins (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) |
| 07:14:23 | → | cayley54 joins (~cayley5@user/phileasfogg) |
| 07:14:23 | → | pedant joins (~who@user/pedant) |
| 07:15:11 | × | fiddlerwoaroof quits (~fiddlerwo@user/fiddlerwoaroof) (Ping timeout: 245 seconds) |
| 07:15:20 | × | hexology quits (~hexology@user/hexology) (Remote host closed the connection) |
| 07:15:33 | → | glguy_ joins (g@libera/staff/glguy) |
| 07:15:39 | → | hexology joins (~hexology@user/hexology) |
| 07:15:39 | → | Sciencentistguy9 joins (~sciencent@hacksoc/ordinary-member) |
| 07:15:43 | → | fiddlerwoaroof joins (~fiddlerwo@user/fiddlerwoaroof) |
| 07:15:46 | × | gabriel_sevecek quits (~gabriel@188-167-229-200.dynamic.chello.sk) (Ping timeout: 245 seconds) |
| 07:15:46 | × | mmaruseacph2 quits (~mihai@mihai.page) (Ping timeout: 245 seconds) |
| 07:15:56 | × | travgm quits (~travgm@fsf/member/travgm) (Quit: travgm) |
| 07:16:02 | → | mmaruseacph2 joins (~mihai@mihai.page) |
| 07:16:11 | × | Katarushisu1 quits (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) (Ping timeout: 245 seconds) |
| 07:16:11 | × | cptaffe quits (~cptaffe@user/cptaffe) (Ping timeout: 245 seconds) |
| 07:16:11 | × | lawt quits (~lawt@2603:c024:c008:d000:5b4f:1ef2:fed2:ef3d) (Ping timeout: 245 seconds) |
| 07:16:11 | × | cayley5 quits (~cayley5@user/phileasfogg) (Ping timeout: 245 seconds) |
| 07:16:12 | × | bwe quits (~bwe@2a01:4f8:1c1c:4878::2) (Ping timeout: 245 seconds) |
| 07:16:12 | cayley54 | is now known as cayley5 |
| 07:16:12 | → | gabriel_sevecek joins (~gabriel@188-167-229-200.dynamic.chello.sk) |
| 07:16:12 | Katarushisu18 | is now known as Katarushisu1 |
| 07:16:19 | → | bwe joins (~bwe@2a01:4f8:1c1c:4878::2) |
| 07:16:22 | × | glguy quits (g@libera/staff/glguy) (Read error: Connection reset by peer) |
| 07:16:32 | → | cptaffe joins (~cptaffe@user/cptaffe) |
| 07:16:35 | → | lawt joins (~lawt@2603:c024:c008:d000:5b4f:1ef2:fed2:ef3d) |
| 07:16:36 | × | bcmiller quits (~bm3719@66.42.95.185) (Ping timeout: 245 seconds) |
| 07:16:45 | → | bcmiller_ joins (~bm3719@66.42.95.185) |
| 07:17:38 | × | Sciencentistguy quits (~sciencent@hacksoc/ordinary-member) (Ping timeout: 260 seconds) |
| 07:17:38 | Sciencentistguy9 | is now known as Sciencentistguy |
| 07:19:29 | glguy_ | is now known as glguy |
| 07:21:44 | × | benjaminl quits (~benjaminl@user/benjaminl) (Remote host closed the connection) |
| 07:23:04 | → | benjaminl joins (~benjaminl@user/benjaminl) |
| 07:27:06 | → | travgm joins (~travgm@fsf/member/travgm) |
| 07:29:02 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 07:29:18 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 07:32:14 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 07:33:25 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 07:38:31 | × | dikiaap quits (~dikiaap@user/dikiaap) (Ping timeout: 240 seconds) |
| 07:40:12 | → | dikiaap joins (~dikiaap@user/dikiaap) |
| 07:41:09 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 07:42:04 | × | potato44 quits (uid421314@id-421314.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 07:42:43 | → | ursa-major joins (~ursa-majo@37.19.210.37) |
| 07:44:51 | → | peterbecich joins (~Thunderbi@047-229-123-186.res.spectrum.com) |
| 07:47:42 | → | potato44 joins (uid421314@id-421314.lymington.irccloud.com) |
| 07:49:27 | × | rosco quits (~rosco@175.136.158.171) (Quit: Lost terminal) |
| 07:55:24 | × | travgm quits (~travgm@fsf/member/travgm) (Quit: travgm) |
| 07:56:01 | <EvanR> | that took entirely too long! |
| 07:56:32 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 07:59:16 | × | phma quits (~phma@host-67-44-208-227.hnremote.net) (Read error: Connection reset by peer) |
| 07:59:40 | → | phma joins (phma@2001:5b0:210d:4b88:db07:55ae:ef67:3fd5) |
| 07:59:43 | → | rosco joins (~rosco@175.136.158.171) |
| 07:59:59 | <tomsmeding> | I want to create a ByteString by poking stuff into memory and then constructing the ByteString without having to copy the whole thing again |
| 08:00:01 | <tomsmeding> | I wrote this: https://paste.tomsmeding.com/yJIviqkA |
| 08:00:24 | <tomsmeding> | how soon will this break |
| 08:01:54 | → | alp_ joins (~alp@2001:861:e3d6:8f80:b766:b9e9:37ec:cedc) |
| 08:02:38 | → | acidjnk joins (~acidjnk@p200300d6e72b93610dd19c2ddb792c3e.dip0.t-ipconnect.de) |
| 08:02:49 | <int-e> | tomsmeding: uhm https://hackage.haskell.org/package/bytestring-0.12.0.2/docs/Data-ByteString-Internal.html#v:create |
| 08:03:02 | <tomsmeding> | lol |
| 08:03:13 | → | fendor joins (~fendor@2a02:8388:1605:d100:267b:1353:13d7:4f0c) |
| 08:03:17 | → | iqubic- joins (~avi@2601:602:9502:c70:717f:d982:562d:94a3) |
| 08:03:25 | <tomsmeding> | I guess I missed that! |
| 08:03:52 | <int-e> | (there's an `unsafeCreate` too) |
| 08:03:59 | <tomsmeding> | I guess I was trying to look in .Unsafe |
| 08:04:22 | <tomsmeding> | which is 'create' inside unsafeDupablePerformIO |
| 08:04:23 | <tomsmeding> | right |
| 08:04:34 | × | iqubic quits (~avi@2607:fb91:1515:5d1c:16ae:37fc:2df2:7707) (Ping timeout: 276 seconds) |
| 08:04:42 | <tomsmeding> | do I now still need all the NOINLINE etc precautions |
| 08:05:14 | <tomsmeding> | the bytestring module even has INLINE, and none of the -fno-full-laziness -fno-cse cargo-culting |
| 08:06:57 | <int-e> | tomsmeding: The IO action is supposed to be pure-in-spirit. |
| 08:07:16 | <tomsmeding> | that's fair |
| 08:07:29 | → | Square joins (~Square@user/square) |
| 08:07:30 | <tomsmeding> | I guess that's true! |
| 08:07:37 | <tomsmeding> | yay, one less Unsafe.hs |
| 08:07:39 | <ski> | hm, an `ST' version might be nice |
| 08:07:49 | <tomsmeding> | ByteString no do ST for some reason |
| 08:07:53 | <ski> | createSTByteString :: Int -> (forall s. STPtr s Word8 -> ST s ()) -> ByteString |
| 08:07:56 | <ski> | runSTByteString :: Int -> (forall s. ST s (STByteString s)) -> ByteString |
| 08:08:11 | <ski> | would require `STPtr' / `STByteString', though |
| 08:08:27 | <int-e> | tomsmeding: And, hmm, not take any locks, since a thread of execution can just be garbage collected without a trace if it's duplicating work.. |
| 08:08:53 | <ski> | @type Data.Array.ST.runSTUArray |
| 08:08:54 | <lambdabot> | (forall s. ST s (Data.Array.Base.STUArray s i e)) -> Data.Array.Base.UArray i e |
| 08:09:09 | <tomsmeding> | int-e: the joys of unsafe*PerformIO |
| 08:09:18 | <int-e> | there's stToIO, right? |
| 08:09:27 | <ski> | yea |
| 08:09:28 | <tomsmeding> | luckily my poking code is indeed morally pure |
| 08:09:38 | <ski> | (and the other way around) |
| 08:09:50 | <tomsmeding> | (with an 'unsafe' prefix) |
| 08:09:52 | <int-e> | So a .Internals module can be forgiven for not providing an ST version :) |
| 08:09:56 | × | peterbecich quits (~Thunderbi@047-229-123-186.res.spectrum.com) (Ping timeout: 245 seconds) |
| 08:10:14 | <tomsmeding> | nothing in 'bytestring' does anything with ST :p |
| 08:12:40 | <ski> | @type Control.Monad.ST.stToIO |
| 08:12:41 | <lambdabot> | ST RealWorld a -> IO a |
| 08:12:46 | <ski> | @type GHC.IO.ioToST |
| 08:12:47 | <lambdabot> | IO a -> ST RealWorld a |
| 08:12:53 | <ski> | @type Control.Monad.ST.Unsafe.unsafeIOToST |
| 08:12:54 | <lambdabot> | IO a -> ST s a |
| 08:13:23 | <int-e> | I was mostly unsure about the CaPiTaLiZaTiOn. |
| 08:14:02 | <EvanR> | unsafeCaseInsensitivePerformIO |
| 08:14:47 | <int-e> | But sTToIO would look *really* ugly, so stToIO was the most likely candidate, plus it looked familiar. |
| 08:24:01 | → | Simikando joins (~Simikando@adsl-dyn59.91-127-62.t-com.sk) |
| 08:26:54 | × | shebpamm quits (~shebpamm@user/shebpamm) (Quit: leaving) |
| 08:33:44 | <ski> | % newtype STPtr s a = MkSTPtr {unSTPtr :: Ptr a} deriving (Eq,Ord) |
| 08:33:45 | <yahb2> | <no output> |
| 08:33:55 | <ski> | % let pokeElemOffST :: Storable a => STPtr s a -> Int -> a -> ST s (); pokeElemOffST (MkSTPtr p) i a = unsafeIOToST (pokeElemOff p i a) |
| 08:33:55 | <yahb2> | <no output> |
| 08:34:00 | <ski> | % let createSTByteString :: Int -> (forall s. STPtr s Word8 -> ST s ()) -> ByteString; createSTByteString n f = runST (unsafeIOToST (create n (\p -> stToIO (f (MkSTPtr p))))) |
| 08:34:00 | <yahb2> | <no output> |
| 08:34:08 | <ski> | % createSTByteString 4 (\ptr -> forM_ [0 .. 3] (\i -> pokeElemOffST ptr i (fromIntegral (ord 'a' + i)))) |
| 08:34:08 | <yahb2> | "abcd" |
| 08:34:39 | <tomsmeding> | cool |
| 08:37:07 | <ski> | (hm, i guess `createByteStringST' might be a better name, since this one doesn't involve `STByteString') |
| 08:45:05 | × | econo_ quits (uid147250@id-147250.tinside.irccloud.com) (Quit: Connection closed for inactivity) |
| 08:51:59 | → | tomith joins (tomith@user/tomith) |
| 08:54:11 | → | gmg joins (~user@user/gehmehgeh) |
| 08:57:11 | → | CiaoSen joins (~Jura@2a05:5800:284:500:2a3a:4dff:fe84:dbd5) |
| 08:59:05 | <Square> | Anyone happen to know what parser combinator library in Rust world feels most familiar coming from Haskell? |
| 09:13:16 | × | CiaoSen quits (~Jura@2a05:5800:284:500:2a3a:4dff:fe84:dbd5) (Ping timeout: 245 seconds) |
| 09:13:39 | <tomsmeding> | can I put Setup.hs flags in a cabal.project.local? (In particular, --show-details=direct for tests) |
| 09:14:22 | → | CiaoSen joins (~Jura@2a05:5800:284:500:ca4b:d6ff:fec1:99da) |
| 09:15:12 | <tomsmeding> | oh it seems the answer is "yes, you just write the option name" |
| 09:22:14 | × | CiaoSen quits (~Jura@2a05:5800:284:500:ca4b:d6ff:fec1:99da) (Quit: CiaoSen) |
| 09:30:31 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 09:30:43 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 09:37:24 | → | oo_miguel joins (~Thunderbi@78-11-179-96.static.ip.netia.com.pl) |
| 09:37:45 | × | [_] quits (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
| 09:38:10 | × | Simikando quits (~Simikando@adsl-dyn59.91-127-62.t-com.sk) (Ping timeout: 276 seconds) |
| 09:46:00 | → | Simikando joins (~Simikando@adsl-dyn59.91-127-62.t-com.sk) |
| 09:51:02 | → | idgaen joins (~idgaen@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) |
| 09:51:52 | → | mikess joins (~sam@user/mikess) |
| 09:52:29 | → | coot joins (~coot@89-69-206-216.dynamic.chello.pl) |
| 09:57:12 | × | alp_ quits (~alp@2001:861:e3d6:8f80:b766:b9e9:37ec:cedc) (Ping timeout: 268 seconds) |
| 10:06:29 | × | Simikando quits (~Simikando@adsl-dyn59.91-127-62.t-com.sk) (Ping timeout: 240 seconds) |
| 10:06:54 | × | tzh quits (~tzh@c-71-193-181-0.hsd1.or.comcast.net) (Quit: zzz) |
| 10:07:56 | → | pretty_dumm_guy joins (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) |
| 10:12:15 | → | Tuplanolla joins (~Tuplanoll@91-159-68-236.elisa-laajakaista.fi) |
| 10:14:32 | ← | dikiaap parts (~dikiaap@user/dikiaap) (Leaving) |
| 10:14:33 | → | Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915) |
| 10:14:59 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 264 seconds) |
| 10:17:33 | Lord_of_Life_ | is now known as Lord_of_Life |
| 10:22:17 | → | hapisnake777 joins (~hapisnake@2409:408d:710:3c2a::64:20ac) |
| 10:26:38 | <dminuoso_> | Square: nom is pretty nice. |
| 10:27:34 | <Square> | dminuoso_, Ok. That's what I'm using atm, but feel a bit lost at times. |
| 10:28:34 | × | hapisnake777 quits (~hapisnake@2409:408d:710:3c2a::64:20ac) (Ping timeout: 250 seconds) |
| 10:30:12 | <dminuoso_> | Square: I feel most of the awkardness when working with it, is just Rust things in general. |
| 10:30:14 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 10:30:50 | <Square> | dminuoso_, Yeah, you're right about that. |
| 10:32:21 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:f878:9036:c8c3:a993) (Remote host closed the connection) |
| 10:32:56 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:f878:9036:c8c3:a993) |
| 10:32:57 | → | califax joins (~califax@user/califx) |
| 10:37:01 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:f878:9036:c8c3:a993) (Ping timeout: 245 seconds) |
| 10:41:17 | → | simendsjo joins (~user@84.209.170.3) |
| 10:41:23 | × | mobivme quits (~mobivme@112.201.111.217) (Remote host closed the connection) |
| 10:41:35 | → | sawilagar joins (~sawilagar@user/sawilagar) |
| 10:46:58 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 10:47:11 | → | misterfish joins (~misterfis@46.44.172.198) |
| 10:51:35 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 252 seconds) |
| 10:53:00 | → | waleee joins (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) |
| 10:54:18 | → | mobivme joins (~mobivme@112.201.111.217) |
| 11:02:32 | × | mobivme quits (~mobivme@112.201.111.217) (Remote host closed the connection) |
| 11:07:14 | × | coot quits (~coot@89-69-206-216.dynamic.chello.pl) (Quit: coot) |
| 11:08:00 | → | mc47 joins (~mc47@xmonad/TheMC47) |
| 11:10:21 | → | mobivme joins (~mobivme@112.201.111.217) |
| 11:11:11 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:f878:9036:c8c3:a993) |
| 11:12:36 | → | target_i joins (~target_i@217.175.14.39) |
| 11:14:54 | × | jespada quits (~jespada@cpc121308-nmal25-2-0-cust15.19-2.cable.virginm.net) (Quit: Textual IRC Client: www.textualapp.com) |
| 11:21:11 | × | krei-se quits (~krei-se@p5085dea2.dip0.t-ipconnect.de) (Quit: ZNC 1.8.2 - https://znc.in) |
| 11:24:01 | → | krei-se joins (~krei-se@p5085dea2.dip0.t-ipconnect.de) |
| 11:24:35 | × | td_ quits (~td@83.135.9.0) (Remote host closed the connection) |
| 11:26:09 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 11:29:06 | × | Square quits (~Square@user/square) (Ping timeout: 245 seconds) |
| 11:30:21 | × | simendsjo quits (~user@84.209.170.3) (Ping timeout: 245 seconds) |
| 11:34:27 | → | td_ joins (~td@83.135.9.0) |
| 11:48:41 | × | misterfish quits (~misterfis@46.44.172.198) (Ping timeout: 245 seconds) |
| 11:51:12 | × | pretty_dumm_guy quits (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.5) |
| 11:53:39 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 11:53:56 | → | califax joins (~califax@user/califx) |
| 11:56:20 | → | Unicorn_Princess joins (~Unicorn_P@user/Unicorn-Princess/x-3540542) |
| 11:59:12 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 11:59:39 | → | jespada joins (~jespada@cpc121308-nmal25-2-0-cust15.19-2.cable.virginm.net) |
| 11:59:51 | → | pretty_dumm_guy joins (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) |
| 12:07:07 | × | dcoutts quits (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) (Ping timeout: 255 seconds) |
| 12:08:54 | → | chomwitt joins (~chomwitt@2a02:587:7a09:c300:1ac0:4dff:fedb:a3f1) |
| 12:10:13 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 12:10:52 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 12:13:28 | → | misterfish joins (~misterfis@87.215.131.102) |
| 12:14:27 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 256 seconds) |
| 12:31:39 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 12:33:38 | → | coot joins (~coot@89-69-206-216.dynamic.chello.pl) |
| 12:38:38 | × | szkl quits (uid110435@id-110435.uxbridge.irccloud.com) (Quit: Connection closed for inactivity) |
| 12:42:40 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 12:42:50 | → | chexum_ joins (~quassel@gateway/tor-sasl/chexum) |
| 12:46:14 | <exarkun> | When I use Megaparsec's getParserState, it always tells me it's at line 1, column 1. Have I misunderstood its purpose? |
| 12:51:12 | × | lav quits (~pi@wikipedia/maddy-from-celeste) (Remote host closed the connection) |
| 12:53:39 | <exarkun> | I guess I should use getSourcePos instead |
| 12:53:57 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 12:55:59 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 12:56:36 | × | sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 245 seconds) |
| 12:58:54 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 12:59:08 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 256 seconds) |
| 12:59:22 | <cheater> | hi all |
| 12:59:47 | <cheater> | every package on hackage used to have a thing you could click to see a list of all the defined names in the package, where is it now? i can't find it on here https://hackage.haskell.org/package/servant |
| 13:00:20 | <cheater> | oh "index" |
| 13:09:33 | <cheater> | on the type level, does :> have any specific meaning? |
| 13:10:53 | → | sawilagar joins (~sawilagar@user/sawilagar) |
| 13:14:39 | <cheater> | oh, seems like it's from effectful |
| 13:20:37 | × | coot quits (~coot@89-69-206-216.dynamic.chello.pl) (Quit: coot) |
| 13:23:35 | × | mc47 quits (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
| 13:25:24 | × | mobivme quits (~mobivme@112.201.111.217) (Read error: Connection reset by peer) |
| 13:31:55 | <hippoid> | is there a function to take a list like [1, 2, 3, 6, 7, 8, 10, 11] and return [[1,2,3], [6,7,8], [10,11]] -- where each element of the new list is the consecutive values from the input list? |
| 13:31:56 | → | [itchyjunk] joins (~itchyjunk@user/itchyjunk/x-7353470) |
| 13:33:32 | → | mobivme joins (~mobivme@112.201.111.217) |
| 13:33:36 | <xerox> | > takeWhile (not . null) . unfoldr (Just . splitAt 3) $ [1,2,3,6,7,8,10,11] |
| 13:33:38 | <lambdabot> | [[1,2,3],[6,7,8],[10,11]] |
| 13:35:06 | <hippoid> | > takeWhile (not . null) . unfoldr (Just . splitAt 3) $ [1,2,3,6,7,8,10,11, 12, 13] |
| 13:35:07 | <lambdabot> | [[1,2,3],[6,7,8],[10,11,12],[13]] |
| 13:35:22 | <hippoid> | i don't want the last 13 in its own element |
| 13:35:37 | <xerox> | what's the complete specification then? |
| 13:37:11 | <hippoid> | values that are consecutive (succ) should be grouped together |
| 13:37:18 | <hippoid> | does that make sense? |
| 13:40:25 | <hippoid> | and the list is guaranteed to be in order |
| 13:40:45 | <ncf> | :t groupBy |
| 13:40:46 | <lambdabot> | (a -> a -> Bool) -> [a] -> [[a]] |
| 13:41:17 | <[Leary]> | Unfortunately it doesn't work for this. |
| 13:41:18 | <ncf> | > groupBy (\a b -> b - a == 1) [1, 2, 3, 6, 7, 8, 10, 11] |
| 13:41:20 | <lambdabot> | [[1,2],[3],[6,7],[8],[10,11]] |
| 13:41:24 | <ncf> | huh |
| 13:41:44 | <ncf> | oh, checked against the first element |
| 13:41:57 | <ncf> | drat |
| 13:42:58 | <xerox> | yeah… |
| 13:46:38 | <ncf> | > map (map snd) . groupBy (\(i,a) (j,b) -> a+j == b+i) . zip [0..] $ [1, 2, 3, 6, 7, 8, 10, 11] |
| 13:46:39 | <lambdabot> | [[1,2,3],[6,7,8],[10,11]] |
| 13:46:56 | <[Leary]> | > (\xs -> fmap snd <$> groupBy ((==) `on` fst) (zip (zipWith subtract [0..] xs) xs)) [1,2,3,6,7,8,10,11] |
| 13:46:57 | <lambdabot> | [[1,2,3],[6,7,8],[10,11]] |
| 13:47:00 | <[Leary]> | Beat me to it. |
| 13:47:06 | <ncf> | haha |
| 13:47:37 | <ncf> | that would be quite clean with groupOn |
| 13:48:28 | <xerox> | > let g _ [] = []; g _ [x] = [[x]]; g c (x:xs) | c x (head y) = (x:y):ys | otherwise = [x]:(y:ys) where (y:ys) = g c xs in g (\a b -> a+1==b) [1,2,3,6,7,8,10,11,12,13] |
| 13:48:29 | × | raehik quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Quit: WeeChat 4.1.1) |
| 13:48:29 | <lambdabot> | [[1,2,3],[6,7,8],[10,11,12,13]] |
| 13:48:42 | <hippoid> | whoa, thanks! im digest that over some coffee :> |
| 13:48:51 | <hippoid> | *gonna |
| 13:51:55 | × | chomwitt quits (~chomwitt@2a02:587:7a09:c300:1ac0:4dff:fedb:a3f1) (Ping timeout: 256 seconds) |
| 14:02:23 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 14:16:36 | → | Guest84 joins (~Guest84@92.249.121.42) |
| 14:19:20 | × | Xyloes quits (~wyx@2400:dd01:103a:1012:5923:33ce:7857:fc04) (Quit: Konversation terminated!) |
| 14:20:05 | → | Square joins (~Square@user/square) |
| 14:23:54 | × | trev quits (~trev@user/trev) (Quit: trev) |
| 14:24:44 | → | trev joins (~trev@user/trev) |
| 14:30:38 | → | mechap joins (~mechap@user/mechap) |
| 14:37:30 | → | Lycurgus joins (~georg@user/Lycurgus) |
| 14:39:20 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 14:40:15 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 268 seconds) |
| 14:43:03 | → | mobivme joins (~mobivme@112.201.111.217) |
| 14:48:05 | ← | albet70 parts (~xxx@2400:8902::f03c:92ff:fe60:98d8) () |
| 14:48:44 | × | Guest84 quits (~Guest84@92.249.121.42) (Quit: Client closed) |
| 14:55:35 | <cheater> | that's convoluted |
| 14:55:40 | <cheater> | just use a fold hippoid |
| 15:12:01 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 15:24:07 | <ski> | > let g _ [] = []; g _ [x] = [(x,[])]; g c (x:xs) | c x y = (x,y:ys):yss | otherwise = (x,[]):ys0:yss where ys0@(y,ys):yss = g c xs in map (uncurry (:)) (g (\a b -> a + 1 == b) [1,2,3,6,7,8,10,11]) |
| 15:24:08 | <lambdabot> | [[1,2,3],[6,7,8],[10,11]] |
| 15:24:16 | <ski> | > let g _ [] = []; g _ [x] = [(x,[])]; g c (x:xs) | c x y = (x,y:ys):yss | otherwise = (x,[]):ys0:yss where ys0@(y,ys):yss = g c xs in (take 3 . map (uncurry (:)) . g (\a b -> a + 1 == b)) ([1,2,3,6,7,8] ++ [10 ..]) |
| 15:24:23 | <lambdabot> | mueval-core: Time limit exceeded |
| 15:24:25 | <ski> | > let g _ [] = []; g _ [x] = [(x,[])]; g c (x:xs) = (x,ys1):yss1 where (ys1,yss1) | c x y = (y:ys,yss0) | otherwise = ([],ys0:yss0); ys0@(y,ys):yss0 = g c xs in map (uncurry (:)) (g (\a b -> a + 1 == b) [1,2,3,6,7,8,10,11]) |
| 15:24:27 | <lambdabot> | [[1,2,3],[6,7,8],[10,11]] |
| 15:24:33 | <ski> | > let g _ [] = []; g _ [x] = [(x,[])]; g c (x:xs) = (x,ys1):yss1 where (ys1,yss1) | c x y = (y:ys,yss0) | otherwise = ([],ys0:yss0); ys0@(y,ys):yss0 = g c xs in (take 3 . map (uncurry (:)) . g (\a b -> a + 1 == b)) ([1,2,3,6,7,8] ++ [10 ..]) |
| 15:24:34 | <lambdabot> | [[1,2,3],[6,7,8],[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,2... |
| 15:33:48 | × | fendor quits (~fendor@2a02:8388:1605:d100:267b:1353:13d7:4f0c) (Remote host closed the connection) |
| 15:35:43 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 240 seconds) |
| 15:40:35 | → | chomwitt joins (~chomwitt@2a02:587:7a09:c300:1ac0:4dff:fedb:a3f1) |
| 15:41:25 | → | wickedjargon joins (~ff@2607:fea8:5680:3f20::8158) |
| 15:43:21 | <wickedjargon> | hello |
| 15:45:07 | <wickedjargon> | question: this function is meant to apply a list of functions to a list of arguments, however, when I use `show` in the list of functions, I get a `No instance for (Num String)` error, even when `show` is the last function in the list |
| 15:45:58 | <wickedjargon> | https://paste.tomsmeding.com/c2gZfUWb |
| 15:49:45 | → | Tlsx joins (~rscastilh@189.61.140.215) |
| 15:51:16 | <ncf> | your function is probably inferred to take a [a -> a], and i don't think you can make it any more general |
| 15:52:51 | <ncf> | instead of lists (free monoids) you probably want some sort of free category construction that lets you build formal chains of morphisms a -> b, b -> c, ... |
| 15:53:50 | <ski> | wickedjargon : use pattern-matching, rather than `null',`head',`tail' |
| 15:54:20 | <ski> | (also you can use `where' instead of `let'-`in') |
| 15:55:58 | <wickedjargon> | ski: okay, trying that now |
| 15:57:23 | <wickedjargon> | ncf: thanks, but I need to learn more before I understand what you wrote |
| 15:57:55 | <ncf> | maybe start by writing down what type you want mapFuncLstToElemLst to have, and see what fails |
| 16:01:14 | <wickedjargon> | ski: using pattern matching and `where` inshead of `let...in` produces te same error |
| 16:01:20 | <ski> | yes |
| 16:01:30 | <wickedjargon> | ncf: okay, let me try that |
| 16:01:43 | <ski> | try changing the list elements to `String's in the example ? |
| 16:02:20 | <ski> | wickedjargon : i made a paste where i did the changes i suggested. i could show it, but perhaps you'd like to try a little more on your own, first ? |
| 16:04:32 | ski | suspects that wickedjargon neither knows about free monoids, nor free categories |
| 16:04:37 | <wickedjargon> | ski: I'd prefer to see it |
| 16:04:46 | <ski> | wickedjargon : <https://paste.tomsmeding.com/hFrhacbJ> |
| 16:05:15 | <ncf> | i meant something like this: https://paste.tomsmeding.com/yHvSlSZR |
| 16:05:28 | <ski> | hopefully you'll be able to follow the changes i did |
| 16:05:58 | <ski> | yea, i figured, ncf :) |
| 16:07:47 | ski | would also rename `mapFuncLstToElemLst' to something more wieldy, but figured not to change the naming of top-level / exported definitions, for ease of testing & comparision |
| 16:08:21 | <ski> | (oh, and one of the base cases is redundant .. can you figure out which ?) |
| 16:09:12 | × | idgaen quits (~idgaen@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) (Quit: WeeChat 4.1.1) |
| 16:10:42 | <ski> | (well .. i guess the behaviour would differ with an infinite or partial list of functions, in that case. but i'm not sure it'd be worth it for that, and for the small efficiency gain for a relatively rare occurance) |
| 16:11:46 | <wickedjargon> | something unexpected came up, I'm going to return to this problem this evening. thanks so much. |
| 16:12:53 | × | Festive_Derg quits (A_D@libera/staff/dragon) (Quit: ZNC - https://znc.in) |
| 16:14:35 | → | A_Dragon joins (A_D@libera/staff/dragon) |
| 16:15:42 | × | notzmv quits (~zmv@user/notzmv) (Ping timeout: 260 seconds) |
| 16:17:41 | × | rosco quits (~rosco@175.136.158.171) (Quit: Lost terminal) |
| 16:18:15 | → | dhil joins (~dhil@2001:8e0:2014:3100:e2a4:ca79:e8ee:d85f) |
| 16:21:50 | <ski> | wickedjargon : no problem |
| 16:25:21 | × | waleee quits (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) (Ping timeout: 256 seconds) |
| 16:25:22 | × | euleritian quits (~euleritia@77.22.252.56) (Read error: Connection reset by peer) |
| 16:26:06 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 16:30:01 | × | jmdaemon quits (~jmdaemon@user/jmdaemon) (Ping timeout: 255 seconds) |
| 16:30:50 | → | helge_ joins (~textual@h-158-174-186-9.NA.cust.bahnhof.se) |
| 16:30:52 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 16:31:44 | <helge_> | Is it preferable to use ghcup to install HLS, or to let VS Code do it? |
| 16:32:55 | <helge_> | I have two project folders, both created with "stack new". One today, one about one month ago. For the new project folder, VS Code claims that I need HLS 2.5.0.0. The old one doesn't. ghcup says that I have HLS 2.4.0.0. |
| 16:32:56 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 16:34:05 | <helge_> | I don't understand what is so different between my two project folders, that VS Code (and an extension in it) cares about. |
| 16:35:46 | × | mobivme quits (~mobivme@112.201.111.217) (Ping timeout: 245 seconds) |
| 16:44:44 | → | alexherbo2 joins (~alexherbo@2a02-8440-3141-ad43-9872-e573-fc8f-0e1e.rev.sfr.net) |
| 16:46:35 | → | mobivme joins (~mobivme@112.201.111.217) |
| 16:47:47 | × | euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
| 16:48:27 | → | califax joins (~califax@user/califx) |
| 16:48:40 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 16:49:07 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 16:50:33 | × | alexherbo2 quits (~alexherbo@2a02-8440-3141-ad43-9872-e573-fc8f-0e1e.rev.sfr.net) (Remote host closed the connection) |
| 16:51:45 | → | alexherbo2 joins (~alexherbo@134.151.22.93.rev.sfr.net) |
| 16:56:07 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 16:57:01 | × | Hobbyboy quits (Hobbyboy@hobbyboy.co.uk) (Quit: The BNC has broken!) |
| 16:57:02 | × | euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
| 16:57:11 | → | euleritian joins (~euleritia@dynamic-002-247-250-109.2.247.pool.telefonica.de) |
| 16:57:23 | × | ddellacosta quits (~ddellacos@ool-44c73d16.dyn.optonline.net) (Quit: WeeChat 4.1.1) |
| 16:57:28 | × | euleritian quits (~euleritia@dynamic-002-247-250-109.2.247.pool.telefonica.de) (Read error: Connection reset by peer) |
| 16:57:47 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 17:00:45 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 252 seconds) |
| 17:03:27 | → | dcoutts joins (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) |
| 17:03:53 | → | califax joins (~califax@user/califx) |
| 17:09:06 | × | euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
| 17:09:23 | <haskellbridge> | 14<maerwald> Different ghc version |
| 17:09:36 | <haskellbridge> | 14<maerwald> GHC 9.4.8 needs HLS 2.5.0.0 |
| 17:10:04 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 17:12:04 | → | billb joins (~billb@cpe-66-8-173-22.hawaii.res.rr.com) |
| 17:13:15 | <xerox> | ski: appreciate it |
| 17:14:39 | <ski> | xerox : i was thinking about `foldr'ing it, but got stuck a bit on making sure it was still incremental (i.e. could handle infinite lists), and then got distracted |
| 17:14:49 | <xerox> | :)) |
| 17:15:28 | × | alexherbo2 quits (~alexherbo@134.151.22.93.rev.sfr.net) (Ping timeout: 250 seconds) |
| 17:15:32 | × | billb quits (~billb@cpe-66-8-173-22.hawaii.res.rr.com) (Client Quit) |
| 17:17:15 | × | dcoutts quits (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) (Ping timeout: 252 seconds) |
| 17:17:35 | <ski> | (also, the `head' and the repeated taking apart `y:ys' and reforming `(c:y):ys' was bothering me, which was why i used pairs there, instead) |
| 17:17:53 | <xerox> | (yeah me too but didn't have the time to do better at that point) |
| 17:19:55 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 17:21:51 | <helge_> | haskellbridge : You are right, I have different ghci versions in my two folders. What could be the reason? The only relevant difference that I have found is in stack.yaml, where I have slightly different values for resolver. lts/21/20.yaml vs lts/21/22.yaml. |
| 17:27:21 | → | econo_ joins (uid147250@id-147250.tinside.irccloud.com) |
| 17:30:26 | <ski> | helge_ : s/haskellbridge/maerwald/ |
| 17:30:31 | <helge_> | In my two folders, "ghc --version" both responds with 9.4.7, but in the newer folder, "stack ghci" starts version 9.4.8. |
| 17:30:51 | → | califax joins (~califax@user/califx) |
| 17:30:52 | <geekosaur> | the resolver specifies the ghc version |
| 17:31:45 | <geekosaur> | https://www.stackage.org/ shows the resolvers and their ghc versions, you will note that 21.22 indeed upgraded ghc to 9.4.8 |
| 17:34:45 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:f878:9036:c8c3:a993) (Remote host closed the connection) |
| 17:35:06 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d9f3:ec2f:a760:e0fe) |
| 17:36:24 | <helge_> | I used ghcup tui to add HLS version 2.5.0.0, and it seems to solve the problem. Thanks a lot for the help! |
| 17:39:56 | → | Feuermagier joins (~Feuermagi@user/feuermagier) |
| 17:41:08 | → | dcoutts joins (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) |
| 17:47:16 | × | helge_ quits (~textual@h-158-174-186-9.NA.cust.bahnhof.se) (Quit: Textual IRC Client: www.textualapp.com) |
| 17:48:27 | × | dcoutts quits (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) (Ping timeout: 260 seconds) |
| 17:48:59 | → | tzh joins (~tzh@c-71-193-181-0.hsd1.or.comcast.net) |
| 17:49:41 | <shapr> | @quote |
| 17:49:41 | <lambdabot> | mdedetrich says: safety might not be a concern |
| 17:50:52 | × | ursa-major quits (~ursa-majo@37.19.210.37) (Ping timeout: 276 seconds) |
| 17:55:38 | → | idgaen joins (~idgaen@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) |
| 17:57:45 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 17:58:14 | × | todi quits (~todi@pd9571327.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 18:00:31 | → | wootehfoot joins (~wootehfoo@user/wootehfoot) |
| 18:04:53 | A_Dragon | is now known as Festive_Derg |
| 18:16:31 | → | waleee joins (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) |
| 18:16:36 | × | iqubic- quits (~avi@2601:602:9502:c70:717f:d982:562d:94a3) (Ping timeout: 245 seconds) |
| 18:21:18 | → | todi joins (~todi@pd9571327.dip0.t-ipconnect.de) |
| 18:21:24 | × | todi quits (~todi@pd9571327.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 18:22:06 | → | todi joins (~todi@pd9571327.dip0.t-ipconnect.de) |
| 18:22:06 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 18:29:06 | → | __monty__ joins (~toonn@user/toonn) |
| 18:30:09 | × | wootehfoot quits (~wootehfoo@user/wootehfoot) (Quit: Leaving) |
| 18:35:40 | × | euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
| 18:36:22 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 18:38:12 | → | plates joins (~plates@cbd100.neoplus.adsl.tpnet.pl) |
| 18:38:55 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 18:42:44 | × | todi quits (~todi@pd9571327.dip0.t-ipconnect.de) (Remote host closed the connection) |
| 18:43:37 | → | todi joins (~todi@pd9571327.dip0.t-ipconnect.de) |
| 18:46:11 | × | trev quits (~trev@user/trev) (Quit: trev) |
| 18:47:25 | → | dcoutts joins (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) |
| 18:55:09 | × | dcoutts quits (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) (Ping timeout: 252 seconds) |
| 19:03:49 | × | euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Ping timeout: 255 seconds) |
| 19:04:13 | → | euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
| 19:16:53 | × | malte quits (~malte@mal.tc) (Ping timeout: 240 seconds) |
| 19:20:22 | → | peterbecich joins (~Thunderbi@047-229-123-186.res.spectrum.com) |
| 19:23:10 | × | mobivme quits (~mobivme@112.201.111.217) (Read error: Connection reset by peer) |
| 19:27:14 | → | mobivme joins (~mobivme@112.201.111.217) |
| 19:35:10 | × | plates quits (~plates@cbd100.neoplus.adsl.tpnet.pl) (Quit: Client closed) |
| 19:43:41 | × | Tlsx quits (~rscastilh@189.61.140.215) (Read error: Connection reset by peer) |
| 19:47:22 | → | Tlsx joins (~rscastilh@189.61.140.215) |
| 20:04:20 | → | Hobbyboy joins (Hobbyboy@hobbyboy.co.uk) |
| 20:14:35 | → | zmt01 joins (~zmt00@user/zmt00) |
| 20:15:00 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 20:18:22 | × | zmt00 quits (~zmt00@user/zmt00) (Ping timeout: 260 seconds) |
| 20:19:11 | × | drdo quits (~drdo@bl14-14-49.dsl.telepac.pt) (Ping timeout: 260 seconds) |
| 20:21:56 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 20:24:06 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 20:24:14 | → | drdo joins (~drdo@bl14-14-49.dsl.telepac.pt) |
| 20:25:04 | → | iqubic joins (~avi@2601:602:9502:c70:717f:d982:562d:94a3) |
| 20:25:11 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 20:27:40 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 20:30:20 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 20:30:20 | × | gmg quits (~user@user/gehmehgeh) (Remote host closed the connection) |
| 20:30:42 | → | califax joins (~califax@user/califx) |
| 20:31:05 | → | gmg joins (~user@user/gehmehgeh) |
| 20:34:19 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 20:35:15 | → | fendor joins (~fendor@2a02:8388:1605:d100:267b:1353:13d7:4f0c) |
| 20:35:52 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 20:43:04 | → | coot joins (~coot@89-69-206-216.dynamic.chello.pl) |
| 20:44:27 | × | Tlsx quits (~rscastilh@189.61.140.215) () |
| 20:50:14 | → | alexherbo2 joins (~alexherbo@153.13.23.93.rev.sfr.net) |
| 20:53:55 | × | mikess quits (~sam@user/mikess) (Quit: leaving) |
| 20:54:09 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 20:55:21 | → | travgm joins (~travgm@fsf/member/travgm) |
| 20:57:35 | → | nate4 joins (~nate@c-98-45-158-125.hsd1.ca.comcast.net) |
| 20:58:11 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 21:01:43 | × | koz quits (~koz@121.99.240.58) (Ping timeout: 255 seconds) |
| 21:02:37 | × | nate4 quits (~nate@c-98-45-158-125.hsd1.ca.comcast.net) (Ping timeout: 276 seconds) |
| 21:02:58 | → | koz joins (~koz@121.99.240.58) |
| 21:03:41 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 21:03:43 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 21:05:29 | × | foul_owl quits (~kerry@157.97.134.167) (Ping timeout: 252 seconds) |
| 21:09:54 | → | pavonia joins (~user@user/siracusa) |
| 21:19:31 | × | iqubic quits (~avi@2601:602:9502:c70:717f:d982:562d:94a3) (Ping timeout: 245 seconds) |
| 21:20:00 | → | foul_owl joins (~kerry@157.97.134.165) |
| 21:22:08 | × | gmg quits (~user@user/gehmehgeh) (Remote host closed the connection) |
| 21:22:51 | → | gmg joins (~user@user/gehmehgeh) |
| 21:23:26 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 21:24:03 | × | travgm quits (~travgm@fsf/member/travgm) (Quit: Adios) |
| 21:24:24 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 21:26:23 | <glguy> | How do I disable ghc 9.8's new warning for partial functions? |
| 21:26:56 | <glguy> | Oh, it was -Wno-x-partial |
| 21:27:25 | → | ddellacosta joins (~ddellacos@ool-44c73d16.dyn.optonline.net) |
| 21:29:39 | → | travgm joins (~travgm@fsf/member/travgm) |
| 21:31:14 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:d9f3:ec2f:a760:e0fe) (Remote host closed the connection) |
| 21:31:49 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d9f3:ec2f:a760:e0fe) |
| 21:32:47 | × | target_i quits (~target_i@217.175.14.39) (Quit: leaving) |
| 21:35:28 | × | son0p quits (~ff@181.136.122.143) (Quit: Bye) |
| 21:36:11 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:d9f3:ec2f:a760:e0fe) (Ping timeout: 245 seconds) |
| 21:37:27 | × | wickedjargon quits (~ff@2607:fea8:5680:3f20::8158) (Remote host closed the connection) |
| 21:41:18 | <EvanR> | it warns for all uses of partial functions? or just the usual suspects like tail |
| 21:42:39 | <EvanR> | which has a reasonable non-partial alternative |
| 21:44:47 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 21:45:43 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 21:48:02 | <geekosaur> | only functions in base which have a WARNING pragma, apparently |
| 21:48:55 | <geekosaur> | (which means it doesn't show up in `ghc --show-options`) |
| 21:54:40 | × | fendor quits (~fendor@2a02:8388:1605:d100:267b:1353:13d7:4f0c) (Remote host closed the connection) |
| 21:56:11 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:d9f3:ec2f:a760:e0fe) |
| 21:57:12 | <glguy> | I had forgotten the - after no |
| 21:58:16 | glguy | finds a chance to get TransformListComp back into his solution repo :) - lost my previous one in a refactor |
| 21:59:46 | → | ec_ joins (~ec@gateway/tor-sasl/ec) |
| 21:59:57 | ec_ | is now known as ec |
| 22:00:05 | → | iqubic joins (~avi@2601:602:9502:c70:717f:d982:562d:94a3) |
| 22:00:07 | <Rembane> | That sounds spicy! :) |
| 22:06:19 | × | travgm quits (~travgm@fsf/member/travgm) (Ping timeout: 276 seconds) |
| 22:06:24 | × | waleee quits (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) (Ping timeout: 268 seconds) |
| 22:08:12 | × | coot quits (~coot@89-69-206-216.dynamic.chello.pl) (Quit: coot) |
| 22:08:56 | × | ec quits (~ec@gateway/tor-sasl/ec) (Remote host closed the connection) |
| 22:12:26 | → | dcoutts joins (~duncan@cpc69402-oxfd27-2-0-cust903.4-3.cable.virginm.net) |
| 22:12:32 | → | wroathe joins (~wroathe@50.205.197.50) |
| 22:12:32 | × | wroathe quits (~wroathe@50.205.197.50) (Changing host) |
| 22:12:32 | → | wroathe joins (~wroathe@user/wroathe) |
| 22:14:59 | → | son0p joins (~ff@181.136.122.143) |
| 22:15:31 | <wroathe> | Hey guys, I've got this program I've been working on in a much better spot thanks to the advice in here, but I see lots of allocations and GCs going on in the inner loop, even though the total heap usage of the program is much much better. I have some theories as to why this would be, but my question for you guys is how you go about analyzing a program to determine where allocations are being made and |
| 22:15:37 | <wroathe> | where to apply strictness annotations or how to specify unboxed values |
| 22:16:13 | <wroathe> | https://gist.github.com/JustinChristensen/2111f13e812112b5ac973e292606d17f here's the latest |
| 22:17:07 | <wroathe> | The "hot" area for allocations according to the ticky-ticky profiling option is lines 78-84 |
| 22:17:13 | <wroathe> | Which makes sense |
| 22:17:59 | <wroathe> | What I'm trying to determine is if I can rewrite 65-84 in a way that avoids allocations and GCs, but beyond having someone give me the answer I'm more interesting in "learning how to fish" here |
| 22:18:09 | <wroathe> | So how would you go about analyzing this program to determine where the allocations are being made? |
| 22:18:24 | × | dhil quits (~dhil@2001:8e0:2014:3100:e2a4:ca79:e8ee:d85f) (Ping timeout: 256 seconds) |
| 22:19:48 | <wroathe> | My current working theory is that it allocates a "FixState" value for every character in the input stream, and I'm hoping to 1. Prove this, 2. Figure out if there's an optimization option or a way to write this code to avoid that |
| 22:22:07 | <[Leary]> | wroathe: I'm not experienced in this area, but I gather if you dump and examine the generated STG you'll be able to see all the allocations (as lets). |
| 22:22:49 | <wroathe> | Ah, that was one of my points of confusion with dumping the STG. So you're saying a "let" always means a heap allocation? |
| 22:22:52 | <wroathe> | I'll give that a shot |
| 22:23:41 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Read error: Connection reset by peer) |
| 22:26:11 | × | peterbecich quits (~Thunderbi@047-229-123-186.res.spectrum.com) (Ping timeout: 245 seconds) |
| 22:33:57 | × | gmg quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 22:34:44 | <wroathe> | I don't really know what I'm looking at, but I do see my data constructors for that enumerated value referenced quite a bit |
| 22:37:18 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 22:37:45 | <wroathe> | Oh, I wonder if this is what I'm looking for: https://gitlab.haskell.org/ghc/ghc/-/wikis/unpacked-sum-types |
| 22:40:18 | <[Leary]> | wroathe: I'm not sure if this will actually help, but one thing I'd try is rewriting `loop` as `doTheThing input output buf = fix \loop !state -> ... loop nextState`. Another thing could be church encoding FixState. |
| 22:41:26 | <wroathe> | TODO: learn what church encoding is |
| 22:41:29 | <wroathe> | Thanks for the tip |
| 22:43:56 | <[Leary]> | Here it would be `newtype FixState = FixState{ branch :: forall a. a -> a -> a }; start = FixState \s _ -> s; backslash = FixState \_ b -> b`. Then instead of `case state of ...` you do `match state ...`. |
| 22:44:25 | <[Leary]> | Err, `branch state ...`. |
| 22:47:08 | × | alexherbo2 quits (~alexherbo@153.13.23.93.rev.sfr.net) (Remote host closed the connection) |
| 22:49:31 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 22:49:54 | ski | . o O ( "Multi-return function call" by Olin Shivers,David Fisher in 2004-09,2006-0[79] at <https://www.khoury.northeastern.edu/home/shivers/citations.html#mrlc> ) |
| 22:50:19 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 22:50:46 | × | wroathe quits (~wroathe@user/wroathe) (Ping timeout: 245 seconds) |
| 22:59:19 | → | peterbecich joins (~Thunderbi@047-229-123-186.res.spectrum.com) |
| 23:09:49 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 23:12:03 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 23:13:19 | × | acidjnk quits (~acidjnk@p200300d6e72b93610dd19c2ddb792c3e.dip0.t-ipconnect.de) (Ping timeout: 268 seconds) |
| 23:13:47 | × | jorik808 quits (~jorik808@d51A48920.access.telenet.be) (Ping timeout: 264 seconds) |
| 23:14:06 | → | jorik808 joins (~jorik808@d51A48920.access.telenet.be) |
| 23:15:55 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 23:16:09 | → | Alleria joins (~JohnGalt@user/alleria) |
| 23:16:27 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 23:17:21 | × | Alleria quits (~JohnGalt@user/alleria) (Client Quit) |
| 23:18:26 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 23:18:27 | × | peterbecich quits (~Thunderbi@047-229-123-186.res.spectrum.com) (Ping timeout: 256 seconds) |
| 23:19:06 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 23:19:21 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 23:19:21 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 23:19:22 | → | wroathe joins (~wroathe@user/wroathe) |
| 23:20:33 | <iqubic> | What is a FixState in this context? |
| 23:26:46 | <ski> | see <https://gist.githubusercontent.com/JustinChristensen/2111f13e812112b5ac973e292606d17f/raw/03b2086e312d410727563fcbc011cabd52d45a0a/fixFile.hs> : `data FixState = Start | Backslash deriving (Show,Eq,Enum)' |
| 23:27:54 | × | idgaen quits (~idgaen@2a01:e0a:498:fd50:fcc6:bb5d:489a:ce8c) (Quit: WeeChat 4.1.1) |
| 23:31:30 | <ski> | something about keeping track of whether you're currently in an escape sequence or not |
| 23:32:36 | <iqubic> | Should I try learning what the heck continuations are and how shift, rest, and callCC work in Haskell, or is that not worth it? |
| 23:33:26 | <ski> | s/escape/backslash/ |
| 23:33:50 | <ski> | iqubic : it's fun .. but also takes some time to get into |
| 23:34:15 | × | mechap quits (~mechap@user/mechap) (Quit: WeeChat 4.1.1) |
| 23:34:16 | <iqubic> | do you have any good guides I can look at? |
| 23:35:30 | <ski> | <https://hackage.haskell.org/package/managed-1.0.10/docs/Control-Monad-Managed.html> might show you one neat thing you can do with it |
| 23:37:06 | <ski> | guides .. hmm .. not really |
| 23:38:19 | <ski> | i mean, i could point you to two research papers by Andrzej Filinski and Olivier Danvy, about the Continuation-Style Passing transform, that helped me understand this, when i started reading about it .. but i'm not sure if you're wanting resources about it, at that level |
| 23:38:55 | × | iqubic quits (~avi@2601:602:9502:c70:717f:d982:562d:94a3) (Ping timeout: 260 seconds) |
| 23:40:45 | × | oo_miguel quits (~Thunderbi@78-11-179-96.static.ip.netia.com.pl) (Quit: oo_miguel) |
| 23:41:32 | → | iqubic joins (~avi@2607:fb91:1518:c0e2:d265:9ef3:5320:9df0) |
| 23:42:54 | <ski> | one way to explain continuations is "`goto' on steroids", or "`goto' with parameters". one can do really mind-warping things with continuations |
| 23:43:01 | <[Leary]> | iqubic: Perhaps start with this lexi-lambda talk, 'Delimited Continuations, Demystified': https://www.youtube.com/watch?v=DRFsodbxHQo |
| 23:43:30 | <iqubic> | ski: I'm using my phones as a wireless hotspot because my home wifi is down right now. |
| 23:43:37 | <iqubic> | I'm back now. |
| 23:44:15 | <ski> | one nice tutorial text is "Web Programming" by Eli Barzilay at <https://tmp.barzilay.org/cont.txt>, applying continuations to making web pages where you may fill in some forms (or just click on buttons), to load new pages with more forms, &c. |
| 23:45:18 | <iqubic> | I see. |
| 23:45:21 | <iqubic> | That's cool. |
| 23:46:24 | <ski> | continuations can be used as a low-level basis, explaining how you compile functions to something more primitive |
| 23:46:27 | × | mobivme quits (~mobivme@112.201.111.217) (Read error: Connection reset by peer) |
| 23:47:10 | <ski> | continuations can also be used as a programming idiom (continuation-passing style). the `Cont'/`ContT' (and `Codensity') monad capturess this |
| 23:48:41 | <iqubic> | What is codensity? |
| 23:48:42 | <ski> | just as a language may have primitive state side-effects (and exceptions, &c.), it may also have ditto for continuations. commonly called "first-class continuations". this amounts to, in the language, getting a hold of the implicit low-level continuations that the language is (or may be) compiled into. e.g. Scheme and SML/NJ. also some other systems (Ruby ?) has continuation support |
| 23:49:12 | <ski> | newtype Cont o a = MkCont ((a -> o) -> o) |
| 23:49:20 | <ski> | newtype ContT o m a = MkContT ((a -> m o) -> m o) |
| 23:49:28 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 23:49:37 | <iqubic> | I know what those are. |
| 23:49:38 | <ski> | newtype Codensity m a = MkCodensity (forall o. (a -> m o) -> m o) |
| 23:50:01 | <ski> | it hides the "answer"/"result" type, making it polymorphic |
| 23:50:12 | <iqubic> | Why would you want that? |
| 23:50:30 | <ski> | that means that you can't "play tricks" with it (stuff that makes continuation "fun"/"hard") |
| 23:50:47 | <iqubic> | I see. Makes sense. |
| 23:50:49 | <ski> | (well, you can still play tricks with the `m' part of the result type, just not the `o' part) |
| 23:52:00 | <ski> | by Yoneda's lemma, any type `a' is equivalent to `forall o. (a -> o) -> o' (and more generally, for any functor `f', `f a' is equivalent to `forall o. (a -> o) -> f o' .. which is called `Yoneda f a') |
| 23:52:14 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 23:52:37 | <ski> | since, the only thing you can do with a value of type `forall o. (a -> o) -> o' is specialize `o' to `a', and pass in `id' of type `a -> a', getting an `a' out |
| 23:53:03 | → | JeremyB99 joins (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) |
| 23:53:14 | <ski> | and, in the other direction, given an `x' of type `a', only way you can get an `forall o. (a -> o) -> o' is `\k -> k x' |
| 23:53:17 | <iqubic> | I don't know much about Yoneda's Lemma. Is it useful to know of that isomorpism? |
| 23:53:32 | <ski> | it's sometimes useful to know about, when refactoring types, yes |
| 23:53:43 | <ski> | (this is related to "Church" representation of data types) |
| 23:54:13 | <ski> | (it's e.g. used for one encoding of existentials) |
| 23:54:22 | <duncan> | oh god.. Church-encoding.. my rival |
| 23:54:35 | <iqubic> | does Coyoneda exist? |
| 23:55:22 | × | JeremyB99 quits (~JeremyB99@2600:1702:21b0:a500:b427:1e7a:fffe:f069) (Read error: Connection reset by peer) |
| 23:55:25 | <ski> | (or i should probably say "Boehm-Berarducci Encoding". see Oleg at <https://okmij.org/ftp/tagless-final/course/Boehm-Berarducci.html>) |
| 23:55:28 | <ski> | yes |
| 23:55:51 | <iqubic> | Coyoneda :: (b -> a) -> f b -> Coyoneda f a |
| 23:56:17 | <iqubic> | Where does the a go and where does the b come from? The hell?!?! |
| 23:57:09 | <iqubic> | This is the definition that Edward Kmett gives in his Kan-Extensions package. |
| 23:57:15 | <ski> | `a' is also equivalent to `exists s. (s,s -> a)' (and more generally, `f a' to `exists s. (f s,s -> a)', for `f' a `Functor') |
| 23:57:42 | <ski> | and that `exists s. (f s,s -> a)' is called `Coyoneda f a' |
| 23:57:56 | <ski> | (so-called (my words) "State encoding"9 |
| 23:57:57 | <ski> | ) |
| 23:58:11 | <iqubic> | That seems very simple. |
| 23:58:49 | <ski> | @quote GuySteele |
| 23:58:49 | <lambdabot> | GuySteele says: Some people prefer not to commingle the functional, lambda-calculus part of a language with the parts that do side effects. It seems they believe in the separation of Church and |
| 23:58:49 | <lambdabot> | state. |
| 23:58:54 | <ski> | @quote Haskell.separates |
| 23:58:54 | <lambdabot> | shapr says: Haskell separates Church and state |
| 23:58:58 | <ski> | @quote are.dual |
| 23:58:58 | <lambdabot> | ski says: I'd rather say that in Haskell, Church and State are dual |
| 23:59:22 | <iqubic> | That's such a good joke... |
| 23:59:32 | <iqubic> | @quote zzz |
| 23:59:32 | <lambdabot> | erg0t says: <erg0t> sebazzz, me plagias mi vida |
| 23:59:52 | <iqubic> | @quote getSum sleep |
| 23:59:52 | <lambdabot> | No quotes for this person. Just what do you think you're doing Dave? |
All times are in UTC on 2023-12-03.