gchristensen changed the topic of #nixos-chat to: NixOS but much less topical || https://logs.nix.samueldr.com/nixos-chat
<Yaniel> else they wouldn't allow walmart to do transactions with that money
<Tjowers> Only Visa has to know -- Visa mediates everyting, Visa or Mastercard or whatever banking network
<Tjowers> They are a proxy
<Tjowers> Between all transactions -- both a foreward and reverse proxy
<Yaniel> every bank that accepts transfers from/to another bank has to know
<Yaniel> there are other transfers than visa and mastercard
<Tjowers> Ah yes so if I have a credit card that's assigned to the visa network -- it's decoupled from the other networks
<Yaniel> yes but what if I send you a wire transfer
<Yaniel> no credit cards involved
<Yaniel> the banks still have to agree that it happened
<Yaniel> and all other banks you might be doing business with too
<Tjowers> Great question
<Tjowers> Looks like there's two ways
<Tjowers> One has more availability it's where you're bank goes through the Federal Reserve -- or more generally a Real-Time-Gross-Settlement System
<Tjowers> More than two ways sorry!
<Tjowers> These are most common I think
<Tjowers> Generally there's two services offered: Real Time Settlement and Periodic Netbalance
<Tjowers> One is in real-time the other is batched periodically
<Yaniel> that is not relevant to the consensus question
<Yaniel> if you read the International section, it's basically a hierarchical distributed thing
<Yaniel> AFAIK if a transfer happens within a single bank that's the end of that, if it happens across banks under one of the seven central banks, that overseeing central bank and all banks under it have to agree that the transaction happened
<Tjowers> Right we've lost where we were -- the idea is that current currency exchanges are flawed, why try to match the standard's that blockchain promises with decentralization, why worry about that, when there's already so much more room for improvement in centralized systems -- this is what I'm beginning to come to conclude -- so consistency via
<Tjowers> chronological GUUID?
<Tjowers> Right? It's doable with a some concept of a central system
<Yaniel> if your transfer crosses into the jurisdiction of another central bank, all banks up to your central bank, all central banks and all banks down from the recipients central bank would have to agree
<Yaniel> what even is a chronological GUUID
<Tjowers> A globally unique identifier based on time
<Tjowers> As in, given this UUID and this UUID you can distinguish order
<Tjowers> Could be just appending a timestamp to a SHA
<Yaniel> well you have the recipient and the sender and, the time in UTC and the amount transfered
<Tjowers> Solid
<Tjowers> Would this be considered a centralized bank? National banks need to get FDIC approval which requires 1 million in assets -- but would it be a bank?
<Yaniel> just take those as-is
<Tjowers> Think -- currency is the exchange of value
<Yaniel> no need for hashing (and thus no risk of collisions)
<Tjowers> If I offer you my cat, and I ask for your dog, are we making a transaction?
<Tjowers> Is a transaction defined at some threshold of value?
<Tjowers> Then how is value defined?
<Yaniel> you are a bit too high for this I think
<Tjowers> Lmao
<Yaniel> high on abstraction levels at least
<Tjowers> I just want to make sure no legal argument can take it down
<Yaniel> then talk to a lawyer
<Yaniel> if you offer me your cat and I take it that would be a transaction by most definitions I think
<Tjowers> The only thing that prevents a cryptocurrency from being used is whether or not the store up the street will take it and give you a gallon of milk
<Yaniel> what is relevant for the topic of banks & consensus is that if you offer your cat to someone else after that, they need to know that you don't actually have a cat
<Tjowers> Right -- Good thinking
drakonis has quit [Ping timeout: 248 seconds]
<Yaniel> so if you are askign something from them in return they would be getting ripped off
<Tjowers> Right so the idea of credit in digital currencies
<Yaniel> whether you received something from me is unimportant there
<Yaniel> or actually it's not
<Yaniel> if did actually get another cat from me in return, offering *that* cat to someone else would be perfectly fine
<Tjowers> As long as there is "Consideration"
<Yaniel> the other person just needs to be able to ascertain that you have what you claim to have
<Tjowers> Ok I'm going to do some research
<Yaniel> good, I'm going to sleep
<Tjowers> Lmao goodnight!
<Yaniel> o/
Yaniel has left #nixos-chat ["WeeChat 2.7-dev"]
Synthetica has quit [Quit: Connection closed for inactivity]
ravndal has quit [Ping timeout: 268 seconds]
drakonis1 has joined #nixos-chat
wildtrees has quit [Quit: Leaving]
* colemickens is over python
ravndal has joined #nixos-chat
endformationage has quit [Quit: WeeChat 2.6]
fuzen has quit [Ping timeout: 246 seconds]
fuzen has joined #nixos-chat
drakonis1 has quit [Quit: WeeChat 2.6]
<ashkitten> what's the advantage of a bump allocator vs stack allocation?
<ashkitten> since they're essentially the same thing, right?
fuzen has quit [Ping timeout: 268 seconds]
Tjowers has quit [Remote host closed the connection]
Synthetica has joined #nixos-chat
__monty__ has joined #nixos-chat
evanjs has quit [Read error: Connection reset by peer]
evanjs has joined #nixos-chat
waleee-cl has joined #nixos-chat
avn has quit [Read error: Connection reset by peer]
<elvishjerricco> ashkitten: I might be misunderstanding your question, but an allocation with a bump allocator can outlive the stack frame it was allocated during.
psyanticy has joined #nixos-chat
drakonis1 has joined #nixos-chat
<pie_[bnc]> drakonis1: you are yet to cross-link https://github.com/NixOS/nixpkgs/issues/57833 anywhere so i dont know the other threads :P
<{^_^}> #57833 (by deliciouslytyped, 44 weeks ago, open): Additional meta-information conventions
<drakonis1> ah, right.
<drakonis1> i have noot posted a issue yet
<joepie91> noot nooit
<joepie91> noot noot*
<joepie91> bleh, typo spoiled the joke
drakonis1 has quit [Ping timeout: 246 seconds]
drakonis1 has joined #nixos-chat
<drakonis1> noot noot
endformationage has joined #nixos-chat
drakonis1 has quit [Ping timeout: 260 seconds]
wildtrees has joined #nixos-chat
<ashkitten> elvishjerricco: ah i see
Jackneill has quit [Read error: Connection reset by peer]
drakonis1 has joined #nixos-chat
wildtrees has quit [Ping timeout: 265 seconds]
psyanticy has quit [Quit: Connection closed for inactivity]
Synthetica has quit [Quit: Connection closed for inactivity]
Synthetica has joined #nixos-chat
drakonis1 is now known as drakonis
<elvishjerricco> Wtf. Shouldn’t this work? `(echo foo | read bar; echo “$bar”)`
<elvishjerricco> I get a blank line of output
<ajs124> works in zsh, doesn't work in bash. apparently.
<cransom> suppose in bash it's reading your $bar when the command starts rather than in the subshell
<elvishjerricco> cransom: That sounds odd.... Does bash parse... by the line?
<ajs124> seems more like an issue with read. echo foo | read bar\n echo $bar doesn'r work either
<__monty__> ajs124: Hmm, separate commands works for me.
<elvishjerricco> Not for me
<__monty__> I agree that it seems variable expansion happens before executing any of the commands.
<__monty__> elvishjerricco: `echo foo | read bar` followed by `echo $bar` doesn't output anything for you?
<elvishjerricco> __monty__: Correct
<ajs124> __monty__: doesn't for me, either
<elvishjerricco> Even if I put those two lines in a script and run `bash foo.sh`
<elvishjerricco> I’m so confused
<__monty__> Yeah you're right, doesn't work in bash.
<ajs124> bash with set -u actually terminates with "test.sh: line 4: bar: unbound variable"
<elvishjerricco> Wtf
<elvishjerricco> Apparently read is just deliberately not supposed to be used with a pipe
<cransom> i can `read bar <<<foo` ... weird.
<elvishjerricco> Yea that works. `read <<<$(some command)` works
<elvishjerricco> That’s some junk
<ajs124> read test < <(echo "hello world") should also work
<ajs124> bash is such a beautiful language
<eyJhb> ajs124: why are we messing with Bash?
<ajs124> reminds me of this script I wrote that parsed and reexecuted itself. I think someone rewrote it, because that's "bad design" and "not very maintainable". Pff, some people just don't appreciate art.
<elvishjerricco> ajs124: Yea that worked too
<elvishjerricco> eyJhb: I was trying to figure out why I couldn’t pipe into `read`
<eyJhb> Ah
<eyJhb> are you doing anything fun with it elvishjerricco ?
<elvishjerricco> eyJhb: Just trying to send a terabyte of data to a server :P
<eyJhb> elvishjerricco: with read??? :p
<__monty__> ajs124: My tmux setup scripts call themselves. My irc client's invoked in one of these. I have tmux-fork bombed myself. And I've gotten myself banned from irc networks because of this >.<
<elvishjerricco> Using zfs send. I want it to be resumable, and I’m having fun playing with pv and zfs receive -s. Making a script to automatically get the resume token and the estimated size of the send so pv can show an ETA
<elvishjerricco> Overengineering, sure. But also just havin fun :P
<eyJhb> elvishjerricco: rsync??
<elvishjerricco> eyJhb: rsync would be horrendously slow for this task
<elvishjerricco> tons of small files
<elvishjerricco> resuming would be a nightmare perf wise
<infinisil> Yeah zfs send/recv is the way to go!
<ajs124> __monty__: oh no. That's why I recently switched from a kinda janky IRC setup (xmpp bridge) to an extremly questionable one (matrix bridge). That way, if I get banned, I can at least blame somebody elses nodejs code.
drakonis has quit [Ping timeout: 272 seconds]
<elvishjerricco> I’m already rate limiting this to keep it from annoying other users of these networks, and it’s gonna take about a week with zfs send
<eyJhb> elvishjerricco: why all those small files?
<elvishjerricco> eyJhb: It’s an apple sparse image. Literally a disk image where every 4k block is a file
<infinisil> elvishjerricco: How do you do rate-limiting?
<elvishjerricco> infinisil: `pv -L 1.5M` will limit to 1.5MB/s
<infinisil> Oh nice
<ajs124> elvishjerricco: instead of rate limiting, you could just run that tcp flow with something like LEDBAT.
<cransom> piping through mbuffer is also nice and has rate limiting
<elvishjerricco> ajs124: I don’t know what that means :P
<infinisil> elvishjerricco: I wouldn't mind seeing what you come up with in the end
<gchristensen> LEDBAT is also good for getting around crypto
<gchristensen> oh that is a different thing
drakonis has joined #nixos-chat
<elvishjerricco> cransom: Yea I’ve got mbuffer on the other side for a memory buffer. I prefer pv’s visual output though, and I don’t think mbuffer can show an ETA
<pie_[bnc]> elvishjerricco: poke me when you made your thing :P i want to look at it
<__monty__> gchristensen: Getting around crypto?
<elvishjerricco> pie_[bnc], infinisil: It WILL be ugly lol
<elvishjerricco> But will do
<eyJhb> elvishjerricco: what is your speed?
<infinisil> Eventually I'll develop my own zfs backup/sync tool, so I'll have to implement something like this too then :)
<eyJhb> 1.5MB/s doesn't seem like too much
<__monty__> How do I use LEDBAT with rsync?
<pie_[bnc]> i didnt check all the scroll, sanoid *might* be interesting https://github.com/NixOS/nixpkgs/pull/72060
<{^_^}> #72060 (by lopsided98, 12 weeks ago, open): sanoid: add package, NixOS module and test
<pie_[bnc]> infinisil: I Have Ideas (tm)
<elvishjerricco> eyJhb: I’m going over the internet between two homes that only get like 6MB/s down or up
<gchristensen> __monty__: typically any sturdy object you can swing is good for getting around crypto
<elvishjerricco> in practice that is
<pie_[bnc]> infinisil: i hope i took some notes though because i dont remember what they were...
<ajs124> __monty__: You probably don't, sadly. I'm not sure Linux lets you switch the TCP congestion control algorithm for a single application/socket trivially.
<infinisil> pie_[bnc]: I have ideas too, I even wrote a proposal for it for a potential bachelors thesis :)
<__monty__> gchristensen: A rubber hose code breaking?
<pie_[bnc]> infinisil: i dont remember you sending me that
<infinisil> Yeah I didn't, I think
<pie_[bnc]> :P send plox
<__monty__> *Ah
<__monty__> ajs124: Does macOS?
<ajs124> __monty__: actually, apparently that does exist. Hm. I should hack up some helper program that LD_PRELOADs a wrapper that does that.
<pie_[bnc]> infinisil: also maybe talk to edef if you ever ever want to actually do that, im about 80% sure youll have some overlapping interests about that
<ajs124> Being able to have something as background traffic is probably handy every now and then.
<infinisil> pie_[bnc]: https://public.infinisil.com/zfssync.pdf What are your ideas?
<eyJhb> elvishjerricco: makes sense :)
<eyJhb> I would prop have dine something like 2-3, but if it is unstable, thne it makes sense
<__monty__> ajs124: Wiki seems to suggest bittorrent makes use of LEDBAT. So it seems like it's certainly possible in code? Unless that's just a custom UDP transport.
<elvishjerricco> eyJhb: I actually came up with 1.5 by deciding I wanted it to take 1 week and determining the appropriate rate
<eyJhb> elvishjerricco: I would have given up on that task
<eyJhb> How far is the distance between the homes? :p
<elvishjerricco> eyJhb: Not far but I don’t wanna take this disk offline to move it elsewhere, since it’s a part of my backup strategy. Wanna keep the time machines and znapzends going
<infinisil> pie_[bnc]: I also wrote a bash prototype of this somewhere, and I started with a haskell version of it too (though I kind of got stuck coding a good zfs library for haskell)
<elvishjerricco> infinisil: A good zfs lib for haskell would be amazing
<ajs124> __monty__: yeah, bittorrent is over UDP as far as I remember
<infinisil> elvishjerricco: If I were to write one it would use the CLI, not actual C library bindings
<elvishjerricco> infinisil: Oh for sure. The library would be a pain in the ass
<infinisil> elvishjerricco: Because this allows using it for remote machines too, and tbh interacting with a C library is awful
<elvishjerricco> And you wanna be able to connect to ssh hosts and manage them as well
<elvishjerricco> yea
<infinisil> :D
<eyJhb> elvishjerricco: get the other disk to it! :D
<elvishjerricco> eyJhb: That disk is no more, unfortunately. The machine died, and the local backup disk is now the only existing copy (long story), so I’m trying to copy it to the remote backup location
<ajs124> __monty__: You can just compile and load this random kernel module from github: https://github.com/silviov/TCP-LEDBAT :P
<eyJhb> elvishjerricco: meant take the remote disk and shove it into the backup server :p But I might have misunderstood how remote it is
<elvishjerricco> eyJhb: Oh it’s not far. It’s just that I don’t want the local backup disk to be unavailable locally for any amount of time because there are still machines using it
<eyJhb> But can't you transfer it locally without taking it down (LAN), and then tranfer it to the remote?
<__monty__> ajs124: Is there a negative consequence to using LEDBAT for all TCP traffic?
<eyJhb> elvishjerricco: sorry for trying to solve a problem that doesn't need solving, just curious :D
<elvishjerricco> eyJhb: Not sure what you mean by “transfer it locally”
<ajs124> __monty__: yes. Your traffic will be drowned out by anyone else on the same (bottlenecked) link.
<ajs124> If you don't care about that, then probably no?
<eyJhb> elvishjerricco: over LAN, if the backup server that shouldn't be down is at "home", then taking a disk to it, transfer to it using LAN (so you get that sweet sweet gigabit connection), and then take it to the location where it should go
<eyJhb> Then there is zero downtime, and you get the files faster
<elvishjerricco> eyJhb: So you’re suggesting moving the remote disks to the local location and doing the copy there?
<elvishjerricco> to clarify: I’m copy data from local to remote
<eyJhb> elvishjerricco: yeah pretty much, if there isn't that big of a distance
<eyJhb> (YOU) LOCAL ----WWW----> Remote
<eyJhb> WWW => WAN, whatever :p
<elvishjerricco> eyJhb: Wait, why is WWW involved in you’re suggesting moving the remote server to the local network?
<eyJhb> That was your current setup, right?
<elvishjerricco> eyJhb: Yea
<elvishjerricco> I’m currently trying to do it over the internet
<pie_[bnc]> ZFS is a PITA because they dont f***ing provide a public api <elvishjerricco> infinisil: A good zfs lib for haskell would be amazing
<elvishjerricco> eyJhb: There’s one pedantic theoretical problem, which is “you don’t want to risk breaking the remote backup system while moving it to and from the local place”. But the actual reason I don’t want to do that is that the remote server is physically very heavy and I’d have to go up or down 4 flights of stairs each way :P
<pie_[bnc]> the situation AFAIU has been improving however, because they started working on exposing some stuff
<elvishjerricco> pie_[bnc]: There is libzfs but I dunno if it’s stable or anything
<infinisil> pie_[bnc]: I think they do?
<eyJhb> Yeah, so take remote disk to you (local) and then copy it there using either LAN so you get gigabit or directly attached to the server
<eyJhb> And then move it again to the remote location
<pie_[bnc]> theres a python library - ah yeah, libzfs is it - that implements _SOME_ functionality
<eyJhb> elvishjerricco: don't you have a single 1 TB disk to spare? :D
<infinisil> Pretty sure there's a C library
<pie_[bnc]> this is one of my frustrations with zfs
<pie_[bnc]> the C library is what im talking about as being pretty limited IIRC
<elvishjerricco> eyJhb: That would be the simple solution :P
<pie_[bnc]> i guess i should have made a gist when i was still researching this or something
<elvishjerricco> I do not have any spare disks unfortunately
<pie_[bnc]> yes thats what im talking about probably but it may have improved
<pie_[bnc]> a lot of funcitonality is in the frontend tools though i think
<pie_[bnc]> anyway i dont have anything more tangible to say about it right now other than
<infinisil> Hm, haven't checked it out much myself
<pie_[bnc]> "it sucked last time i looked at it" "but the situation may have improved!"
<eyJhb> elvishjerricco: damn...
<infinisil> But yeah, I'd use the CLI for a haskell library anyways
<eyJhb> If I had anyone to spare I would send them
<eyJhb> Who was it I talked to regarding Raspberry Pi's?
<eyJhb> Also, good cat names to a female kitten?
<pie_[bnc]> its not much but it works modulo some bugs https://github.com/deliciouslytyped/zfstui
<pie_[bnc]> note that zfstui is only for looking at info, it doesnt let you poke anything yet
<pie_[bnc]> that link is a fork of the original using py libzfs, whereas the original uses the cli tools
<pie_[bnc]> the python library is not actively extended because its specifically used for one of the NAS projects
<pie_[bnc]> but PRs welcome
<pie_[bnc]> IIRC
<pie_[bnc]> i thin the python library might in fact be generating bindings to the c library though
<pie_[bnc]> cant remember
<pie_[bnc]> convince the zfs people to make a properlt machine readable cli instead of having to parse stuff out :P though theyve basically locked themselves into the output format alread specifically because now they have to expect people to be parsing that <elvishjerricco> And you wanna be able to connect to ssh hosts and manage them as well
<elvishjerricco> infinisil, pie_[bnc]: ^ Here’s my ugly script
<pie_[bnc]> infinisil: my ideas involved a DSL for specifying...I dont remember what. which is the problem. :P though it didnt really crystallize to begin with
<pie_[bnc]> infinisil: probably stuff about backup schemes and idk
<pie_[bnc]> probably because linux style CLIs are hard
<elvishjerricco> It needs to be run as root, and assumes you’ve started the send manually once before
<pie_[bnc]> im not sure.
<elvishjerricco> with receive -s
<infinisil> pie_[bnc]: Neat
<pie_[bnc]> elvishjerricco: can you add a short comment explaining what this is so that when i look at the tab again in 6 months i know what it is? :D
<pie_[bnc]> infinisil: oh hey i added nix expression. does it even work.
<elvishjerricco> pie_[bnc]: Done :)
<pie_[bnc]> yay
<pie_[bnc]> \o/ :3
<pie_[bnc]> infinisil: wow you got it fancy two-column and everything. why are all my friends so OP
<infinisil> lol
<elvishjerricco> I’m only like 90% confident that my script took less time to write than I saved by avoiding rsync :P
<pie_[bnc]> wow thats really high confidence actually
<infinisil> > xkcd 1319
<infinisil> > xkcd 1205
<elvishjerricco> I am 100% confident I spent more time writing this script than resuming manually would have taken lol
<elvishjerricco> I doubt i'll even need to resume once
<infinisil> pie_[bnc]: elvishjerricco: Idea: How about a joint effort between us three to create a good zfs library for Haskell?
<elvishjerricco> infinisil: I'm thinking a good ZFS backup tool would use receive -s, and probe the destination to see if it has a receive token to resume before continuing normal operation.
<elvishjerricco> infinisil: Sounds fun
<infinisil> Yeah that's something I'd want it to do
<pie_[bnc]> infinisil: so who's going to write the c library
<eyJhb> *not it*
<infinisil> pie_[bnc]: No, CLI based
<pie_[bnc]> or somene else gets to parse the damn CLI ouput, because no matter how practical it is i still think its dum :(
<pie_[bnc]> but then what do you put in the rest of it
<pie_[bnc]> what is the part of the library that isnt parsing zfs tools xD
<infinisil> The Haskell interface
<pie_[bnc]> re: checking if there is an existing token, yeah i dont get why thats not built in tbh https://github.com/zfsonlinux/zfs/issues/9150
<{^_^}> zfsonlinux/zfs#9150 (by deliciouslytyped, 23 weeks ago, open): Is resuming a -R replication supported?
<pie_[bnc]> i mean yeah ok its one-way, but mehhh
<pie_[bnc]> how many times do you think people reimplemented that
<pie_[bnc]> I Have Opinions
<infinisil> Well this could be implemented in a Haskell ZFS library :)
<infinisil> I think
<infinisil> Anyways, would you want to participate pie_[bnc]?
neeasade has joined #nixos-chat
<neeasade> hello all
<pie_[bnc]> infinisil: i guess but i have no time right now and i suck at programmin
<pie_[bnc]> xP
<neeasade> I'm tryin to package what should be a simple script and am misunderstanding the installPhase I think
<infinisil> pie_[bnc]: You can be QA :P
<infinisil> neeasade: #nixos is the place to ask
* pie_[bnc] stamps "participation award" on forehead :D \o/
<neeasade> infinisil: thanks
<pie_[bnc]> neeasade: good luck!
wildtrees has joined #nixos-chat
<infinisil> elvishjerricco: Have you ever written a haskell library before?
<pie_[bnc]> if it doesnt have monad transformers its not library enough
<pie_[bnc]> jkjk ;_;
<infinisil> Ohh I should've checked elvishjerricco's github profile, he's pretty active with haskell :)
<pie_[bnc]> :O
<pie_[bnc]> infinisil: a project doesnt exist until theres an irc channel for it
<infinisil> Ohh and I think he does GHC development too? IIRC
<elvishjerricco> infinisil: Not so active the past year but yea I'm very familiar with haskell
<elvishjerricco> I've done a bit with GHC
<elvishjerricco> It's a messy codebase but my changes were minimal
<infinisil> Neat, yeah I also haven't been too active with haskell in recent months
wildtrees has quit [Max SendQ exceeded]
<pie_[bnc]> woahhh
<elvishjerricco> I helped out with haskell.nix for a while too
* pie_[bnc] mind blown
<elvishjerricco> I'm the reason they used the NixOS module system :P
wildtrees has joined #nixos-chat
<infinisil> Ah nice!
<elvishjerricco> Wrote the plan-to-nix stuff
<infinisil> I'm also a big fan of the module system :D
<pie_[bnc]> oh TWO module experts one library
<pie_[bnc]> *haskell library
<pie_[bnc]> (i think you guys should just write it in the module system...)
<infinisil> A haskell library written in Nix? Sure!
<pie_[bnc]> profpatsch has things for that...
<pie_[bnc]> i sat next to him while he glued some stuff together in like 4 different language and nix
<pie_[bnc]> his colleague was not pleased
<infinisil> Hehe
<pie_[bnc]> "is this what my work codebase is going to look like now?"
<infinisil> elvishjerricco: Have you used effect libraries before?
<elvishjerricco> infinisil: I have. I don't bother anymore. Too many problems for no practical benefit
<elvishjerricco> I've made one
<elvishjerricco> Fraxl
<elvishjerricco> Was supposed to be an upgraded Haxl
<infinisil> I think the newish polysemy (https://hackage.haskell.org/package/polysemy) has great potential
<pie_[bnc]> it even seems usable
<infinisil> I've used it a couple times already, and it's been pretty nice
<pie_[bnc]> i keep wanting to use type system fanciness even though it seems like preemptive foot shooting
<infinisil> Good error messages, fast (with GHC 8.10), good type inference (with a plugin)
<pie_[bnc]> you prevent yourself from having errors by preventing yourself from ever getting a compiling project because you cant write anything to begin with
<pie_[bnc]> ...but maybe thats just me
<jackdk> I'm still comfy with mtl, waiting for a clear winner to emerge
<pie_[bnc]> IIRC polysemy looked usable when i looked at it. theres a quite operatively-understandable blog post tutorial. but i didnt understand if you have to evaluate effects on loop or what
<infinisil> polysemy even has an interaction layer to mtl
<pie_[bnc]> like, what if you use up some effects and then add more of that effect later
<infinisil> pie_[bnc]: Have you ever used an effect library?
* pie_[bnc] didnt get around to actually writing any code, as usual
<pie_[bnc]> infinisil: i went from reading about free monads to "screw it we're going all the way. whats all the way? ok effects."
<__monty__> 8.10 isn't even out yet?
<infinisil> Yeah, though I'm not entirely sure how much overlap there is between free monads and effect systems
<infinisil> __monty__: Nah, 8.8.2 just came out
<__monty__> But you said polysemy is fast with 8.*10*?
<infinisil> __monty__: 8.10 will be the next release
<__monty__> Yeah, so how do you know polysemy will be fast on that?
<infinisil> The author of the library contributed a patch to GHC that does some optimizations to make that library fast
<infinisil> They tested it with the HEAD version at the time
<infinisil> To make sure the optimizations actually did work for it
<infinisil> And the 8.10 branch was then later created from master
pie_ has joined #nixos-chat
pie_[bnc] has quit [Quit: No Ping reply in 180 seconds.]
<{^_^}> polysemy-research/polysemy#307 (by KingoftheHomeless, 3 days ago, open): v2 roadmap
pie_ has quit [Quit: pie_]
<infinisil> elvishjerricco: Anyways, I'd like to use polysemy for such a library, maybe you can take a look at it, see if you like it :)
<infinisil> I think it would make for a great interface
<elvishjerricco> infinisil: IIRC, it doesn't solve the main usability problem, which is nonalgebraic effects
<__monty__> Does any approach to effects solve that? Sounds rather impossible.
<elvishjerricco> Stuff like `catch` or `listen` often don't work as you'd expect
<elvishjerricco> __monty__: Thats exactly why I stick with mtl` style :P
<infinisil> elvishjerricco: I'm not entirely sure what that is, but I believe it does
<elvishjerricco> infinisil: For instance, trying to throw an error to the exception effect from within your interpreter is not going to be catchable by the user code
<elvishjerricco> Iirc that's a fundamentally unsolvable problem
<infinisil> Hm, that doesn't help very much for my understanding
<elvishjerricco> infinisil: the gist is that you can make effects with operations that *look* like they take an action as an argument and augment its behavior, but it'll never be able to work correctly with the interpreter's behavior
neeasade has quit [Ping timeout: 272 seconds]
<infinisil> Wouldn't that depend on the effect whether it can be implemented correctly?
<__monty__> elvishjerricco: You stick to mtl because no other approach deals with that problem either and that would be the only reason for you to switch?
<elvishjerricco> infinisil: No. This issue touches on the subject w.r.t. fraxl, and I believe it’s fundamental to effects systems https://github.com/ElvishJerricco/fraxl/issues/5
<{^_^}> ElvishJerricco/fraxl#5 (by themoritz, 1 year ago, open): Catching errors thrown in the fetch functions
<elvishjerricco> __monty__: I mean there’s a couple reasons, but that’s one of them
<infinisil> I'll try to replicate an example from there in polysemy
<elvishjerricco> infinisil: The fundamental issue is that you can’t actually do non-algebraic effects. Functions that look like non-algebraic effects are usually implemented by re-interpreting the effect within the application code, rather than using the intended interpreter. So errors thrown by the interpreter aren’t caught by this separate nested interpreter. Same thing should happen to `listen`
<elvishjerricco> `local` could probably work though
<elvishjerricco> The biggest thing is that there’s not really a point though. Mtl does the same thing faster and more idiomatically.
<elvishjerricco> and gets non-algebraic effects correct
<elvishjerricco> And I haven’t tested it, but I suspect polysemy’s perf claims are somewhat exaggerated.
<elvishjerricco> It *should* be perfectly fast if the entire program inlines to one body and the optimizer likes you
<elvishjerricco> But as soon as there’s any indirection, interpreters start being passed and invoked dynamically, which will start ruining the performance.
<infinisil> Yeah I think the idea is to put INLINE's everywhere
<elvishjerricco> Now MTL has a similar perf limitation where if functions don’t get specialized, you start passing dictionaries which is similarly bad.
<elvishjerricco> But interpreters always also use a case statement, whereas mtl style just executes the right thing implicitly
<elvishjerricco> But specialization is more likely than inlining
<elvishjerricco> And probably easier on the code generator and optimizer in terms of compiler performance
<elvishjerricco> TL;DR: I’d rather not use polysemy unless these concerns can be comprehensively destroyed :P
<infinisil> elvishjerricco: Example of a non-algebraic effect with mtl?
<elvishjerricco> infinisil: `catch` and `listen` are the easiest examples
<elvishjerricco> infinisil: but `reflex-dom` has COUNTLESS non-algebraic effects
<infinisil> What catch?
<elvishjerricco> Attempting to implement `reflex-dom` with an effect system would either be disastrous or impossible
<elvishjerricco> infinisil: I may be misremembering the name. The one in the `MonadError` class
<elvishjerricco> `catchError`
<infinisil> I'm not a fan of mtl because of how patchy and tedious it feels to use your own Monads
<elvishjerricco> infinisil: Yea, it’s annoying but there’s nothing that pragmatically gets in the way, like with effects systems. Just feels a little gross.
<elvishjerricco> Elegance vs pragmatism. The constant Haskell struggle :P
<elvishjerricco> Mostly I just try to stay out of monadic code :P
<elvishjerricco> It’s a problematic pattern anyway.
<infinisil> Sometimes it's the right thing though
<infinisil> Or often even
<infinisil> The world is rather sequential after all
<gchristensen> agreeing on the sequence, though, is a different matter
<elvishjerricco> infinisil: Yea but sometimes I prefer stuff like `runZFSCommand (Get ...)` over a composable monadic approach. Much simpler to program. Mostly I prefer to look for Applicative solutions. That class is glorious
<elvishjerricco> Like `runZFSCommand :: ZFSCommand a -> IO a` rather than `zfsGet :: ZFS m => Arg -> m Ret`
<elvishjerricco> Maybe not in this case, but you get the idea
<elvishjerricco> Arrow based interfaces would be amazing if anyone could figure out how to get them to work without just being monads :P
<infinisil> elvishjerricco: Hm so I just created a test for this comparing polysemy and mtl, based on the first example in https://github.com/ElvishJerricco/fraxl/issues/5#issuecomment-373661188
<infinisil> Both result and result2 error out, the error couldn't be caught
<infinisil> Is that a valid test or did I mess something up?
__monty__ has quit [Quit: leaving]
<elvishjerricco> infinisil: Don't you need to be using `throwError` or something, not `error`?
<infinisil> Ohh
<infinisil> Just noticed that too
<infinisil> elvishjerricco: Oh, polysemy doesn't throw an error then!
<infinisil> I pushed the updated code
<infinisil> Evaluates to `Right 1` then
<infinisil> Oh wait
<elvishjerricco> I get a type error of some kind...
<infinisil> I also didn't used mtl's correct error
<infinisil> I just threw that repo together in a minute, no compile guarantees :P
<elvishjerricco> infinisil: How are you testing this if it doesn't compile? :P
<infinisil> elvishjerricco: Try `cabal repl`
<elvishjerricco> Also what GHC version are you using?
<infinisil> ghc version from the shell.nix
<elvishjerricco> Oh gosh, what does the polysemy plugin do?
<infinisil> Some type inference so you don't need to write explicit types everywhere
<elvishjerricco> Ah, it fixes the type error I got :P
<infinisil> :D
<infinisil> I'm not sure how one would use throwError instead of error in the mtl example
<elvishjerricco> infinisil: You're also using `error` for the mtl example, which again is wrong :P
<elvishjerricco> and were passing the `error` as the env for reader?
<infinisil> Oh
<infinisil> Damn argument order!
<infinisil> elvishjerricco: Would love to know how to get the mtl test to work
<infinisil> mtl isn't my strongsuit
<elvishjerricco> infinisil: I think the analogous mtl program would be one with a `MonadResource` and `ResourceT` whose interpreter calls `throwError`
<elvishjerricco> Lemme try...
<elvishjerricco> infinisil: I'm surprised the polysemy code got the right result
<elvishjerricco> I think that's exactly the thing I thought wasn't possible :P
<elvishjerricco> Lemme try with dumb ole Free
<infinisil> Hehe, I think polysemy has some pretty smart effect threading/weaving to do it properly
<infinisil> elvishjerricco: I think that's what these are for: https://hackage.haskell.org/package/polysemy-1.2.3.0/docs/Polysemy.html#g:12
<elvishjerricco> infinisil: Yea IIRC it just translates your effects into mtl style. So maybe the mtl comes through for that
<infinisil> Perhaps
<infinisil> elvishjerricco: So, maybe let's give polysemy a go after all? :D
<elvishjerricco> infinisil: Lemme verify this is demonstrating the problem we think it's demonstrating :P
<infinisil> Alright :)
Synthetica has quit [Quit: Connection closed for inactivity]
<elvishjerricco> So this adds a freer-simple example
<elvishjerricco> which behaves differently than polysemy
<elvishjerricco> Returns `Left "bar"`
<elvishjerricco> Which means yea, polysemy has at least *partially* solved the problem. I'd have to do more digging to see if it's completely solved
<infinisil> Cool :D
<elvishjerricco> infinisil: Still, I'd wager a ZFS lib would likely do well existing solely in IO