Live data from Hacker News

Viewing profile — lexi-lambda

lexi-lambda

HN member
Joined
Sun, Feb 08, 2015, 6:23 PM UTC
HN karma
383
Public activity
50 items

About lexi-lambda

No profile information was provided.

Recent public activity

  1. comment
    Comment #44791185

    I can say that I am not particularly concerned with compile-time range checking. I agree with you that it is a massive headache that is almost always a huge waste of time. Even in …

  2. comment
    Comment #35068165

    Yes, certainly. Constructive data modeling is useful for many things, but it’s not a panacea. Other techniques are useful in cases where it’s not practical; I discuss some of the t…

  3. comment
    Comment #35068057

    Well, like I said, the subject is extremely broad, so it is difficult to give concrete suggestions without knowing what specifically you’d like to get into. But I can give some pot…

  4. comment
    Comment #35067979

    You know what, you’re right—I misread your original comment. I was just going through this thread and replying to a number of comments making that particular misconception, since i…

  5. comment
    Comment #35061617

    Yes, that’s about right. But really do read the followup blog post ( https://lexi-lambda.github.io/blog/2020/11/01/names-are-not-... ), as it explains that in much more depth! In p…

  6. comment
    Comment #35061524

    Generic is quite specific to Haskell, so it is probably difficult to explain without a little more understanding of Haskell-like type systems. (Rust has some similar capabilities, …

  7. comment
    Comment #35060984

    You come off as a crank. Perhaps you are one, perhaps you are not, I don’t know, but either way, you certainly write like one. If you want people to take you seriously, I think it …

  8. comment
    Comment #35060621

    Haskell’s `newtype` keyword defines a genuinely fresh (nominal) type that is distinct from all other types. There is no direct analogue in TypeScript, but using branded types would…

  9. comment
    Comment #35060043

    > In Java, you'd implement this by making a class with a private constructor, no mutator methods, and a static factory method that throws an exception if the parsing fails. This is…

  10. comment
    Comment #35059948

    There is really no difference between doing this and returning a `Maybe`, which is the standard Haskell pattern, except that the `Maybe` result also allows the result to be structu…

  11. comment
    Comment #35059886

    > As a result I have not found this article a good one to share with junior developers to help them understand how to design types to capture the notion of validity, and to replace…

  12. comment
    Comment #35059831

    > If you are trying to mix NonEmpty and AllEven and AllGreaterThan100 for the List example, then you would get the combinatorial explosion of types. This is overthinking it. Usuall…

  13. comment
    Comment #35059621

    Certainly I don’t think `parseNonEmpty` would be especially useful in a real program, it’s only there as an example to provide a particularly simple contrasting example against `va…

  14. comment
    Comment #35059519

    You are sort of mistaken. I wrote a followup blog post that discusses what you are describing at some length: https://lexi-lambda.github.io/blog/2020/11/01/names-are-not-... Howeve…

  15. comment
    Comment #35059337

    There is a fairly obvious difference between a dynamic enforcement mechanism like contracts or SQL constraints. Though I think it is a bit silly to suggest that I have “never even …

  16. comment
    Comment #35059113

    > If you can't create a value of type PrimeNumber that doesn't contain a prime number, there's a bit more to it than naming. Yes, indeed. This is quite useful! But crabbone isn’t e…

  17. comment
    Comment #35059019

    I discussed how/why the point of this article is very much not to “parse everything” in this followup: https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-typ... In particular…

  18. comment
    Comment #35058179

    Amusingly, the tweet that inspired this blog post—which is linked in the second paragraph of the article—is specifically about how automatically generating a JSON parser from your …

  19. comment
    Comment #31239878

    > While an element of type bool is an instance of type a, an element of type bool -> bool is not an instance of type a -> a. This sentence is true if you interpret `a -> a` to mean…

  20. comment
    Comment #31238577

    I don’t think the complaints about evaluation order in this blog post really make sense. The evaluation order of `map` in SML is no more mysterious than the evaluation order of `ma…

  21. comment
    Comment #31238081

    All these explanations seem somewhat confused to me because they don’t pin down what the variables represent. In a traditional formulation of Hindley-Milner, there are two distinct…

  22. comment
    Comment #27642761

    This is sort of a perplexing perspective to me. It seems tantamount to saying “you can’t predict whether a value will be a string or a number AND have static type safety because th…

  23. comment
    Comment #24974307

    In Haskell, a newtype can be a single-field record with a named field, so from a Haskell perspective, I would definitely consider both of them “newtypes.”

  24. comment
    Comment #24964626

    As was already mentioned in another reply, what you are describing are refinement types . A refinement type system actually exists for Haskell: it’s called LiquidHaskell,[1] and th…

  25. comment
    Comment #24964584

    Yes, on its own, a newtype is nothing more than a name. The safety comes from pairing a newtype with an encapsulation mechanism and a carefully-designed trust boundary. Without an …