Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Tarean
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
91.
▲
by
Tarean
8y ago
You can name things like (\id. ...) (\x. x) This names the identity function id. You can make this slightly prettier like (\let. ...) (\def body. body def) Which lets you do let (\x. x) \id. ... Booleans are also
92.
▲
by
Tarean
8y ago
Took this as an excuse to write it in pure lambda calculus https://gist.github.com/Tarmean/65da65b8da37bd66d48e96d2aa73... I always enjoy how lambda calculus suddenly becomes a readable language after the prelude:
93.
▲
by
Tarean
8y ago
Ghc haskell has a bunch of features to make type errors into runtime errors and a really good repl. You can do interactive development pretty well this way. The way I write php isn't that different from how I write haskell, especially
94.
▲
by
Tarean
8y ago
It's also useful for stuff like 'get' to look differently. user ^. id txt ^? _JSON . key "foo" txt ^?! _JSON . key "foo" First one gives exactly one result. The second one is the equivalen
95.
▲
by
Tarean
8y ago
I still use -defer-typed-holes or even -fdefer-type-errors when writing haskell fairly frequently, though.
96.
▲
by
Tarean
8y ago
Linked the wrong talk, oups https://www.youtube.com/watch?v=uR_VzYxvbxg
97.
▲
by
Tarean
8y ago
> I'm from Microsoft and when you see Microsoft documentation it often says, you know, x y or z is a rich something, right. In this case Haskell - or ghc's version of haskell is a rich language. What does this mean? Sounds good
98.
▲
by
Tarean
8y ago
There is also an interesting trick added for Shenandoah to make thread synchronization time bounded. Basically, you don't want to check for gc in each (allocation free) loop iteration. On top of the overhead it makes optimization harde
99.
▲
by
Tarean
8y ago
If the manually allocated memory may contain references to managed objects then it still needs to be traced by the gc. That or you start pinning managed objects or pull everything related into manual world. Both kinda suck.
100.
▲
by
Tarean
8y ago
It's worth noting that the IO monad implementation is very much compiler magic and can't be done in library level haskell. Evaluation order without IO/ST is undefined in Haskell. This is similar to write barriers, you need a
101.
▲
by
Tarean
8y ago
RecordWildCards and DeriveGeneric are clearly used but fairly basic. OverloadedStrings seems to be used for MisoString. The other extensions don't seem to be used so it probably isn't as bad as it looks.
102.
▲
by
Tarean
8y ago
But this mostly matter for arrays and then an alternative optimization might be to store it as a structure of arrays. This doesn't need the padding and is more simd friendly.
103.
▲
by
Tarean
8y ago
I think powershell is kept in memory so only the first start should be slow. Although I don't really notice the first start being slower anymore - maybe it preloads depending on settings or is just fast enough with an ssd?
104.
▲
by
Tarean
8y ago
The actual correspondence in haskell are GADTs: data EqualityProof a b where Refl :: (a ~ b) => EqualityProof a b -- compiler error because we don't check that the equality proof is actually Refl coerce :: Equ
105.
▲
by
Tarean
8y ago
You don't compute an end state, you compute a transition table. For each character you parse you look up the corresponding table and then you compose them. Here is a paper on how to do this efficiently with simd instructions https:&#x
106.
▲
by
Tarean
8y ago
In haskell passing a bool is still considered an anti pattern, it's called boolean blindness. This is mostly because bool's don't carry semantic information. Same goes for `Optional<T>` in an argument position, though
107.
▲
by
Tarean
8y ago
But not all of them are equivalent. Push flows can deal with multiple sinks while pull flows can deal with multiple sources for instance. It's totally reasonable to mix these if you match their flows (or have unlimited memory to buffer
108.
▲
by
Tarean
8y ago
Haskell does async IO by default using green threads. GHC allocates Thread State Objects which completely represent a (green) thread on the heap. A capabillity which represents a cpu core contains a queue of TSO's. If a thread blocks o
109.
▲
by
Tarean
8y ago
I like linux but windows has had much fewer technical issues for me. Not having to wrangle bluetooth/printer/graphics card drivers for hours is nice. This admittedly has improved a ton on linux in recent years, though.
110.
▲
by
Tarean
8y ago
This discussion is only relevant with an attacker that can break tls. A hash that such an attacker couldn't reverse might be slow on old phones so there is a tradeoff. Also, hashed passwords shouldn't be logged either.
111.
▲
by
Tarean
9y ago
I have mixed feelings on this. On one hand I did want this notation while learning haskell. Partly because there are a bunch of places in haskell's type system where repeating a variable implicitly gives equality constraints. On the ot
112.
▲
by
Tarean
9y ago
There are basically two important results for type systems, soundndess and completeness. Soundness means that every program that typechecks is valid. Completeness means that every valid program can be typed. So basically typescripts type sy
113.
▲
by
Tarean
9y ago
Immutable strucutres allow you to sharing or keeping multiple versions. For instance moddeling gamestate as an immutable tree so the ai can cheaply try different options. Also sometimes it's still simpler. Exception handling on window
114.
▲
by
Tarean
9y ago
Ghci has a built in debugger with the expected features (breakpoints, single step, inspect local variables, tracing execution and time travel) but it isn't very useful because haskell is lazy. Execution can just pinball around seemingl
115.
▲
by
Tarean
9y ago
Worth noting that ListTs bind isn't associative for most base monads including IO and it is deprecated for a reason. Also, by it's nature ListT can't stream IO unless you use lazy IO aka lazyRead aka unsafeInterleaveIO which
116.
▲
by
Tarean
9y ago
In praxis a streaming library like pipes, streaming or conduit handles the file handles for you so application code is safe. Safe-ish in the case of streaming but that is a conscious tradeoff between convenience and safety. You could argue
117.
▲
by
Tarean
9y ago
There are some monads (or things close to monads) that are quite common in imperative languages. Java has - CompletableFuture - Optional - Stream - dependency injection can be seen as a monad
118.
▲
by
Tarean
9y ago
Pandoc is awesome for things like tables or code blocks. Here is a table in pandoc markdown: | Header 1 | header 2 | |-|-| | Column 1 | Column 2 | Which is easy to write via emacs mode/vim plugin. Similar for code bloc
119.
▲
by
Tarean
9y ago
You can write markdown and pandoc will leave any latex fragments for the backend. This only works for latex based backends like pdf but it works great if you have some formulas. Code formatting and tabels are also vastly easier with pandoc.
120.
▲
by
Tarean
9y ago
What is the TLS overhead? On x64 you presumably could spare two registers, one for the current heap pointer and one for the end of the heap. How could you implement this more efficiently with a single threaded version? Not sure if LLVM has
More ›