Readit News logoReadit News
bPspGiJT8Y commented on 'It's better for humans in general': The 4-day workweek is closer than you think   marketwatch.com/amp/story... · Posted by u/jader201
Xenoamorphous · 2 years ago
I find it odd that everyone here is talking about productivity. Although I guess it's to be expected since posts about increasing productivity are popular in HN; lots of people here focusing on their careers I suppose.

Personally I find we work way too many hours. We spend the good part of 5 days a week (if we're lucky) at work, often literally all the daylight hours, at least in winter. I have to take my daughter very early in the morning to the nursery, then I can't see her until the evening.

I want to believe that future generations will look back and find this unconceivable, and I hope AI shows us the way.

bPspGiJT8Y · 2 years ago
I'd like to believe this too, but given that medieval peasants and antique slaves worked more or less the same hours as we do I'm quite pessimistic. Whenever we automate something they just come up with a new bullshit job that adds nothing to the standards of living, instead of reducing the workload for everyone.
bPspGiJT8Y commented on Algebraic Data Types for C99   github.com/Hirrolot/datat... · Posted by u/bondant
im3w1l · 2 years ago
I have mainly used them in Rust. They are nice I suppose, but nothing mindblowing.

To me it feels very similar to an interface (trait) implemented by a bunch of classes (structs). I have multiple times wondered which of those two approaches would be better in a given situation, often wanting some aspects of both.

Being able to exhaustively pattern match is nice. But being able to define my classes in different places is also nice. And being able to define methods on the classes is nice. And defining a function that will only accept particular variant is nice.

From my perspective a discriminant vs a vtable pointer is a boring implementation detail the compiler should just figure out for me based on what would be more optimal in a given situation.

bPspGiJT8Y · 2 years ago
> And defining a function that will only accept particular variant is nice

This is possible to achieve (or hack your way through, if you will) by parameterizing the type and using a nullary type (a type which is impossible to have) to exclude specific cases of a sum type. In Haskell this would look like this:

    data Weather a b c = Sunny a | Rainy b | Snowy c

    -- can't snow in the summer!
    onlySummerWeather :: forall a b. Weather a b Void -> String
    onlySummerWeather weather = case weather of
      Sunny _ -> "Got sunny weather"
      Rainy _ -> "Got rainy weather"
      Snowy v -> absurd v
where `absurd :: forall a. Void -> a` "if you give me something you can't ever have, I will give you anything in return".

bPspGiJT8Y commented on Binance founder Changpeng Zhao sentenced to four months in prison   cnbc.com/2024/04/30/binan... · Posted by u/SirLJ
nullc · 2 years ago
> But unlike FTX, Binance didn't flat out commit theft.

Is that true? I believed they took 'loans' out of customer funds then manipulated the markets to close the holes-- sounds a lot like what FTX was attempting but without being so amphetamine addled that they couldn't pull it off.

bPspGiJT8Y · 2 years ago
It is well known that Binance, among many other crimes, runs many internal trading desks which trade against Binance's own customers.
bPspGiJT8Y commented on Carapace: A multi-shell completion library and binary   carapace.sh/... · Posted by u/cab404
logicprog · 2 years ago
I tried to use this to get better completions with nushell, but it just doesn't have the breadth and depth of completions that fish has as of yet, nor does it have automatic completion generation from manages (although it does have a tool for that) so I eventually gave up and just made fish itself my nushell's completion engine. However I'll be keeping my eye on it, because it's a really cool idea to have a shared completion engine for all shells, so that everyone can pool their work, and because of course having to install two entire shells just to use one of them is a bit silly so eventually I'd like to make the switch.
bPspGiJT8Y · 2 years ago
> so I eventually gave up and just made fish itself my nushell's completion engine

That's an interesting idea. Do you have a link to show how you did this?

bPspGiJT8Y commented on Carapace: A multi-shell completion library and binary   carapace.sh/... · Posted by u/cab404
bongobingo1 · 2 years ago
I have had this snippet in my .zshrc for years,

    autoload -U compinit && compinit
    {
      # Compile the completion dump to increase startup speed. Run in background.
      zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
      if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
        # if zcompdump file exists, and we don't have a compiled version or the
        # dump file is newer than the compiled file
        zcompile "$zcompdump"
      fi
    } &!
Using `zmodload zsh/zprof`, I can see about 50% (16ms) of my start up is compinit (its about 28ms without the `zcompile`).

Do you have any pointers for the "load on tab" idea? I didn't turn up any good results in DDG and LLMs were just hallucinating.

BTW I believe `-C` will disable some cache checking, caching is enabled by default

> To speed up the running of compinit, it can be made to produce a dumped configuration that will be read in on future invocations; this is the default, but can be turned off by calling compinit with the option -D.

> ...

> ... The check performed to see if there are new functions can be omitted by giving the option -C. In this case the dump file will only be created if there isn't one already.

bPspGiJT8Y · 2 years ago
> BTW I believe `-C` will disable some cache checking, caching is enabled by default

You're right, my memory has let me down.

> Do you have any pointers for the "load on tab" idea? I didn't turn up any good results in DDG and LLMs were just hallucinating.

The simplest implementation would be something like

    bindkey ^I init_completions

    init_completions () {
      # ... init logic here ...

      # rebind tab to complete
      bindkey ^I complete-word
      # actually do complete the initial request
      zle complete-word
    }
Edit: I see now you already figured it out, yeah that's exactly what I meant

bPspGiJT8Y commented on Carapace: A multi-shell completion library and binary   carapace.sh/... · Posted by u/cab404
bbkane · 2 years ago
I tried this but couldn't get the completions to load. I think it's a really good idea though (much faster than zsh script completions), so hopefully soon I can retry the install and either get it working or open an issue.

One design aspect I do question is that completions are baked into the library. It'd be neat to have them in SQLite or something that could be updated independently (not sure how feasible that is though. I've never been any good at querying graphs like flag/command completions in SQLite).

bPspGiJT8Y · 2 years ago
> much faster than zsh script completions

I'm curious where did you get that from.

Edit: I read the note in your dotfiles repo. Yes calling `compinit` on each shell invocation is going to be really slow. That's not how you're supposed to do it, you could at least add the `-C` flag to cache the completions. Ideally you'd also use `zcompile` to compile the cache to ZSH word code. This puts my completions initializing time at ~20ms on a lower/mid-end laptop. Additionally you can do the trick `fish` does and defer the initialization of completions until the first hit of Tab key, so the impact on shell startup time is exactly 0.

bPspGiJT8Y commented on Tips on how to structure your home directory (2023)   unixdigest.com/tutorials/... · Posted by u/hggh
bPspGiJT8Y · 2 years ago
I'm shifting towards simply "not having" a home directory. Actual data is stored on other partitions, eg `~/git/project1` => `/git/project1`, `~/Pictures/Wallpapers` => `/data/Pictures/Wallpapers`, etc. The shell can be set up to spawn in some custom directory, $CDPATH can be altered for quicker navigation or completions, configurations are managed by Nix so I simply don't have a reason to look at my $HOME that often.

Programs can pollute it all they want, since I don't use it myself I also don't have to care about that.

bPspGiJT8Y commented on Fast, Declarative, Reproduble and Composable Developer Environments Using Nix   devenv.sh/... · Posted by u/domenkozar
bPspGiJT8Y · 2 years ago
Not fast at all in my experience. Just running (for the first time) what would take seconds with something like `asdf` could take up to half an hour with Nix.
bPspGiJT8Y commented on How much faster are the Gnome 46 terminals?   bxt.rs/blog/just-how-much... · Posted by u/janvdberg
bPspGiJT8Y · 2 years ago
Gnome terminal would also need some unicode handling improvements, its current score in `ucs-detect` rating is D-[0].

[0] https://ucs-detect.readthedocs.io/results.html

bPspGiJT8Y commented on Currying   wiki.haskell.org/Currying... · Posted by u/peter_d_sherman
ivanjermakov · 2 years ago
Could you share an example?
bPspGiJT8Y · 2 years ago
This function would use an anonymous record:

    splitString :: { pattern :: String, string :: String } -> Array String
    splitString { pattern, string } = ...
This function would use positional arguments:

    splitString :: Pattern -> String -> Array String
    splitString pattern string = ...

u/bPspGiJT8Y

KarmaCake day38April 14, 2023View Original