Minimum wage increase by other means

The employer mandate provision included in the House Democrats' bill requires employers to either provide health insurance (with upto 72.5% of the premiums) to all employees or pay an additional payroll tax. Based on the average employer-based family plans cost of $12,700 in 2008, it means additional $8,255 per employee per year. Dividing by the number of hours worked in a year (40 hours per week * 50 week), we get additional hourly wage increase of approximately $4 per hour. The current federal minimum wage is $7.25 per hour. Thus, the employer mandate effectively increases the minimum wage by more than 50%. Wonder what that will that do the already high unemployment ratio of more than 9%!

Poor Texas?

Paul Krugman ridicules the Matthew Yglesias's claim that Texas is rich due to its low taxes and less regulation because he used median income instead of per-capita income for the comparison. He goes on to point out that "free-market" Texas has a per-capita income of $37,187 vs $49,194 for nanny-state New Jersey.

As many people noted in the commentsthis does not take into account cost of living differences between the two states (Texas has much lower cost of living than New Jersey). Additionally, the median incomes figures are before-tax. Since, the point is to compare economic well-beings of people living in states with different tax rates, we should be using after-tax income. I couldn't easily find after-tax median household income data for Texas and New Jersey, but I suspect, New Jersey will fare much more poorly on that measure. 

Financial vs Real investment

James Kroeger makes this ridiculous claim in the post "The New Deal Didn’t Always Work, Either":

Here you are guilty of conflating the two definitions of 'investment.' Rich people, generally, do not spend money on economic investments, but only on financial investments. While it is true that some financial investments (made by firms) are also economic investments, most financial 'investments' by rich people are not.

The purchase of a piece of land, for example, is a financial investment if it appreciates in value over time, but it is not an economic investment if it just sits there, undeveloped. Purchases of stocks in secondary markets (e.g., NYSE, NASDAQ) are clearly financial investments if the stocks appreciate in value, but they are not economic investments because they involve nothing more than exchanges of titles of ownership of already existing assets. They do not typically put any money into the hands of firm managers that could be used for economic investments. That normally happens only when stocks are first sold to underwriters, prior to an initial public offering.

So what happens to the money paid to buy financial assets (say, stocks on NYSE)? The person who sold the stocks must either spend the money (increase consumption) or fund new real investment(s). The seller can indeed use to money to buy other financial assets but the chain has to end in real consumption or real investment ultimately!

More on Haskell DSL

In an earlier post, partial make replacement, I developed a small Haskell based DSL to express GNU make like rules. In this post, I take the idea further to support multiple dependencies per target.

testO = (return ["test.c", "test.h"]) ->> ccompile >>- "test.o"

testExe = testO ->> link >>- "test.exe"

main = testExe

The above example, expresses in a simple way, that test.o depends on test.c and test.h and can be "made" using ccompile (C compilation). Similarly, test.exe depends on test.o and can be generated by linking test.o. Checkout the Hmake module (30 lines, including the definition of ccompile and link) and try it out yourself. It now properly checks if a target is out of date with its dependency before trying to build to the target.

Compare the above with the elaborate topological sort based ermake implementation (232 lines) using erlang.

With the Haskell module above, one can even build multiple targets in parallel by using forkIO (part of the Concurrent Haskell).

Another DSL embedded in Haskell - a partial make replacement in less than 10 lines

My earlier post on Haskell described a small DSL for calendar apps. In this post, I will show a very simple DSL (written in just 6 lines of code) to replace (a small portion of) GNU make utility. Earlier, I had attempted the GNU make replacement in Haskell without the use of DSL concepts.

At a very basic level, GNU make allows one to describe how a particular goal (or target) is made (generated using a set of shell commands) from a set of its dependencies. In Haskell, I should be able to describe this relationship like this:

return "test.c" ->> ccompile >>- "test.o" ->> link >>- "test.exe"

In other words, test.exe is made from test.o, which in turn is made from test.c.
The plumbing code can be written in a few of lines like this:

import System.Cmd

dep ->> cmd = \target -> dep >>= (\xdep -> (cmd xdep target) >> return target)

tcmd >>- target = (tcmd target) >> return target

ccompile dep target = system("gcc -c " ++ dep ++ " -o " ++ target)

link dep target = system("gcc  " ++ dep ++ " -o " ++ target)

Notice, how the dataflow is made clear because of the notations used. In addition, the use of IO monad means you can keep on "linking" output of one stage to another. Compare and contrast this with the compiler based DSL using Ocaml described here.
For the sake of simplicity, I haven't added the code to check if the target is out of order with   
respect to its dependency. And only one dependency per target is currently supported. These features however, are not very hard to add. As usual, your feedback is highly welcome and is sincerely appreciated. You can download the code from here.

Haskell, DSL and Monad

Haskell is an amazing language. One can easily embed a DSL (domain specific language) using monad. Let's take an concrete example to illustrate the power of DSL and Monads in Haskell.

I was always fascinated by a very useful, and nifty program, called remind. It is a very sophisticated calendering program that allows one to set reminders. For example, "REM 4 July MSG It's Independence Day!", will trigger an reminder on every July 4th. However, this kind of simple reminders can be set using any calendering application. 'Remind' provides a very flexible date specification for setting reminders. The date spec consists of 'day month year weekday'. If you omit the date spec, the reminder occurs every day. If you specify only the day part, then the reminder is triggered on the specified day of every month. If only month is specified, then the reminder is triggered every day of the specified month. And so on... You can take a look at the man page of the remind for more details about the date spec rules.

Remembering the above rules can be tricky. Instead, let's see if Haskell can help us here. I used an idea proposed by Ketil Malde on Haskell-Cafe mailing list on how to handle calendar dates in Haskell. Here is the basic idea:

data Year = Y Int

data MonthEnum = January | February | March | April | May | June | July | August
                    | September | October | November | December   deriving (Show, Eq, Enum, Bounded, Ord)

data DayEnum = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday   deriving (Show, Eq, Enum, Bounded)

data Month = M MonthEnum Year
data Day   = Dm Int Month

Haskell uses lazy evaluation by default. This makes it easier to represent an infinite stream of years starting from 2007 as:

years = [Y y | y <- [2007..]]

Using similar list comprehension notation, list of months in a given year and list of days in a given months can be represented as,

months (Y y) = [M m (Y y) | m <- [January .. December]]

days (M m yy@(Y y))
    | m `elem` [January,March,May,July,August,October,December] = [Dm d (M m yy) | d <- [1..31]]
    | m == February = [Dm d (M m yy) | d <- [1..if y `mod` 4 == 0 then 29 else 28]]
    | otherwise = [Dm d (M m yy) | d <- [1..30]]

Notice how leap years are handled in producing days in a given month and year.

The above code was taken from the Ketil Malde's message at Haskell-Cafe and converted to add Enums.
I added some boilerplate code to display the months properly by implementing an instance of the type class, Show:

instance Show Month where
    show (M m t) = show m ++ " " ++ show t

instance Show Year where
    show (Y y) = " " ++ show y

instance Show Day where
    show (Dm d t) = " " ++ show d ++ " " ++ show t

With the above addition, and using the fact that List in Haskell is a monad, we can easily represent the following,

-- all days of all months of all years (only the first 3 items are shown)
*DateStream> take 3 (years >>= months >>= days)
[ 1 January  2007, 2 January  2007, 3 January  2007]

-- first day of every month of every year
*DateStream> take 3 (years >>= months >>= return.(Dm 1))
[ 1 January  2007, 1 February  2007, 1 March  2007]

-- all days of january of every year
*DateStream> take 3 (years >>= return.(M January) >>= days)
[ 1 January  2007, 2 January  2007, 3 January  2007]

Notice, how easy it is to express the list of days that you are interested in. You can even filter the days by using the 'filter' function provided in Haskell for lists:

-- all mondays in June of any year starting from 2007
*DateStream> take 6 (filter (isDayOfWeek Monday) (years >>= return.(M June) >>=
[ 4 June  2007, 11 June  2007, 18 June  2007, 25 June  2007, 2 June  2008, 9 Jun
e  2008]

'isDayOfWeek' function requires calculating the 'day of week'.

All this functionality in just 43 lines of code (including comments). This already implements all combinations of Remind's date spec that does not involve day of week. It shouldn't be hard to implement the same for day of week.

Most importantly, the user only needs to use simple keywords, such as, years, months, days, january and combine them using the monadic bind operator, '>>='. There, you have a small DSL for calendar apps. You can browse the file here.

Feedback, corrections and suggestions are most welcome.

Update: As some  readers pointed out the leap year calculation were wrong.  Thanks for the feedback. I have corrected the code to use the gregorianMonthLength function from the Data.Time.Calendar module.

What would Gandhi Really Do?

WHAT WOULD GANDHI DO? Fred Thompson thinks Code Pink's sanctimonious question is actually reprehensible.

During World War II, Gandhi penned an open letter to the British people, urging them to surrender to the Nazis. Later, when the extent of the holocaust was known, he criticized Jews who had tried to escape or fight for their lives as they did in Warsaw and Treblinka. “The Jews should have offered themselves to the butcher’s knife,” he said. “They should have thrown themselves into the sea from cliffs.” “Collective suicide,” he told his biographer, “would have been heroism.”

Source: -

But then, there is this!

At the beginning of the Second World War he demanded independence as India's price for helping Britain during the war.

Source: BBC News | World | The life and death of Mahatma Gandhi

So, what if British had agreed to Gandhi's price? I bet when he meant India will help Britain during the war, he was not merely talking about moral support.

Wouldn't his actions (or offer of action) be more relevant here? After all, the question was not what Gandhi would have said but what he would have done!

Learning Haskell

I stumbled onto Haskell around 2 months back while searching for resources on spreadsheet programming.

I wanted to do Buy vs Rent calculations before deciding to buy a house. Microsoft Excel is pretty good. However, after a while it simply did not scale up. You cannot define your own functions and there are no local variables available. It has been my experience that learning in the context of real problem is much faster and easier. This time, it launched my exploration of functional programming. Enter Haskell.

Haskell is a pure functional programming language. Transition from imperative programming to functional programming (and too a pure one) was very difficult. But slowly, I got the hang of it. I re-did Buy vs Rent calculations in Haskell (it's not complete yet).

To explore Haskell further, I decided to implement a small subset of GNU Make features in Haskell. Within a few days (1 day of "thinking" and reading, followed by a day of coding), I was able to get a working system (see make.hs). To use it, simply call 'make' function, passing it a list of rules and a target:

make [(makeCCRule "test")] "test.o"

Simple, C compilation and linking rules are included. But you can define your own rules (a tuple of dependencies, target and list of commands to run when the target is out of date with its dependencies). Haskell allows you to focus on your application logic without causing undue distractions of memory management, maintaining state or even declaring types (it provides type inferencing). It is amazing how much you can do in less than 90 lines of Haskell code (including comments and empty lines). 

I haven't tested it thoroughly and there is no error handling. The system is easy to extend with your own "definition" of what it means to have a target out of date with its dependencies. With a little bit of refactoring it won't be that hard to support pattern like rules (.c to .o, etc.). Please send me feedback on how to improve this (I would love more modularity using type classes, for example).

Minsky and Housing Bubble

Dr. Hyman Minsky's explanation of boom and boost in a capitalist economy is based on structure (or rather change of) of financial relationships. It is highly relevant today as it describes what is happening with the housing sector. The practice of ARMs and various option mortgages are nothing but Ponzi finance schemes.

“In order to understand why our economy has behaved differently since the middle of 1960s than it has earlier in the post-World War II epoch we have to appreciate how the broad contours of the financial structure have changed. The changes in the broad contours of demand have changed the reaction of aggregate profits to a change in investment and therefore have changed the cyclical behavior of the ability of business to validate its debts. The changes in the financial structure have increased the proportion of speculative and Ponzi finance in the total financial structure and therefore increased the vulnerability of the financial system to refinancing and debt validating crises.”

“A thorough research study should examine the changing composition of the assets and liabilities of the various sectors and the implications of this changing structure, as well as changes in financing terms, for the cash flows of the various sectors of the economy. The cash flow structure due to liabilities need then be integrated with the cash flow from assets and the various cash flows due to income production. In particular the changing relations between cash receipts and payment obligations and between payment obligations and the margin of safety need be understood.” (page 49)

The combined effects of big government as a demander of goods and services, as a generator – through its deficits – of business profits and as a provider to financial markets of high-grade default-free liabilities when there is a reversion from private debt means that big government is a three way stabilizer in our economy and that the very process of stabilizing the economy sets the stage for a subsequent bout of accelerating inflation.” (page 56)

“Innovations in financial practices are a feature of our economy, especially when things go well… But each new instrument and expanded use of old instruments increases the amount of financing that is available and which can be used for financing activity and taking positions in inherited assets. Increased availability of finance bids up the prices of assets relative to the prices of current output, and this leads to increases in investment… In our economy it is useful to distinguish between hedge and speculative finance. Hedge finance takes place when the cash flows from operations are expected to be large enough to meet the payment commitments on debts. Speculative finance takes place when the cash flows from operations are not expected to be large enough to meet payment commitments, even though the present value of expected cash receipts is greater than the present value of payment commitments.” (page 66)

“During a period of successful functioning of the economy, private debts and speculative practices are validated.  However, whereas units that engage in hedge finance depend only upon the normal functioning of factor and product markets, unit which engage in speculative finance also depend upon the normal functioning of financial markets. In particular, speculative units must continuously refinance their positions. Higher interest rates will raise their costs of money even as the returns on assets may not increase…

In addition to hedge and speculative finance there is Ponzi finance – a situation in which cash payments commitments on debt are met by increasing the amount of debt outstandingPonzi financing units cannot carry on too longFeedbacks from revealed financial weakness of some units affect the willingness of bankers and business to debt finance a wide variety of organizations… Quite suddenly a panic can develop as pressure to lower debt ratios increases.” (page 67)

Source: Credit Bubble Bulletin, by Doug Noland of Prudent Bear.

Virtual Gold Rush

 Via the Division of Labour, This BussinessWeek article, Innovation in the Age of Mass Collaboration, describes how a conservative mining company discovered gold by opening up its proprietary database on the Internet and offering a prize:

The contestants identified 110 targets on the Red Lake property, more than 80% of which yielded substantial quantities of gold. In fact, since the challenge was initiated, an astounding 8 million ounces of gold have been found—worth well over $3 billion. Not a bad return on a half million dollar investment.