The artice on Git that I wrote a couple years back, Git From the Bottom Up, has been translated into Japanese by Noriyuki Komatsuzaki. Thank you so much, Noriyuki!
The following is an amalgam of several letters I sent to Richard Stallman, founder of the free software movement, expressing my concern about the direction GPL licensing is taking, and why I disagree with some of the objectives of the Free Software Foundation.
After spending a good while trying to understand monads in Haskell, and why the Haskell world is so fascinated by them, I finally understand why they aren’t as exciting to other languages, or why they are completely missing from languages like C++: because they’re mostly already there.
At its simplest, a monad is an abstraction [...]
I’ve seen this issue mentioned in some random and hard to reach places on the Net, so I thought I’d re-express it here for those who find Google sending them this way.
…Whenever a string is deconstructed, the standard library would check whether that string’s address matches matches the empty string’s: if so, it does nothing; if not, it calls =free=.
…If a library that does have fully dynamic strings enabled (aka the standard library) receives an empty string from code which does not have it enabled (aka, the app you just built), it will try to free it and your application will crash.
…Since my standard library is compiled with fully dynamic strings, the destructor for =basic string= doesn’t recognize that its the “special” empty string, so it tries to free it.
When the master branch is at a state where I want to finally release it, I merge with =—no-ff=, so the merge gets represented as a single commit on the maint branch.
…Since most development work happens on “next”, each time next is stable I merge into master, using =—no-ff= to keep the merge commits together.
… Note that no commits are ever made directly to master, unless I’ve seriously broken something that needs to be addressed sooner than the next merge from “next”.
… Then there are the various local-only topic branches that live on my machine, in which I develop highly unstable code relating to one feature or another, awaiting the day when it becomes stable enough to be merge into “next”.
The “practical man” knows well the value of practical things and he is an expert at perfecting the animal life; but it takes more than a well-fed stomach to bring true content.
… If a philosopher is anything, I say he is someone who forgoes all else to discover and adventure in that world, and to learn what effect immaterial consequences should have on our material life, if all is to be as it ought.
…What Plato used his method for was to approach noesis: to know the “real real”, to have a direct apprehension of reality freed from mortal conceptions; to “remember” the soul’s birth and origin; to return our perception of the world to an original, direct perception of Truth itself.
…There are human endeavors which are little more than words or pigments on paper, that come to life only through the eye of an appreciate heart and mind.
Create a list of primes “as you go”, considering a number prime if it can’t be divided by any number already considered prime.
… However, although my straightforward solution worked on discrete ranges, it couldn’t yield a single prime when called on an infinite range — something I’m completely unused to from other languages, except for some experience with the SERIES library in Common Lisp.
… But when I suggested this on #haskell , someone pointed out that you can’t reverse an infinite list.
…This time when I put primes [1..] into GHCi it printed out prime numbers immediately, but visibly slowed as the accumulator grew larger.
I actually imported the full source into HackPorts, ripped out its List.hs file, renamed it to my Main.hs file, and then began changing it from a function that prints out a list of available packages, to one that writes the data into properly formatted Portfile entries.
… As it does this, it fetches the current version’s tarball over HTTP, and uses OpenSSL (directly, through FFI) to generate MD5, SHA1 and RIPEMD160 checksums of the tarball image.
…As a stub, I have them all depending on port:ghc , but I think there’s sufficient information in the Cabal package info to figure out what the right dependencies should be, both among the Hackage packages themselves and against any external libraries (like OpenSSL).
…Whereas map takes a list of values and returns a list of values, mapM takes a list of values and returns a list of actions that get invoked in sequence in the current Monad (in this case, IO ).
If it were a file I was checksumming, I could memory map the file and pass around a byte pointer, and the OS would take care of lazily reading in the bytes for me as needed.
…In C++ I’d have to switch from passing a vector to passing an istream iterator, but in Haskell, I don’t care what algorithm is populating my list, only that it is a list, and that I know how to work it.
…Based on the behavior of the program, I’m led to believe it happened near what the code was actually doing [^3] — but in fact the problem may have started long, long before, except that laziness differed the trigger to a later time.
… I still think the benefits can outweight the difficulties — especially when it comes to parallelism, and avoiding unnecessary computations, and allowing code to safely traverse infinite series — but it definitely requires a level of algorithmic conciousness on the part of the engineer which seems quite a bit higher than with imperative languages.
In the meantime, I’ve picked a toy project that also has a taste of usefulness: a script to convert the Hackage database into MacPorts Portfiles, respecting inter-package and external library dependencies.
…The impure part takes a command-line argument, interprets it as a FilePath (an impure type, since it must concern itself with operating system-dependent naming conventions), and reads the contents of the file at that location.
… This division into pure and impure has an interesting side-effect (no pun intended): Most of a program’s code is written in isolation of its context of usage .
… Too many times I’ve tried to use a utility’s code as a “library”, only to find it was so caught up in its idea of how it should be used, it had never bothered to abstract its core principles into a set of “pure” function, independent from that intent.
