Profile avatar
welltypedwit.ch
When the limestone of imperative programming has worn away, the granite of functional programming will be revealed underneath -Simon Peyton Jones https://welltypedwit.ch
1,579 posts 1,950 followers 298 following
Getting Started
Active Commenter
comment in response to post
merz did break his promise not to get a law passed with afd votes but he has been very vocal (like, every second interview lol) about not working with the afd and definitely not building a coalition with them, even now after the election where it would be (comparatively) safe for him to walk back
comment in response to post
i know but the cdu aren't liberals and the spd aren't "the left". cdu/spd coalitions have have a long history and like, scholz' position on immigration frankly isn't that much better than merz' so it's a pretty safe bet en.wikipedia.org/wiki/Grand_c...
comment in response to post
(or cdu/spd/linke but that's never going to happen lol)
comment in response to post
merz already loudly insisted just now that he will not cooperate with the afd in any way so that's something i guess would be very interesting if either fdp or bsw got in and the only alternative were cdu/spd/greens (but without them, cdu/spd will work out)
comment in response to post
that would be a strange character skill ^^
comment in response to post
into the breach!
comment in response to post
oh my god
comment in response to post
vs code support for c# wasn't great in 2018 ^^ (that was before LSP became popular)
comment in response to post
lmaoo
comment in response to post
i started programming in visual studio 2017 (which took like 32 seconds to start because it was a 32 bit binary that could only use 2G of ram)
comment in response to post
i'm 20!!
comment in response to post
you did not grow up on visual studio (non-code) and intellij and it shows lmao
comment in response to post
doesn't nixpkgs have older versions? as in pkgs.haskell.ghc981.ghc is ghc 9.8.1 and the same with ghc810 is 8.10 nixos.org/manual/nixpk...
comment in response to post
oh you're right huh. honestly wouldn't be surprised if musk had seen the original one and thought it would be funny to make his own
comment in response to post
bsky.app/profile/crim...
comment in response to post
hmm doesn't ghci already quit on eof? (mine does ^^)
comment in response to post
whereas in ghci, i can see all possible completions (and it warns you if there are over 100 ^^)
comment in response to post
if i just type `f`, all i see are the ones in that bottom bar. there are more completions than that but the ones after format_of_string are just cut off
comment in response to post
not sure how that's a feature, but you can customize your prompt in your .ghci file
comment in response to post
oh also completions. in utop completions only show up in the bottom bar (afaik?) so they're kind of useless if there are more than fit there
comment in response to post
#show and #typeof don't work on arbitrary expressions do they? afaict they only expect variable names. for variables, i use :i anyway. :t really shines for expressions with complex types where the result isn't obvious.
comment in response to post
true but that feels like cheating ^^
comment in response to post
what did ghci lack compared to utop?
comment in response to post
and no :i that displays all the relevant information about definitions. also needing ;; is annoying
comment in response to post
i don't think it does anything particularly badly, it just lacks most of what i'm looking for in a repl. e.g. compared to ghci, there is no equivalent of :r for reloading the repl without closing it and losing imported modules, there is no :t that displays types without running the expression...
comment in response to post
mine is cyan! (and the ones in polaris and flora are red and pink ^^)
comment in response to post
it's not a big deal because it works for pasting and otherwise you can just write everything in one line with semicolons and curly braces but like, the racket one is soo nice ^^
comment in response to post
you can set up a custom prompt with colors in your .ghci if you want! not sure about boxes though ^^
comment in response to post
none that i know of. but ghci is also the best repl i know so... ^^ the only two major complaints i have are about the multiline editing (racket's repl is really nice there) and how it sometimes gets messed up on unicode input. but both of those are really complaints about haskeline, not ghci itself
comment in response to post
what would you want to improve?
comment in response to post
to be fair, utop is a lot better than jshell or csi (c#)
comment in response to post
what do you like about it?
comment in response to post
still better than rust :p
comment in response to post
(it's better than utop though ^^)
comment in response to post
ghci
comment in response to post
generally in the statically typed world, an option is something you should only use if you actually don't know if you'll have a value or not. if you know statically at which point it's going to be None and when it will be Some _, you can model those as different types where only one has a value
comment in response to post
that way, passing a unit Hand.t to calculate_hands becomes a type error until you first calculate the imposter values with a function of type `unit Hand.t -> int Hand.t`
comment in response to post
it's different because you avoid the invalid states of having an imposter without a value where one is expected (like here in calculate_hands) or one with a value during regular play.
comment in response to post
if you instead moved winners into the Results constructor, those other states would become unrepresentable and something you categorically wouldn't need to worry about because they're physically impossible to construct (without Obj.magic)
comment in response to post
*if* your program works correctly, these invalid states will never happen, but that's an invariant you need to be very careful to uphold and that will crash if you mess up.
comment in response to post
it's not that it's another key, it's that having it as an option in the game state introduces more illegal states. the only valid states are ones where either step is Results and winners is Some _ or step is something else and winners is None. everything else is invalid.
comment in response to post
yeah but that only applies if `step` is `Results` right? so if you move it to there you can still access it in the end of game state while avoiding the spurious option
comment in response to post
oh yeah using an int is totally fine. what i meant is more that you already know statically if it's going to be None or Some, so it would make more sense to model this in the types. e.g. as type 'imposter t = | ... | Imposter of 'imposter and then use either `unit Rank.t` or `int Rank.t`
comment in response to post
the important bit here is that the fact that the values you use to access players are strings is really an implementation detail that you don't need to leak past the Players module so it would make more sense to use an abstract type for them
comment in response to post
if you really wanted to make sure, you could use something like justified-containers in haskell and tag the map and player ids with a skolem but that's a bit much effort to plumb the lifetimes around to prevent something that's pretty unlikely anyway