HackerTrans
TopNewTrendsCommentsPastAskShowJobs

garethrowlands

261 karmajoined 8 years ago

comments

garethrowlands
·2 days ago·discuss
The number one hard working concept in Haskell is parameterisation. A typical Haskell concept is just a concept, not a Haskell concept.
garethrowlands
·23 days ago·discuss
That map doesn't seem to include the trees in actual parks. Somewhere like Hampstead Heath or Richmond Park has actual woods.
garethrowlands
·23 days ago·discuss
That's awesome. Though, it doesn't seem to think Hampstead Heath has any trees. Nor Croydon, not even Thornton Heath. The Wilderness in Richmond Park seems to be a missing spot, as are some of the plantations (maybe Isabella Plantation, my map fu is failing me). Maybe the royal parks keep their own records?
garethrowlands
·7 months ago·discuss
Citation needed.
garethrowlands
·8 months ago·discuss
STM isn't really used in Go like it is in Haskell.

Here's the example from a Go STM package that's based on Haskell STM. It has gotchas that you won't encounter in Haskell though, due to the nature of these languages.

https://github.com/anacrolix/stm/blob/master/cmd/santa-examp...

For the equivalent Haskell, check out the link at the top of the file.
garethrowlands
·8 months ago·discuss
It's very good. And quite short!
garethrowlands
·8 months ago·discuss
XSLT's matching rules allow a 'push' style of transform that's really neat. But you can actually do that with any programming language such as Javascript.
garethrowlands
·8 months ago·discuss
I used to use XSLT a lot, though it was a while ago.

You can use Javascript to get the same effect and, indeed, write your transforms in much the same style as XSLT. Javascript has xpath (still). You have a choice of template language but JSX is common and convenient. A function for applying XSLT-style matching rules for an XSLT push style of transform is only a few lines of code.

Do you have a particular example where you think Javascript might be more verbose than XSLT?
garethrowlands
·9 months ago·discuss
The term 'variable' is from mathematics. As others have said, the values of variables do vary but they do not mutate.
garethrowlands
·9 months ago·discuss
One way to get some intuition with FCIS is to write some Haskell.

Because Haskell programs pretty much have to be FCIS or they won't compile.

How it plays out is...

1. A Haskell program executes side effects (known as `IO` in Haskell). The type of the `main` program is `IO ()`, meaning it does some IO and doesn't return a value - a program is not a function

2. A Haskell program (code with type `IO`) can call functions. But since functions are pure in Haskell, they can't call code in `IO`.

3. This doesn't actually restrict what you can do but it does influence how you write your code. There are a variety of patterns that weren't well understood until the 1990s or later that enable it. For example, a pure Haskell function can calculate an effectful program to execute. Or it can map a pure function in a side-effecting context. Or it can pipe pure values to a side-effecting stream.
garethrowlands
·9 months ago·discuss
Surely transactions are a pretty good example of where functional core / imperative shell is a good guide. You really don't want to be doing arbitrary side effects inside your transaction because those can't be backed out. Check out STM in Haskell for a good example.
garethrowlands
·9 months ago·discuss
I'm unclear what you're suggesting here. Are you suggesting you couldn't write a POS in Haskell, say?
garethrowlands
·9 months ago·discuss
> Indeed, the general idea of imperative assembly comes to mind as the ultimate "core" for most software.

That's not what functional core, imperative shell means though. It's a given that CPUs aren't functional. The advice is for people programming in languages that have expressions - ruby, in the case of the original talk. The functional paradigm mostly assumes automatic memory management.
garethrowlands
·9 months ago·discuss
On strings in Ada vs Rust. Ada's design predates Unicode (early 1980s vs 1991), so Ada String is basically char array whereas Rust string is a Unicode text type. This explains why you can index into Ada Strings, which are arrays of bytes, but not into Rust strings, which are UTF8 encoded buffers that should be treated as text. Likely the Rust implementation could have used a byte array here.
garethrowlands
·4 years ago·discuss
Pointer chasing is expensive because fetching a random location defeats locality and therefore caches the the CPU's stream detection.

But a compacting GC copies the data it's scanned into a contiguous stream, dramatically improving locality, cache utility and stream detection. And this affects not only subsequent GCs but also the application itself, which may traverse its object graph far more often than the GC does.
garethrowlands
·5 years ago·discuss
The best thing, in my view, about property testing is that it allows you to state the properties you're testing for, as opposed to some examples of them.

For example if I'm making a sqrt function, then I want sqrt(x) * sqrt(x) == x, for any x>=0.

Human beings are good at inferring the general rules from examples but sometimes it's easier to understand if you just say what the general rules is.

Also, unit tests that include example data can sometimes be dominated by that data. Removing the particular examples can sometimes remove a lot of distraction and verbosity.

It's not just that property tests find more bugs.
garethrowlands
·6 years ago·discuss
They're not deploying untested software, if that's what you're asking. They most likely simply deploy each change when it is ready, rather than building up work-in-progress and deploying many changes at the same time. It's a lot safer to change one thing at a time, see https://www.goodreads.com/en/book/show/35747076-accelerate. Releasing changes as soon as they are ready can also enable them to gather feedback faster - in this sense they would be iteratively 'testing' the product.
garethrowlands
·6 years ago·discuss
It might be easier in Typescript, which at least has a type system that can say or.
garethrowlands
·7 years ago·discuss
Isn't the memory for memory mapped files backed by the files themselves? Certainly they are on Windows.