1. 4

    Happy to see that single-user mode is now the default on macOS. This means I won’t have to de-multi-user my nix installs anymore: https://gist.github.com/ehamberg/68ff4615f95c1acec8e7b6d83196d2b2 :)

    1. 3

      There are a number of benefits to using the daemon, even on a machine with one user. While I personally think it’s important that the default installation method is easy and straightforward for new users. Anybody how’s serious about nix and uses it for more than just installing cached builds from nixpkgs should probably be using the daemon.

    1. 2

      I have used iOS for 6–7 years now and I know about the feature, but on the few occasions I wanted to use it, I very carefully shook my phone from side to side, fearing that people around me would think I was crazy if I actually shook my phone.

      Not sure I ever actually successfully triggered the undo action. :|

      1. 4

        What a curious way to announce this much awaited new Elm release. Does anyone here know more about the ideas behind that? I’d have expected some kind of public beta and a proper release announcement…

        1. 4

          Yeah, it’s a bit…different, but it looks like picking and highlighting one feature is what was done for previous releases as well: http://elm-lang.org/blog

          1. 2

            Especially given the “is Elm dead?” questions that have been popping up in the past few months. I guess it’s better to be head-down working on the next release, but I think just a little more communication or visibility into the project might have helped alleviate some of the concerns.

            1. 3

              This topic was addressed by Evan (creator of Elm) in his recent talk at Elm Europe 2018 titled: “What is success?”

              1. 2

                So I watched the video, and this is addressed around the 41 minute mark: “There’s pressure on me to be always be saying everything that’s going on with Elm development, and the trouble is that it’s not always very interesting… it’s like… ‘still working’”.

                I think “still working” would have been better, though. I don’t think anyone expected weekly updates. Every 2 months updating the Github readme with “still working” would have been fine. And the fear that saying you’re working on X and then it doesn’t pan out, so better to not say anything at all, seems like the worse option.

                I also think the talk is a little dismissive of Javascript, and the community. Sure, the number of packages is by no means the be-all of a good language ecosystem, but it says something about the platform and its viability. If nothing else, it means there are alternatives within the ecosystem. People have limited time, and very limited time to invest in learning brand new things, so they naturally look for some way to compare the opportunities they have. Is looking at numbers the ideal behaviour? Maybe not, but if I want to sell Elm to my boss and she asks me when the last release was and I say “18 months ago” and she asks if I know when the next one will be and I say “no”… that’s how languages don’t get adopted and ecosystems don’t grow.

                As a complete outsider, but also as someone who wants Elm to succeed, I think community management is something they need to take really seriously. It seems like Evan really doesn’t want to do it, so fine, have someone else do it. You can dislike that there are persistent questions about the future of your project, but they’re best addressed at the time, not left unanswered.

                1. 3

                  Personally, I’m not really convinced by those arguments.

                  I especially don’t understand why 18 months since last release, and no known date of new release, are arguments against adoption of the language. Take C or C++ — they rarely have new releases. Is this an argument against adoption? I don’t think so; actually, more like for adoption in my opinion! Slow pace of releases can mean that the languages are mature and stable. I’d be really surprised and annoyed by a boss who would think otherwise.

                  It now occurred to me, that maybe Lua is a good example of a language having a similar development mode as Elm. It’s also evolved behind super tightly closed doors. And new versions are usually dumped on the community out of the blue; though usually with public betas & RCs. But those are published only for fleshing out bugs; language design input is mostly not taken into account. AFAIK, the community is generally OK with this. And the language is totally used and relied upon in numerous niches in the industry (including a large one in game development)!

                  1. 5

                    “Elm” includes the language specification and the compiler.

                    The C language specification rarely has new releases, but the C compiler, gcc, has 4 releases per year. There would be major concern from the community and your boss if gcc activity was perceived as drying up.

                    1. 1

                      Ah; good one, never thought of it this way; big thanks for pointing this out to me!

                    2. 2

                      Take C or C++ — they rarely have new releases

                      C and C++ have been mature and in very wide use for decades, where Elm is a very young language - just a few years old. Same with Lua, it’s been in widespread use for, what, 10 years or more? I think that’s the difference. Elm is still much more of an unknown quantity.

                      Slow pace of releases can mean that the languages are mature and stable

                      Sure - when the language is mature and stable. I don’t think anyone would consider Elm to be that way: this new release, if I understand correctly, breaks every package out there until they’re upgraded by their maintainer.

                      1. 3

                        Personally, after some initial usage, I currently actually have a surprising impression of Elm being in fact mature. It kinda feels to me as an island of sanity and stability in the ocean of JS ecosystem… (Again, strictly personal opinion, please forgive me should you find this offensive.) I didn’t realize this sentiment so strongly until writing these words here, so I’m also sincerely curious if this could be a sign of me not knowing Elm well enough to stumble upon some warts? Hmh, and for a somewhat more colourful angle, you know what they say: old doesn’t necessarily mean mature, and converse ;P

                        And — by the way — notably, new releases of Lua actually do also infamously tend to break more or less every package out there :P Newbies tend to be aggravated by this, veterans AFAIU tend to accept it as a cost that enables major improvements to the language.

                        That said, I think I’m starting to grasp what you’re trying to tell me. Especially the phrase about “unknown quantity”. Still, I think it’s rare for a language to become “corporate grade non-risky”. But then, as much as, say C++ is a “known quantity”, to me it’s especially “known” for being… finicky

                2. 2

                  Yeah the last release was in Nov 2016.

                  1. 1

                    The devs are active on https://discourse.elm-lang.org/, which might help people see the project activity.

                  2. 1

                    since they recently disallowed using javascript in elm packages, it only makes sense that they’d lead with what that had won them, i.e. function level dead code elimination.

                  1. 6

                    The Typeclassopedia is such a great resource!

                    If anyone wants a PDF or EPUB version, I maintain a Pandoc markdown version at https://github.com/ehamberg/typeclassopedia-md (go to releases to download a ready-made PDF or EPUB file).

                    1. 12

                      I recommend the episode of DevOps Cafe with Kelsey Hightower discussing about this complexity.

                      The whole idea is that in the enterprise world, processes and workloads are différents, no 2 différent companies have the same constraints, and k8s is answering this with much complexity and flexibility.

                      In this episode, John Willis is wishing that something as simple as a docker compose file would be enough to describe applications, wish that Kelsey answers to with few examples of popular demands that cannot be expressed at all with a compose file.

                      I strongly recommend the podcast and this episode.

                      1. 13

                        Link to the episode for the lazy: https://overcast.fm/+I_PQGD1c

                      1. 4

                        Isn’t this from 2002? If so that’s probably important context to be aware of. :)

                        https://scholar.google.com/scholar?cluster=15142864505292191490

                        There is a what happened? discussion from Reddit from five years ago here.

                        1. 7

                          Blink is a GPLv3-licensed SSH and Mosh client for iOS. It is pretty much what lets me travel light: With Blink I can travel without a laptop and use an iPad Pro with a smart keyboard to connect to and troubleshoot systems, or even do some limited development if it came to that. (The latter is more of a peace-of-mind thing, but it’s far from unpleasant.)

                          Warmly recommended, and easily worth the price if you don’t want to compile it yourself.

                          P.S: It’s almost embarrassing to say, but one of my favourite features is that it allows re-mapping caps lock to ctrl, which is usually not possible on iOS.

                          1. 2

                            Right now I use Prompt for ssh. Besides the fact that Blink has mosh support, is it better than Prompt?

                            1. 1

                              Blink also has more options for remapping certain keys on your keyboard, like “Caps as Esc”, “Shift as Esc”, etc. Although I have not purchased Prompt, since Mosh support for me is indispensable, these are other aspects people usually cite when comparing these two products.

                              1. 1

                                Prompt is also really, really good, and if you don’t need the Mosh support I don’t really see any big reasons to switch.

                                1. 1

                                  I think the thing about Mosh support is that nobody thinks they need it until they get hooked in. :-)

                            1. 10

                              Don’t enter any passphrase, just press an ENTER key. You don’t want to provide it everytime you are trying to establish a connection, don’t you?

                              That’s quite dangerous advice. You should still have a strong password on your private key file and use an agent to avoid having to type the password every time you use the key.

                              1. 3

                                Beyond dangerous. Completely ignorant.

                              1. 17

                                Another fun one:

                                λ> let 2 + 2 = 5 in 2 + 2
                                5
                                

                                (Plus a very stern non-exhaustiveness warning.)

                                1. 12

                                  Is that a redefinition of infix + defined only on a left and right argument of 2? Terrifying.

                                  1. 5

                                    It’s slightly less weird when you consider that operators in Haskell are just syntactic sugar for functions, and functions can be partially defined using pattern-matching on the LHS of the definition. For example, this trivial function returns True when its argument is 0, and False otherwise. You could of course trivially define it in one body too, but you can also use pattern-matching on arguments like this:

                                    isZero 0 = True
                                    isZero _ = False
                                    

                                    So you can partially shadow a function locally by defining it with a pattern-matching head: anything that matches the local definition will execute that, and anything that doesn’t continues to search bindings further out in scope.

                                    1. 2

                                      Yep! That’s exactly it. :)

                                  1. 2

                                    So this creates the function code from the types? I don’t understand how that works.

                                    If I have Int -> Int -> Int how would that know I want the function foo bar baz = bar + baz and not foo bar baz = bar - baz?

                                    1. 10

                                      It can’t. Your type is too general. Not sure what this specific plugin will do, but it will probably just come up with some expression that will have that type. Possibly the one you want – but probably not. :)

                                      For example of types of functions where the types will only allow one, correct implementation, look up implementations of e.g. length-indexed vectors or red-black trees in dependently typed programming languages. It’s also interesting to look at the interactive modes for languages such as Agda and Idris where you can tell your editor “complete this expression” and it will do that (or tell you that it’s not able to, and what’s missing).

                                      1. 2

                                        I think it is relying on the free theorems guaranteed by parametricity.

                                        See Philip Wadler’s paper Theorems for Free!

                                        1. 1

                                          I believe that these tools are not based on parametricity, merely on syntactic proof search (in essence, enumerating possible terms at this type, using techniques from the proof search literature). If you think about it, theorems-for-free does not actually help you generate code at arbitrary types.

                                          1. 1

                                            Ok, thanks.

                                            But I think the fact that this is possible is a side effect of the free theorems granted by parametricity.

                                            Which explains why it is not possible to do this with a concrete type signature, as per the original question.

                                            1. 2

                                              Abstract types and parametric polymorphism are a nice language feature that has several consequences. One is the existence of free theorems (technically, a nice denotational semantics in the categoy of relations), another is the possibility of having a restricted enough search space that blind proof search produces sensible/interesting program. Those two consequences are independent, I don’t think that you can claim that one is a “side effect” of the other.

                                              “Theorem for free” is an interesting and thought-provoking and well-written research article, so people will easily share it and think about it. This is great! But it also result in some miscomprehensions (or at least exaggerations) about what the result says, which result in the article sometimes being cited in situations where it is not actually relevant (besides being in the same scientific domain as the work being discussed). I thought you may be interested a slightly more detailed picture of the technical details at play here.

                                              1. 1

                                                Thanks for the clarification. As you say, this is stuff I know exists, but do not work with it daily so do not understand the full implications and shortcomings.

                                      1. 4

                                        I simply leave out the email address from the global gitconfig file (that’s synced between computers), and will be prompted by git to provide it the first time I want to commit for every new project I clone.

                                        1. 1

                                          Seems to be fixed in macOS 10.13.2, too, with some refinements(?) coming in 10.13.3:

                                          https://twitter.com/aionescu/status/948609809540046849

                                          1. 1

                                            Both are far too complicated for me. As a smarter person than I once said, “any command I cannot immediately remember might as well not exist.”

                                            1. 2

                                              typing tmux on a remote server beats having to restart a job when the network connection dies…

                                              1. 1

                                                That use case fell away for me when I started using mosh.

                                                1. 2

                                                  Mosh is great, but it doesn’t solve the issue with client dying (e.g., due to logout or reboot) and doesn’t let you connect from multiple clients.

                                            1. 0

                                              My question is why you would want to pretend that programs don’t modify or have state. That seems like attempting to do welding without heating metal. Hot metal can cause problems and requires skill, but it’s kind of the point.

                                              1. 5

                                                I’m only talking for my self, of course, but I don’t pretend that programs don’t mutate state when I write code in a purely functional language. I know the compiler will do that behind the scenes. Having immutable state in the programming model is about eliminating some classes of bugs and making it easier to reason about.

                                                I’m also really happy about having virtual memory even though I’m only “pretending” that I have large, contiguous blocks of memory in a suspiciously big memory space.

                                                (Juggling [memory blocks] can cause problems and requires skill. ;)

                                                1. 1

                                                  Good point, but all abstractions are tradeoffs. Even virtual memory is an abstraction with a cost. There is a compelling argument in favor of being able to mark functions or calculation as side effect free or purely functional, but it seems to me that e.g. trying to make I/O “functional” involves a lot of effort and complexity and no real advantage.

                                                  1. 3

                                                    This is an area of active research, so I don’t expect that monad transformer stacks are the last word in handling effects. That said, in order to mark something as “side effect free” or “pure” requires that you have a way of encoding what is impure. That is, you can’t just say: “This is a pure function!” without knowing what “pure” means. Monads and monad transformer stacks are essentially ways of saying: “This thing handles impurity of a particular kind.” For example, Maybe handles the impurity of a result that may or may not happen; Reader handles the impurity of a configuration environment; Either handles the impurity of two potential branches of execution (i.e. errors).

                                                    1. 1

                                                      I’m restricting myself to “pure function” as “no side effects”. I have never understood the utility of monads - they seem to be complex ways of describing mundane operations.

                                                      1. 4

                                                        That’s what I’m saying, though: a “side effect” has to be codified somehow. If it isn’t captured in the type, then it looks fine to the compiler; printf returns an int, after all, so how is it to be marked as a side effect? That is the utility of monads. Maybe (or Result in Rust) is the most obvious example: your type is literally saying “Something may or may not come back,” and you then must deal with that either by passing that uncertainty “up the chain” or by dealing with the uncertainty at the point of origin. This is encoding the side effect of an uncertain return which, in more typical languages, is represented by null (None, nil, …).

                                                        1. 1

                                                          If your mechanism of capturing function semantics is restricted to the type or signature, you have to encode all sorts of things in the types. Alternatively, you could just have a keyword, as in D, for example. I’d like a compiler directive in C to designate a function as “pure” in that sense - it would allow many optimizations and perhaps discourage C compiler writers from coming up with stupid optimizations based on undefineds.

                                                          Ok, I didn’t know that GCC/Clang both support “pure” attributes. So there.

                                                1. 6

                                                  … and someone else expanded it to include DigitalOcean, Vultr, Linode, OVH, and Scaleway:

                                                  https://gist.github.com/justjanne/205cc548148829078d4bf2fd394f50ae

                                                1. 8

                                                  I like typeclasses in Haskell, but I can totally see why Elm doesn’t have them due to its focus on being easy to learn (especially for people coming from js) and having good, helpful and specific error messages.

                                                  I really hope it’s possible to have good error messages also with type classes, but at least today, with GHC, they are very confusing for beginners. Since you could have a Num instance for strings, the error messages when beginners try to appending strings by using + is

                                                  No instance for (Num [Char]) arising from a use of ‘+’
                                                  

                                                  instead of

                                                  expecting the argument to be a number, but it is a string
                                                  
                                                  1. 4

                                                    Using Vim is going to be interesting on one of these… I bet people will just remap the Caps Lock key as Escape or something similar. Still, I think the touch bar will be an overall improvement outside of the specific communities that required the old setup.

                                                    1. 8

                                                      It’s always been really inefficient to pull your hand off the home row and reach way up to the escape key. Vi was designed for a keyboard that had the escape key where the tab key is in a US layout. Remapping capslock to escape or typing ctrl-[ has always been the pro-vim user’s way of generating an escape keycode directly.

                                                      1. 1

                                                        I tend to map “jj” to escape. Works well, can be typed very quickly, and I doubt people type “jj” very much, if at all.

                                                      2. 3

                                                        Yeah, that or use the ±§ key (top left, next to ‘1’ on UK keyboards) or it’s equivalent. I quite like using Caps Lock as Ctrl (and I’m a Vim user).

                                                        I’m curious to see what it’d be like to use the Esc on the touch bar - I’m guessing the feel will be too different to the rest of the keyboard for most people.

                                                        1. 3

                                                          inoremap fd <ESC>

                                                          inoremap jj <ESC>

                                                          inoremap jk <ESC>

                                                          You’ll thank me later.

                                                          1. 2

                                                            Using vim with the usual ESC location already sucks.

                                                            1. 2

                                                              You can use ctrl-c instead of esc in vim.

                                                              1. 2

                                                                You probably want to use ctrl-[. Ctrl-C will not trigger autocmds, abbreviations and so on.

                                                              1. 2

                                                                Care to explain what those lines do? :)

                                                                1. 1

                                                                  Don’t remember. Got ~200k elisp in my dotfiles plus other stuff. Have to use bash for a bit to remember. Think it has to do with making the completion less gormy.

                                                                  I don’t really remember things since I started on the book a year and a half ago.

                                                              1. 1

                                                                Is there a reason for using character entities instead of just inserting the characters themselves – apart from wanting to make it clear which one it is for characters that are displayed in the same way?

                                                                1. 1

                                                                  It depends:

                                                                  • On a Mac, long known for its typography (Steve took a calligraphy class before dropping out of Reed College), it’s very easy to use the Shift and Option key modifiers to insert all sorts of characters, from mdash to the «angle quotes».

                                                                  • On Windows — not so much, so, things like &mdash; and &laquo;/&raquo; come in quite handy.

                                                                1. 1

                                                                  If the FBI had the ability to brute-force the device, what would the outcome be? I would hope (but doubt) Apple complying would make no real difference (i.e. brute-forcing would take decades) due to the security.

                                                                  1. 19

                                                                    The phone in question is an iPhone 5C. It doesn’t have the secure enclave that later A7 models have, so the delay for wrong guesses is only in software. See http://blog.trailofbits.com/2016/02/17/apple-can-comply-with-the-fbi-court-order/ for a good summary.

                                                                    1. 3

                                                                      In order to limit the risk of abuse, Apple can lock the customized version of iOS to only work on the specific recovered iPhone and perform all recovery on their own, without sharing the firmware image with the FBI.

                                                                      Even if there were a way to tie it only to that specific device, they still have to create and sign a neutered version of iOS. I think the signing part gets into tricky 1st Amendment stuff.

                                                                      1. 3

                                                                        Hmmm.. and, if the FBI were to attempt any reverse engineering, could Apple file suit under the DMCA? That would be amazing.

                                                                        1. 10

                                                                          From 17 U.S. Code § 1201 (e):

                                                                          This section does not prohibit any lawfully authorized investigative, protective, information security, or intelligence activity of an officer, agent, or employee of the United States[…]

                                                                          1. 3

                                                                            Yes, I forgot about that. Shame.

                                                                        2. 2

                                                                          I’m not a lawyer and this is not legal advice. :)

                                                                          I can’t see how the 1st amendment would apply here. The only one which gives a right not to speak is the 5th, and Apple is not implicated criminally in this case.