Hacker News new | ask | show | jobs
by carapace 1340 days ago
I'm working on a simple IDE for a purely functional language, it's basically a text editor with a pure FP language as the "macro language", if you will.

When it came time to add strings and I/O I realized that it would mess up purity to provide the typical POSIX-ish filesystem APIs, so I thought, what if I denote strings (of byte sequences, or even bits) as a three-tuple of (hash offset length) backed by a git object store?

The IDE uses a git repo as its fundamental base or environment, you can only edit files that are in the repo (there is an "import" function (aka "git add") of course.) This includes source code and any string literals so your strings already automatically have a three-tuple, and this is true for selections as well.

The obvious thing then is to have (pure) functions that convert these three-tuples into, say, a list of 0..255 ints, or UTF-8 codes, or a (possibly multidimensional) array of floats or whatever...

It seems to work out nicely so far.