Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pka
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
15 ms
·
91.
▲
by
pka
9y ago
Check out Purescript [0]. I've used it in production. [0] http://www.purescript.org
92.
▲
The need for AI-friendly designs
(medium.com)
1 points
by
pka
9y ago
|
0 comments
93.
▲
by
pka
9y ago
> cloning the entire structure for every applied function sounds like it will be slow? is that not what you will have to do in practice? In short, no - as an example, when an element is added to an immutable map, a big part of the newly
94.
▲
by
pka
9y ago
It's indeed very interesting! What I meant is that it might be simpler to just have pure functions operating on immutable data structures, which you could then compose in whichever you want. I.e. you could have a function collapse-vert
95.
▲
by
pka
9y ago
So if I'm understanding this correctly, you are generating a data structure describing geometry manipulations which can then be applied to a distinct geometry "instance?" If so, isn't this just a free monad? Also, what a
96.
▲
by
pka
9y ago
Then every CPU instruction is just (Universe -> Universe) :D
97.
▲
Show HN: Leerraum.js – A PDF typesetting library with hyphenated line breaking
(github.com)
5 points
by
pka
9y ago
|
0 comments
98.
▲
by
pka
9y ago
For the curious, [0]. [0] https://github.com/zrho/purescript-optic-ui
99.
▲
by
pka
9y ago
Ha, I guess this must be some kind of selective blindness then :) I've seen myThreadId many times, it makes perfect sense, and yet, whenever I've had to grab the spawned thread id I've always reached for mfix... Well, in this
100.
▲
by
pka
9y ago
Here's a practical application of mfix: mfix $ \threadId -> forkIO $ do -- computation in forked thread forkIO creates a new thread and returns its thread id. However, in order to access the returned thread id inside
101.
▲
by
pka
9y ago
https://www.haskell.org/hoogle :)
102.
▲
by
pka
10y ago
I'd be interested in continuing this discussion via mail. You don't have a public mail in your profile, so here's mine if you are too: p.kamenarsky@gmail.com
103.
▲
by
pka
10y ago
> You can create an object with the right members and pass it in to a function expecting an interface without even explicitly identifying it as "implementing" the interface. Row polymorphism is indeed very useful. Purescript (a
104.
▲
by
pka
10y ago
> For the entire app? You'd end up with a "god object" that would make the app unmaintainable. OO gives you compartmentalization that you don't get with FP. Well, not quite; take a look at the Elm architecture [0]. It
105.
▲
by
pka
10y ago
To my very limited understanding, no. Basic example, puring cream into a cup of coffee. At first low entropy, low complexity (cream at top, coffee at bottom). Then higher entropy, high complexity (cream and coffee mix according to laws of p
106.
▲
by
pka
10y ago
I think the point still stands: FP is different. None of the things you listed are particularly hard in an FP context. Classes/traits and parametric polymorphism will allow you to do these things just fine (Haskell code): class R
107.
▲
by
pka
10y ago
Inheritance is orthogonal to that. I.e. Erlang, an (impure) functional language without inheritance was literally built for that sort of thing.
108.
▲
by
pka
10y ago
Maintaining state was just one example. See my other comment [0] for others. Regardless, you can't maintain state with closures in a pure language. You could close over some local "variable", but that variable would be immuta
109.
▲
by
pka
10y ago
But OOP without inheritance is what FP gives you anyway: data Address = Address { city :: String , street :: String } data Person = Person { name :: String , address :: Address } My gen
110.
▲
by
pka
10y ago
Compare again: bind(StatefulFunction<a>, a => StatefulFunction<b>) => StatefulFunction<b> flatMap(List<a>, a => List<b>) => List<b> Look at the structure. Don't pay attention
111.
▲
by
pka
10y ago
Oh, but you can have mutable state in different parts of a program even in a pure FP language (without having to jump through any hoops, it's right there and pretty easy to use), although a processor or signal simulator may benefit fro
112.
▲
by
pka
10y ago
Genuinely curious, when would OOP (as opposed to FP) be better suited to a problem domain in your opinion?
113.
▲
by
pka
10y ago
Just to expand a little bit upon the sibling comment. Let's say you need a function that maintains internal state. Now, in non-pure languages, you could that by simply referring to some global variable, but let's agree that's
114.
▲
by
pka
10y ago
There's also purerl [0], an Erlang backend for PureScript. Would be cool if the two projects could join forces. [0] - https://github.com/purerl/purescript
115.
▲
by
pka
10y ago
That's intersting. If the universe could be simulated, you could, in theory, run that simulation on a (very large) piece of paper by hand. Running the simulation would then be equivalent to calculating some numbers and writing them dow
116.
▲
by
pka
10y ago
> There is one thing in Go, that I haven't met anywhere else. I can really understand any codebase I stumble upon in a matter of seconds. Care to elaborate a bit more? I understand that when you see for(...) { b[i] = f(a[i]); } then
117.
▲
by
pka
10y ago
I'm not promoting Rust, nor have I actually written anything in it. I do think though it's a step in the right direction. > But you don't get that effect by ramming it down other people's throats, you get that effect
118.
▲
by
pka
10y ago
There will always be software bugs. What I'm trying to say is that people should be made liable for avoidable bugs due to incompetence or ill-placed personal preferences ("Real programmers write in C!11"). There are times w
119.
▲
by
pka
10y ago
It doesn't make economic sense because VMWare and Microsoft don't have to pay out of pocket if a box in a datacenter is compromised and data is leaked because of bugs in their VMs and kernels that are only possible because of C. T
120.
▲
by
pka
10y ago
That is definitely why we need to stop using C. It's beyond ridiculous.
More ›