Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Tarean
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
61.
▲
by
Tarean
8y ago
There is money in getting players addicted to increase revenue. The oldest example of that might be WoW but that was far less manipulative nor focused kn whales like many mobile games nowadays are.
62.
▲
by
Tarean
8y ago
It's also very much frowned upon so a slow path is fine. The _get and _set magic methods (called when getting/setting missing properties) are quite common especially for frameworks.
63.
▲
by
Tarean
8y ago
A service could offer an ad-free version for a fee.
64.
▲
by
Tarean
8y ago
I wondered about this and poked at the internals of ByteString (suitable for ffi) and Text. Turns out Text could allow ffi by changing a single function (newByteArray to newAlignedPinnedByteArray). Presumably creating lots of small strings
65.
▲
by
Tarean
8y ago
Lazy data structures require allocation. GHC's lists use build/fold fusion to remove intermediate lists but that's basically just a less reliable way of converting to folds http://hackage.haskell.org/package&#
66.
▲
by
Tarean
8y ago
RDBMS do query optimization by trying out different plans and picking the best via cost estimations. With prepared statements you can reuse that optimization so the cost is (kinda) amortized. If you want something deeper you'd need an
67.
▲
by
Tarean
8y ago
I really like ghc's comment style: all toplevel functions have a comment that describes usage and interface. Comments about implementation details and gotchas are floated out and referenced. https://ghc.haskell.org/trac
68.
▲
by
Tarean
8y ago
On the other hand, the lens library in haskell is extremely abstract. Libraries obviously have different tradeoffs but using lens can increase the onboarding cost significantly for new team members. I am mentioning lens because it has a bot
69.
▲
by
Tarean
8y ago
I don't see the issue with an interfave between the app and the database. As long as the interface is getUserById and not compileSQLQuery.
70.
▲
by
Tarean
8y ago
The actually confusing part is that && has two different meanings: Rvalue reference, the passed value either has no memory location yet or has a memory location that won't be accessed anymore (e.g. Marked with std::move)
71.
▲
by
Tarean
8y ago
I feel like programming languages that wants to be used in production have a novelty budget. Rust does a great job of managing this, for instance. Haskell is an interesting case because it is a fairly simple language by default (hm type sys
72.
▲
by
Tarean
8y ago
My naive version would be import Control.Monad (foldM) checkBalanced :: [Char] -> Bool checkBalanced = isStackEmpty . foldM step mempty where step (x:xs) c | x == c = Just xs step ls c
73.
▲
by
Tarean
8y ago
https://youtu.be/6WGKz2sUa0w
74.
▲
by
Tarean
8y ago
foo = do x <- [1,2 3] y <- [1,2,3] guard (x * y == 8) return (x, y)
75.
▲
by
Tarean
8y ago
So far they use the "don't" approach to garbage collection. It would have to be implemented.like the rest of the rts. I guess parts of the c code could be transpiled but something low-level like the gc relies on details like
76.
▲
by
Tarean
8y ago
Since typescript is compiled anyway it feels somewhat silly not to have the compiler do this work. I wonder how hard it would be to make the desugaring extensible, maybe with a rewrite engine like what Hermit does in haskell.
77.
▲
by
Tarean
8y ago
Haskell's "unboxed" vectors do this on a library level so `Vector (a, b)` is stored as `V_2 {-# UNPACK #-} !Int !(Vector a) !(Vector b)`. But to implement it for new types you need some boilerplate. Alternatively you could us
78.
▲
by
Tarean
8y ago
That's the expression problem. But you can have the best of both worlds with various approaches. One nice one is called tagless final encodings in fp and object algebras in oop. In haskell this is called mtl-style classes and quite com
79.
▲
by
Tarean
8y ago
There are two ways to use git: - learn a basic workflow and ask/google for help for problems. A gui makes this slightly easier - learn the underlying model for git. Then you probably still have to google for invocations occasionally bu
80.
▲
by
Tarean
8y ago
Though this end-to-end nature also makes it harder to spot biases and errors. There is some work that first trains with deep learning and then tries to infer a simpler model that is understandable for humans.
81.
▲
by
Tarean
8y ago
Immutable data structures become a lot harder without gc, though. To update an immutable structure you don't want to copy parts that haven't changed. But this requires sharing and without gc this requires refcounting. Which in tur
82.
▲
by
Tarean
8y ago
You can write the imperative quicksort in haskell and wrap the mutation so it can't escape. This forces you to copy of the incoming array but optimizations can remove intermediate copies. This is similar to r-values in c++, for instanc
83.
▲
by
Tarean
8y ago
A fun example is the slow loris attack. You send your requests character by character with 20+ seconds between packets. For mobile 20 seconds can happen so if the server doesn't use a running window to check timeouts it can't kill
84.
▲
by
Tarean
8y ago
Thanks for your answers! From the second blog post I actually found https://github.com/tokio-rs/tokio/pull/660 which switched tokio from 1 reactor+worker threads to n reactors with work stealing.
85.
▲
by
Tarean
8y ago
This approach to async programming feels like a much more leaky abstraction than the 'it's basically semaphores' stuff for m:n threads. Though being able to do so much as a library is nice. How does async translate calls to o
86.
▲
by
Tarean
8y ago
With some combinators you can indeed do this for any expressions, haskell has a tool that does this transformation automatically http://pointfree.io This can quickly become unreadable but used well it can hide some noise and mea
87.
▲
by
Tarean
8y ago
Pattern synonyms are really expressive but the complex version is kinda headache inducing: http://hackage.haskell.org/package/lens-4.17/docs/src/Contro... This creates a bidirectional pattern synonym - y
88.
▲
by
Tarean
8y ago
So the main performance penalty is that you want to parse foobar | foobaz As fooba(r|z) But this requires you to analyse your parsers. Virtually all parser combinator libraries in haskell are monadic and most others follow
89.
▲
by
Tarean
8y ago
I notice that I have two modes of programming. This is clearest with haskell. For simple code I make type errors into runtime errors and let the compiler figure out type signatures. This emulates dynamic languages with a great linter pretty
90.
▲
by
Tarean
8y ago
I am used to haskell's syntax, does this become more readable once you get used to it? The haskell equivalent would be [x | x <- s, p x]
More ›