Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
garethrowlands
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
61.
▲
by
garethrowlands
3y ago
Would this also be a good optimisation in Haskell? Haskell code sometimes ends up pointer chasing down lists too. I wonder if the standard libraries or maybe the compiler could do this?
62.
▲
by
garethrowlands
4y ago
Your first example is just as functional as your second. And, quite possibly, better style. But your overall point is fair. A function, once composed, curried or having captured data, is very much like an object. Indeed its representation i
63.
▲
by
garethrowlands
4y ago
I've seen agile working well at a fairly big company.
64.
▲
by
garethrowlands
4y ago
I recommend people learn the “proper” technique, even if they don’t apply it in every context. As they say, _you need to be in the mould to break the mould_.
65.
▲
by
garethrowlands
4y ago
TDD's first step is write *a test*, not "write tests". Batch size of one. If it was "write tests," it'd be more waterfall.
66.
▲
by
garethrowlands
4y ago
Yes, new code too. If the test doesn't fail at first, you have a different problem than you thought.
67.
▲
by
garethrowlands
4y ago
Sometimes, I find I need to revisit some type signatures after I've begun to write code. And this can lead to my code not type checking for longer than I'd like. But I can still run my tests if I defer type errors to runtime (they
68.
▲
by
garethrowlands
4y ago
It doesn't have to be perfect to be a decent approach sometimes. A spare or missing function isn't necessarily that bad. It's the premise of On Lisp, for example, http://www.paulgraham.com/onlisp.html
69.
▲
by
garethrowlands
4y ago
This is sometimes called the London school of test driven development. At least, if you then mock the non-existent methods to make your top level test pass.
70.
▲
by
garethrowlands
4y ago
This is one motivation for BDD - it doesn't contain 'test' in the title, so it's easier to explain that it's a development method.
71.
▲
by
garethrowlands
4y ago
DevOps merges Dev and Ops. It is not an extra team.
72.
▲
by
garethrowlands
4y ago
Strong agree. Except it's not even really about productivity, it's about outcomes. The productivity is only important insofar as it achieves the outcomes. The ideal agile process would have the team on the golf course or in the sp
73.
▲
by
garethrowlands
4y ago
Who is this devops of which you speak? Did you just mean that standardising these things makes them hard to change? Or, by 'devops', do you mean a particular group of people?
74.
▲
by
garethrowlands
4y ago
Pretty sure it's an option if you have an external monitor attached. If not, why would you close your laptop if not to turn it off?
75.
▲
by
garethrowlands
4y ago
It's the (static) types, not the type annotations that matters in IDEs these days. Even in Java there are (very limited) situations where you can omit the type and the compiler infers it. And the ide handles it just fine. And in, say,
76.
▲
by
garethrowlands
4y ago
Turns out, a few slides later, that ':=' doesn't have direction; it's merely a contraction of declaration, ':', and equality, '='. So 'x := 3' means the same as 'x:int; x=3'. Perha
77.
▲
by
garethrowlands
4y ago
The main reason Haskell does not define Monoid instances for numbers is that there are two equally valid instances: with 1 and * or with 0 and +. So, instead, there are two newtypes defined: * `Sum` whose `mempty` (identity) is `Sum 0` and
78.
▲
by
garethrowlands
4y ago
Yes and you tend to use ^. in Haskell where you'd use . in python, say. And . is also an operator. Similarly, you'd likely be using = in python where you'd use .~ in python. As for ^.., I'm not sure there's an idiom
79.
▲
by
garethrowlands
4y ago
The closest equivalent your fave language has are also operators. ^. does roughly what . does in most languages. And .~ does roughly what = does.
80.
▲
by
garethrowlands
4y ago
This is a bit like asking if anyone still takes Donald Trump seriously any more. Clearly, people do. Not the majority of people but still some people.
81.
▲
by
garethrowlands
4y ago
Rule of least power also relevant here, https://en.m.wikipedia.org/wiki/Rule_of_least_power The web is designed using a variety of little languages. It could just be JavaScript with an API but it's not. And it
82.
▲
by
garethrowlands
4y ago
Your best approach is to run untrusted code in a separate process in a sandbox. Language developers don't normally deal with hostile users in the same way that os developers do.
83.
▲
by
garethrowlands
4y ago
The real world type is a bit of an implementation detail in GHC. As a user, you shouldn't really have to deal with it. IO could be implemented differently under the hood, though real world works well in GHC.
84.
▲
by
garethrowlands
4y ago
Though Haskell has the option to defer type errors to runtime, making them just warnings at compile time. It means you can run your unit tests without having to change everything everywhere all at once. The flag is -fdefer-type-errors
85.
▲
by
garethrowlands
4y ago
Yeah that's how it's supposed to work. Historically, Haskell didn't always make incomplete patterns an error, even now the checker isn't perfect, and even if it was people can still put wildcard patterns.
86.
▲
by
garethrowlands
4y ago
Or posh on poke I guess.
87.
▲
by
garethrowlands
4y ago
Pointer chasing is expensive because fetching a random location defeats locality and therefore caches the the CPU's stream detection. But a compacting GC copies the data it's scanned into a contiguous stream, dramatically improvin
88.
▲
by
garethrowlands
4y ago
There are limits on what lambda calculus can model though. For example, it doesn't model IO very well. So, these days, lambda calculus is only one of the parts of maths that informs functional programming.
89.
▲
by
garethrowlands
4y ago
While I broadly agree with you, I think the post you're responding to has a point. You can't, in general, get a value back out of a monad, so if you call a monadic function, you may well have to return a monad. The obvious example
90.
▲
by
garethrowlands
4y ago
While it's true that `IO` in Haskell has a `Monad` instance, you don't really have to know that to do `IO` in Haskell. Certainly you don't need to know `Monad` in the abstract to use `IO` concretely. I like Haskell's `do
More ›