Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
sfvisser
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
241.
▲
by
sfvisser
7y ago
Nice! Explorations like this are truly useful for understanding and maybe even for innovation. You might figure out new ways of expressing things that are unlike react, but solve particular problems better. As a next step I'd recommend
242.
▲
by
sfvisser
7y ago
I never grasped why this is so hard, you don’t need an exponential blowup with some common sense heuristics. Just look at the AST and put the breaks as high up in the tree as possible. For example: If I have a function application with seve
243.
▲
by
sfvisser
7y ago
Where a service could be something external or just a library, module, class or function. I always think service is a bit of vague term describing a bunch of related functionality packaged in some reusable abstraction so you don’t need to r
244.
▲
by
sfvisser
7y ago
> The type is different. Functions are a class of types. The output of function composition is absolutely a different type but within the class of function types. I know how types and type constructors work, it's completely irreleva
245.
▲
by
sfvisser
7y ago
It's very easy to compose data in Haskell. data Expr = Const Int | Add Expr Expr | Mul Expr Expr myExpr = Mul (Add (Const 1 2)) 4 > There is a difference between function composition and data composition in FP. The diff
246.
▲
by
sfvisser
7y ago
> function composition Yes! But more broadly about composition in general. Also datatype composition. Building DSLs that allow you to compose small constructs into larger ones preserving the same type so you can compose even further. May
247.
▲
by
sfvisser
7y ago
Things get really interesting when a team in your organization decides to take out this module ‘C’ and open source it. Now suddenly updates to this module need to balance both the company incentives and those of the open source community. T
248.
▲
by
sfvisser
7y ago
> "However, it is unclear whether songbirds can cognitively control their vocal output." The second sentence of the abstract. These biologists did not seem to assume that 'we are surrounded by mindless organic automatons&#
249.
▲
by
sfvisser
8y ago
In Haskell you usually solve this by just creating an infix operator and use chaining. No need for complicated constructions to type your varargs. Like composition: `f . g . h $ a`
250.
▲
by
sfvisser
8y ago
It's a neat trick and I've used similar patterns in some of our projects, but in the end it doesn't buy you much over a `switch (x.kind) { ... }`. (Except your matcher can be used as a proper expression which is nice obviousl
251.
▲
by
sfvisser
8y ago
With passing values between hooks do you mean "Make one hook depend on the value of another hook?". Because that seems like the functor 'map', or applicative 'apply'. Note, I don't really know what these s
252.
▲
by
sfvisser
8y ago
Maybe something like this? https://gist.github.com/sebastiaanvisser/72e6bc54baa14abc08e... It all seems to boil down to packing and silently composing lifecycle methods. Either with classes, records of functions, or ef
253.
▲
by
sfvisser
8y ago
Sticking to attributes on classes doesn't have this ordering issue, because construction only happens once. class Form extends ReactishComponent { name = this.useState('Mary') surname = this.useState(&#x
254.
▲
by
sfvisser
8y ago
> I meant that many people imagine Component class as being the meat of the codebase, heavily operating on `this` and updating things on it. Yeah maybe. Even when it's not true it is still a valid way of looking at it I think. In th
255.
▲
by
sfvisser
8y ago
> But as we have seen today, the base class setState() implementation has been an illusion all along. It doesn’t do anything except forwarding the call to the current renderer. And useState Hook does exactly the same thing. This is worde
256.
▲
by
sfvisser
8y ago
There is always reason to doubt predictions about the future. Maybe we are coming up with the ultimate renewable energy source in terms of both externalities and economics, maybe we are rich enough to take preventive measures against the ne
257.
▲
by
sfvisser
8y ago
I think the people in France are acting very rational here. The artifical increase in gas prices directly hits their state of being right now and that of their kids. There is no uncertainty about that. Global warning may or may not make lif
258.
▲
by
sfvisser
8y ago
But programs are proofs! At least in the light of the Curry–Howard correspondence. :) Anyways, I do agree that in programming it’s easier to see what are introductions, assumptions, definitions, functions, values etc. You can’t just invent
259.
▲
by
sfvisser
8y ago
In my experience ease of reading code is not a function of verbosity, but a function of familiarity. And in the general case verbosity and cleverness are orthogonal properties.
260.
▲
by
sfvisser
8y ago
Weird comparison. The native DOM already performs some kind of buffering. All changes to the DOM tree in one single JS thread are rendered at once. React just has a slightly simplified virtual version of the DOM so it can be smarter about r
261.
▲
by
sfvisser
8y ago
People do this because it’s easier, takes less time, and is within the paradigm their head is already in all day. We should fix our abstractions instead of telling people they don’t understand data. The latter is fine every so often, but do
262.
▲
by
sfvisser
8y ago
Going from no life to simple life might actually be much easier than going from simple life to complex life. According to Nick Lane in The Vital Question: https://en.wikipedia.org/wiki/The_Vital_Question
263.
▲
by
sfvisser
8y ago
Similar to what I'm noticing just right now in VSCode where the IDE warns you comments are not allowed in a JSON file. This means the parser happily parses comments and performs a separate check afterwards. Beats a "unexpected sym
264.
▲
by
sfvisser
8y ago
What I love about Monad and Applicative interfaces is that I can read that code and almost immediately fully grasp what’s going on without having a clue about the underlying library. There are a bunch of (well named) functions and control f
265.
▲
by
sfvisser
9y ago
Another great approach to generating notional data is using the Haskell QuickCheck library and specifically the Arbitrary type class. Super simple and extremely flexible/composable. Probably also available in other languages.
266.
▲
by
sfvisser
9y ago
Haskell must be the only language for which I can skim a source file in under 60 seconds and almost fully grasp what's going on. Bunch of datatypes, some instances, some helper code, some top-level IO code tying everything upstream tog
267.
▲
by
sfvisser
9y ago
Type systems aren't just about adding static type annotations to your otherwise dynamically typed code to catch a few bugs. If you embrace the type system and start modeling your domain types with the natural invariants in mind you sta
268.
▲
by
sfvisser
9y ago
Monadic parser combinators are context-sensitive, because you can arbitrarily branch your parser based on previously parsed content.
269.
▲
John Hughes – Why Functional Programming Matters [video]
(youtube.com)
2 points
by
sfvisser
11y ago
|
0 comments
270.
▲
by
sfvisser
11y ago
Note that trace is implemented in terms of unsafePerformIO (which is fine for debugging). To get a trace message, you need to attach the trace to something that does get evaluated. I mostly define a somewhat simpler helper like this:
More ›