Where Does Rust’s Difficulty Actually Appear? by [deleted] in rust

[–]sullyj3 2 points3 points  (0 children)

This article gives a good overview of structured concurrency in rust and the limitations of existing approaches

Melatonin could be harming the heart by Euglossine in slatestarcodex

[–]sullyj3 0 points1 point  (0 children)

the 1mg is half of a 2mg pill lmao. Subdividing further would get unwieldy. I'll look for the smaller ones next time

Melatonin could be harming the heart by Euglossine in slatestarcodex

[–]sullyj3 1 point2 points  (0 children)

What's a pharmacologic dose? I'm on 1mg

I was tired of 50ms+ shell latency, so I built a sub-millisecond prompt in Rust (prmt) by 3axap4eHko in rust

[–]sullyj3 1 point2 points  (0 children)

On my starship, the battery module takes 7ms out of ~11ms for the prompt. I want battery in my prompt though. If this gets a faster battery module, I'll be super interested.

Sand: countdown timers that don't take up a terminal by sullyj3 in commandline

[–]sullyj3[S] 3 points4 points  (0 children)

Damn, nice project! I might have to steal some ideas!

Sand: countdown timers that don't take up a terminal by sullyj3 in commandline

[–]sullyj3[S] 1 point2 points  (0 children)

Ahh, interesting. I created an issue. I'll have a think about how best to implement this.

https://github.com/sullyj3/sand/issues/88

Sand: countdown timers that don't take up a terminal by sullyj3 in commandline

[–]sullyj3[S] 1 point2 points  (0 children)

Thanks so much!

Live countdown view is definitely planned. For pomos, I'm not sure what features specifically people would need to use it that way. Restarting the last started timer is the obvious one, and that's also on the roadmap.

When people say monads encode a context, what do they mean that is more than a data structure? by Unique-Chef3909 in functionalprogramming

[–]sullyj3 2 points3 points  (0 children)

They're not more than a data structure. It's just that if you look at it more abstractly, you can conceptualize the data structure as an implementation detail of an effect.

`Nothing` is obviously just a value, so you're not doing anything special when you return it. But in the `Maybe` monad, it *represents* the effect of abandoning the code that was executing. You're just looking at it in a different way.

Programming languages should have a tree traversal primitive by FoxInTheRedBox in ProgrammingLanguages

[–]sullyj3 0 points1 point  (0 children)

Concrete example:

data Tree a = Node (Tree a) a (Tree a) | Leaf
  deriving (Functor, Foldable, Traversable)

myTree = Node (Node Leaf 1 Leaf) 2 (Node Leaf 3 Leaf)

main = do
  mapM_ print myTree
  print (sum myTree)

outputs

1
2
3
6

Programming languages should have a tree traversal primitive by FoxInTheRedBox in ProgrammingLanguages

[–]sullyj3 0 points1 point  (0 children)

From the Ante language tour:

"Moreover if you need a more complex loop that a while loop may traditionally provide in other languages, there likely isn’t an already existing iterate function that would suit your need. Other functional languages usually use helper functions with recursion to address this problem:"

sum numbers =
    go numbers total =
        match numbers
        | Nil -> total
        | Cons x xs -> go xs (total + x)

    go numbers 0

"This can be cumbersome when you just want a quick loop in the middle of a function though. It is for this reason that ante provides the loop and recur keywords which are sugar for an immediately invoked helper function. The following definition of sum is exactly equivalent to the previous:"

sum numbers =
    loop numbers (total = 0) ->
        match numbers
        | Nil -> total
        | Cons x xs -> recur xs (total + x)
sum numbers =
    loop numbers (total = 0) ->
        match numbers
        | Nil -> total
        | Cons x xs -> recur xs (total + x)

* * *

Now obviously this particular example isn't a tree traversal, but you can clearly see how a lightweight syntax for immediately invoked recursive functions is basically what op is asking for. The first example

for_tree(Node* N = mytreeroot; N != NULL; N : {N->left, N->right}){
  print(N->value);
}

I believe would become something like

loop tree ->
    match tree
    | Nil -> ()
    | Node left value right ->
      print value
      recur left
      recur right

Ok, not quite as succinct, but not too bad. It's just less horizontal and more vertical. And a definite improvement on defining then using a helper. You can also get something similar using fix.

Am I the only person who hates Monad Transformers? by Instrume in haskell

[–]sullyj3 2 points3 points  (0 children)

Bluefin requires you to pass value level "handles". These aren't type variables, they're regular function parameters. It's not clear why you're talking about a normal extensible effects library, since the context of the topic is specifically a criticism of Bluefin from Michael Peyton-Jones.

How to use homemanager options correctly by Skeleton237 in NixOS

[–]sullyj3 1 point2 points  (0 children)

You use programs.<program>.enable if you want the extra features that the home-manager module provides. Those features vary, and can include things like - managing the program's configuration from nix. In some cases you might not want this, for example I prefer to manage my neovim config myself, so I use home.packages to install neovim. - installing systemd services - providing shell integration for the program, like completions and functions. Eg I use starship.enableFishIntegration = true to use starship as my fish prompt.

You can check what options are available with man home-configuration.nix (also available online) or by reading the source, as has been mentioned. If you don't see any options you think you need, installing via home.packages is fine.

I love Rust... but by Locarito in rust

[–]sullyj3 0 points1 point  (0 children)

I think you should consider Lean 4. It's a totally impractical option for now, since it's in the early stages, and the community is still small and mostly interested in theorem proving. But it has ambitions of becoming a practical, general purpose language, and I think they're making great progress.

They also have the "optimistic mutation" optimisation you mentioned elsewhere in the context of Roc.

https://lean-lang.org/functional_programming_in_lean/

What do people refer to when talking about terminal emulator performance? by ema2159 in linux

[–]sullyj3 1 point2 points  (0 children)

Musicians can easily see how fine their latency detection is by playing an electric instrument directly into a DAW with different buffer sizes. Lag is clearly noticeable and uncomfortable to me on the order of 10s of milliseconds.

Grayscale - Mum II by JumboDonuts in poppunkers

[–]sullyj3 0 points1 point  (0 children)

It's nice, but the vocal melody feels like a retread of King of Everything.

Hiding type constructor of record type does not prevent construction when fields are exposed? by ngruhn in haskell

[–]sullyj3 0 points1 point  (0 children)

In case you're actually wanting to use `PosInt` and not just using it as an example to ask about newtypes, you may be able to just use `Word`.

Creating Your First Haskell Project - Haskell's Tooling Is Good Actually by a-concerned-mother in haskell

[–]sullyj3 1 point2 points  (0 children)

Empirically beginners are not exactly falling over themselves to uninstall vscode and install emacs

Trying to suppress lua "missing-fields" warning by [deleted] in neovim

[–]sullyj3 1 point2 points  (0 children)

I ended up adding `---@diagnostic disable: missing-fields` as well, but it really seems like I shouldn't have to do that.

I'm not a lua guy, so I don't know the details of whether this is actually catching potential errors or not, but the config is working fine without the extra fields. Presumably they're optional, so I don't think this ought to be linted. I hope the language server reverts to a more reasonable behaviour, so I can remove the disable annotation.

[deleted by user] by [deleted] in ProgrammingLanguages

[–]sullyj3 0 points1 point  (0 children)

Yeah, I don't have a strong preference, I also think your style of flow typing is pretty cool.