Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Tarean
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
21 ms
·
151.
▲
by
Tarean
9y ago
Well, technically traits dispatch based on type and not on value. As long as you aren't wrapping everything into trait objects that is much closer to functional programming. Seems like a mostly semantical difference, though. I guess th
152.
▲
by
Tarean
9y ago
To be fair, let a = 0; for (const record of records) { if (record.bool){ a += 1; } } or ls.filter(x => x).length; aren't that much harder to read. The second one probably doesn
153.
▲
by
Tarean
9y ago
You are not going to blow your stack without recursion, even with a fairly small stack size. Iirc swift has huge stacks for objective-c interop by default so even that shouldn't be a problem. Overhead is a fair point for jit/inter
154.
▲
by
Tarean
9y ago
In the early days haskell favored conceptual elegance heavily above practicality. I'd argue that java strings aren't perfect either, though. You can't seamlessly use the string interface for binary data or char arrays for ins
155.
▲
by
Tarean
9y ago
How do you handle IO errors? They almost certainly have to be a open sum type.
156.
▲
by
Tarean
9y ago
There are companies that strip personally identifying information from the resume in the first few phases and iirc diversitiy did go up. Been a while since I read about it so I don't recall thr complete details but there is a radio lab
157.
▲
by
Tarean
9y ago
Nope. Example of recursion schemes: You have a binary tree data Tree a = Branch (Tree a) (Tree a) | Leaf a This is a recursive structure since a Tree can be made up of other Tree's. We can take a slice of the tree: data
158.
▲
by
Tarean
9y ago
The article didn't really give an example of using contexts but from what I can tell they are a way to add additional semantics to a function? The article mentioned cancellation and implicit parameters at least. My first reaction was
159.
▲
by
Tarean
9y ago
That's reasonably similar to handwritten haskell json parsing: instance FromJson HintTemplate where parseJson = withObject $ \o -> HintTemplate <$> o .: "ID" <*&g
160.
▲
by
Tarean
9y ago
The UID's are a dolphin invention, though, on the hardware level there are just a bunch of registers set. So either you store a complete dump of the cpu state for each shader configuration or you invalidate all shared shaders when dolp
161.
▲
by
Tarean
9y ago
For haskell programmers there is also purescript which is basically a somewhat cleaned up haskell that compiles to human readable javascript.
162.
▲
by
Tarean
9y ago
I felt the same for a long time. At first glance something like import Text.Printf main :: IO () main = do age <- readLn print (formatAge age) formatAge :: Int -> String formatAge age = prin
163.
▲
by
Tarean
9y ago
Just because you didn't happen to not know this one doesn't mean that anyone just invented a new meaning. https://en.m.wikipedia.org/wiki/This_(computer_programming)#...
164.
▲
by
Tarean
9y ago
Delimited continuations reify the rest of the block as a function. From within the definition of a continuation you can use all variables in scope together with that function and can mash them together however you want. You can reimplement
165.
▲
by
Tarean
9y ago
The problem with monadic parsers is that they are too powerful. If you have two options string "foo" <|> string "for" It would be nice to automatically rewrite this as string "fo" >>
166.
▲
by
Tarean
9y ago
In languages that allow abstraction over generic types you can also reuse a lot of infrastructure to write parsers. For instance you can parse a string by chaining a bunch of char parsers: string :: String -> Parser String stri
167.
▲
by
Tarean
9y ago
I use Intellij for java and vim for most other languages. I started using VS Code more often recently because it is really easy to set up ide like tooling for smaller languages in it. Vim usually involves manually configuring plugins and po
168.
▲
by
Tarean
9y ago
I am mostly ok with it with vscode because it is very responsive, leaner than a full IDE but still offers a lot of IDE like features for a wide variety of languages. Vscode is comparatively young but it might already have the broadest suppo
169.
▲
by
Tarean
9y ago
Out of interest, what is your issue with graphical vim? I quite like some of the neovim gui's since they have faster screen draw times and still allow access to terminals/repls/test results/whatever via term buffers. Alt
170.
▲
by
Tarean
9y ago
Tried my hand at the knucleotide[1] one. Lifted the algorithm from the fastest rust solution. As optimization I dropped some Unpack pragmas and strictness annotations, used Data.Hashtable.Cuckoo for in-place updating hash tables because tha
171.
▲
by
Tarean
9y ago
Technically this is only correct if a and b have the same length so you would need to do a length check prior: foldZip a b | T.length a /= T.length b = Nothing | otherwise = foldl' step 0 (T.zip a b) where
172.
▲
by
Tarean
9y ago
I abuse tab groups as a sort of generational garbage collector. From time to time I open a new group as my main group. After a while of using it I move all tabs I still require from my old groups over and close them. That way the time requi
173.
▲
by
Tarean
9y ago
Fair enough, although it would be easy to have an alternative prelude with linear types that libraries could depend on. Just that the extra dependency would really suck. Haven't sunk a lot of time into it yet to be honest, I think the
174.
▲
by
Tarean
9y ago
Fair enough, I only checked the two knucleotide programs which both failed because of missing dependencies.
175.
▲
by
Tarean
9y ago
Yeah, the worst case of ghc's garbage collection is awful and can dwarf the actual work being done. That's the man driving factor behind adding linear types to haskell - they let long lived and large data live on a separate non-gc
176.
▲
by
Tarean
9y ago
Mutable hashtables: https://hackage.haskell.org/package/hashtables Mutable arrays: https://hackage.haskell.org/package/vector-0.12.0.1/docs/Dat... Strict by default: Put {#- Language Str
177.
▲
by
Tarean
9y ago
Did rust ever have a large scale breaking change? Anyway, the linear type proposal is designed to be completely backwards compatible so that shouldn't be as big of an issue.
178.
▲
by
Tarean
9y ago
The make errors are a bit weird because the programs build on my machine no problem. In parts haskells slowness seems to be because no one cares enough to work on it. Can't say for sure, though, so maybe I just should try a task and im
179.
▲
by
Tarean
9y ago
Technically the third has no variables... Slightly less wise-ass, I couldn't come up with a use case for this code that'd give sane variable names. Third attempt: sum $ do (element, True) <- results guard
180.
▲
by
Tarean
9y ago
b = sum((j if j % 2 else 0) for (j, k) in results if k) This definitely is borderline unreadable but that isn't necessarily because it does a lot of things. It is because it does a lot of things without order and with a lot o
More ›