HNHacker News
TopNewBestAskShowJobs

sullyj3

1,004 karma · joined July 4, 2014

submissionscomments
sullyj3··on Lisp and Haskell (2015)
Type systems can encode proofs of properties that you want your data to have. For example, suppose you want to write a function that returns the first element of a list.

  head :: [a] -> a
This is the type of a function "head" that takes a list of values of some arbitrary type a, and returns an a.

if you feed this function an empty list, what will it do? You can reason from the type signature that the only thing it possibly can do is crash, since there's no way to produce a value of type a without knowing what a is in advance.

  head (h:_rest) = h
  head [] = error "Our function is badly behaved!"
To ensure that our function never crashes, we can encode the fact that our list is nonempty in a datatype.

  data Nonempty a = Nonempty a [a]
Ie, a nonempty list must contain a value of type a, and a (possible empty) list of as. Then instead of writing a function that crashes when it receives a nonempty list, we can write a function on nonempty lists that never crashes

  head :: Nonempty a -> a
  head (Nonempty x _rest) = x
What I'm getting at is that, yes, this is just the "shape" of our data. But you can encode more interesting and valuable properties in that shape than might be apparent at first. There are many other interesting examples of using types to ensure that properties that we want to hold for our values, do in fact hold.

Edit: I should probably add that "If it compiles it works" is absolutely not always true. It's more of a community in-joke than an actual belief. But it does turn out to be true surprisingly frequently.

sullyj3··on Cellmate: Male chastity gadget hack could lock users in
That would be a pretty severe human rights violation
sullyj3··on What you could steal from the Kakoune code editor, and get away with
I'm australian, and I pronounce them identically, with the schwa
sullyj3··on Google: “Any harm Epic has suffered is not irreparable and is of its own making”
https://www.merriam-webster.com/dictionary/obtuse

2.b: "difficult to comprehend : not clear or precise in thought or expression".

I think that makes sense.

sullyj3··on A Fistful of States: More State Machine Patterns in Rust
I don't think OP was necessarily claiming they were different
sullyj3··on Haskell GHC 9.0.1-alpha
knowledge about haskell tends to be presented in a "first principles" fashion for whatever reason, which is unfortunate. It's not a very pedagogically sound method. I think it has to do with the systematic temperament of most haskell programmers. But motivation and example should really come first.

The important thing is to not be intimidated. You can really get away with just mimicing code:

  main = do x <- getLine
            putStrLn ("Hello, " ++ x)  
for quite a while before you find that you actually need a proper understanding of the underlying concepts of eg. what monads are and how they work. This is enough to get your classic beginner command line programs running. You can do useful stuff with a very basic understanding. And yet you see people trying to start with

  (>>=) :: m a -> (a -> m b) -> m b
  pure  :: a -> m a
as if that's supposed to be in any way meaningful or useful to a newcomer. The trick is to find the good tutorials that give examples for concepts first, and do a good job of demonstrating why abstracting those examples is a useful thing to do.
sullyj3··on Throw away code
What features make it a game changer for you? For me it felt like just a small quality of life improvement, but I've never delved that deeply into its feature set.
sullyj3··on Haskell RecordDotSyntax language extension proposal (Accepted)
The `e.lbl = value` syntax suggests mutation to me, which would be misleading.
sullyj3··on Haskell RecordDotSyntax language extension proposal (Accepted)
I'm a big fan of the flow package (https://hackage.haskell.org/package/flow), which defines

  (<.) :: (b -> c) -> (a -> b) -> a -> c
and

  (.>) :: (a -> b) -> (b -> c) -> a -> c
sullyj3··on Meeting everyone on a new team
Just fucking do it?
sullyj3··on The Weakness of Anthropic Arguments
Max Tegmark goes into detail on the potential pitfalls of anthropic arguments in "Our Mathematical Universe". Very interesting book.
sullyj3··on TOML – Tom's Obvious, Minimal Language
Dhall bills itself as being designed for longer configuration files. It has functions, allowing for some abstraction, but it's not turing-complete.

https://github.com/dhall-lang/dhall-lang

sullyj3··on How we learnt to stop worrying and love web scraping
Sure, but it might be the only way to get the data.
sullyj3··on What killed Haskell, could kill Rust, too
I mean, it's all pretty well automated by stack, the only painful part is that it can take a long time and use a lot of storage.
sullyj3··on Guide to the Many Meanings of Quantum Mechanics
I mean, it seems strange to reject implications of a successful model if those implications aren't observable. Eg, I believe that stuff exists outside our light cone, because it would be unparsimonious for there to be an extra rule saying that stuff that I can't access doesn't exists.
sullyj3··on Show HN: Mys – an attempt to create a statically typed Python-like language
The really nice thing about proc is that emphasizes that they are in fact procedures, rather than mathematical functions - a distinction that becomes more relevant as FP gains mindshare.
sullyj3··on The universe has made almost all the stars it will ever make
Would one expect the average size to change?
sullyj3··on New academic journal only publishes 'unsurprising' research rejected by others
https://en.wikipedia.org/wiki/Hindsight_bias
sullyj3··on Elevated rates of autism in transgender and gender-diverse individuals
Seems possible it arises from a greater willingness to accept things about themselves and do things like transitioning that are socially stigmatized.
sullyj3··on Star Citizen Alpha 3.10
Is there an article on this?
sullyj3··on Haskell In New Clothes
I really like the Unison syntax:

  fib = cases
    0 -> 0
    1 -> 1
    n -> fib (drop n 1) + fib (drop n 2)
(drop is (-) for natural numbers, clamping to 0.)
sullyj3··on Physical attractiveness bias in the legal system (2017)
Maybe the difference was that they did the crimes and you didn't.
sullyj3··on One-third of New York’s small businesses may be gone forever
That seems like a seriously perverse incentive if kicking people out and leaving the building vacant becomes more economically prudent in the long run
sullyj3··on One-third of New York’s small businesses may be gone forever
Would you characterize Australia as a disciplined, conformist society? I'm in Melbourne, where masks are currently mandatory, and most are complying. In practice, you see people sipping from coffees while walking down the street, then putting the mask on as they pass people.
sullyj3··on Google announces Pixel 5, Pixel 4A 5G, and Pixel 4A
The fingerprint reader on my Pixel 2 XL is still going strong.
sullyj3··on Tired of note-taking apps
Making a commit and pushing every time I edit a note would drive me nuts. I've gotten used to notes auto-saving and syncing. Additionally, reading md on android would require a specialized app anyway.
sullyj3··on I Am Deleting the Blog
"people could find out the information is they looked hard enough" is also ridiculous because, yeah, that's trivially true - the journalist already found the information.
sullyj3··on The PEPs of Python 3.9
I mean, people should be using `==` for this. The fact that `is` happens to work for small numbers is an implementation detail that shouldn't be relied upon.
sullyj3··on The Great CoffeeScript to Typescript Migration of 2017
That just seems like a poor choice of api design for forEach, rather than a fundamental problem with implicit returns.
sullyj3··on The Great CoffeeScript to Typescript Migration of 2017
Interesting, I've never heard complaints about implicit returns before. I really enjoy them in languages like rust. What kind of bugs?
← PreviousPage 7 of 18Next →