Stuff that wasn’t completely obvious to me while I learned Haskell pt 0.01

  1. There are no nullary functions in Haskell. There are nullary functions in the untyped lambda calculus, but Haskell is based off a (the?) typed lambda calculus, and so, not everything is a function.
  2. The way you read types is, the thing after the last ” -> ” is the output, and everything preceding it is (are) input(s). “[String] -> [String]” is read as “a function that takes as inputs lists of strings and outputs lists of strings”. “[String] -> Int -> [String]” is read as “a function that takes as inputs a list of strings, and an Int, and outputs a list of strings “. “[String] -> ([String] -> Int) -> String” is read as “a function that takes as inputs, a list of strings, and, a function from a list of strings to Ints, and outputs a string”.
  3. With filter, it takes as inputs functions and lists, and outputs lists. But the functions must be functions from concrete types, to bools. They’re predicates, like “is red” or “is greater than 50 million” or “has as a factor the number 5”. There aren’t many of these around in the standard prelude. But you don’t want to have to define an entire function for what’s likely to be the one thing you’re trying to filter for, so you use a lambda abstraction, filter (\x -> x > 2) xs, or an operator section, filter (>100) xs.
  4. Currying combined with Polymorphic Types can be surprising. Don’t get caught off guard when learning a function, which has type ” [a] -> [a] “, and the resource you’re using only uses examples where the ” a ” in ” [a] ” is something like ‘Int’ or ‘String’…it can be anything, including functions themselves…i.e. it could operate on a list of functions, and return a list of functions. Currying makes for even more surprises when, in defining a new function using that old one, someone curries the first argument…then you’re left with a list of functions. I \*think\* that lazy evaluation makes this possible, but I can’t be sure.

Full-Proof Guide to Managing Your Passwords

This guide is meant to show you how to keep people who aren’t you out of places they shouldn’t be. We do this using three things: a cloud storage service, keepassx, and your brain.

Why would you want this? Well, to be as secure as you can be, you need to have pretty random usernames and passwords, that are distinct, across all of your devices and accounts. Memorizing all of this is nigh impossible. This take the trouble out. You’ll only need to memorize one thing, a method, that you come up with. That’s all!

  1. First, sign up for a cloud storage service. I use dropbox. But google drive would be ok too. The critical factor is that the service offer an easy way of updating the files across all your devices as they change.
  2. Second, download keepassx.
  3. Keepassx is fairly easy to figure out how to use. You may want to wait until step 4 before proceeding.
  4. Method. The method is pretty simple. You have 4 or 5 passwords that you memorize. They’re going to consist of sentences consisting of uncommon words. The sentences will be long. In addition, you’re going to have a method for updating them that is easy to remember. Here’s an example.

First password to decrypt your hard disk: platters spinning will not stop thieves in the month of mary in the age of two by ten and one and five Second password for sudo/root: elephants stomping will not stop thieves in the month of mary in the age of two by ten and one and five etc.

When the new month approaches and you update, you just change the end…the trick is coming up with unique identifiers for the month, and an easy to remember, but not totally trivial way of expressing the date. The most important thing is never to tell anyone your method!

So, you have one password for your cloud service, one password to decrypt the keepass file, another for sudo/root password, and another to decrypt your disk. The rest of your passwords can be generated using keepassx!

Make sure that dropbox or google drive or wherever you keep your keepass file starts at startup, or discipline yourself to always start it up before accessing your keepass file. The reason this is so is…keepassx generates a read only lock on the file while its being used, so when you update it, there’s only ever one thing being updated. If you didn’t do this, and you updated your file with a new account, none of your other devices would know about it. If you then went on another device and updated the file again, then you’d have two irreconcilable files you’d have to merge by hand. No fun!