Monthly Archives: June 2012

Monoid Instance on Conduit

This past weekend I had reason to use conduit to process the contents of a large number of files as a single stream. Fortunately conduit supplies a Monoid instance. Monoid allows us  to append things together. This example is very short but very useful. This little code block creates many sources and collapses them together into a single source that will be ordered by the file name. Quite cool.

let source = foldl1 (<>) $ map sourceFile $ sort files
runResourceT $ do
  source $$
    someConduit chain ...

Thanks to drb226 for his suggestions.

Update:

So obviously there are other ways of writing this. Tekmo suggested using the >> binad and discard operator which would make our code look like:

let source = foldl1 (<>) $ map sourceFile $ sort files

Sjoerd Visscher suggested using foldMap from Data.Foldable. So that gives us:

let source = foldMap sourceFile $ sort files

Thanks for the feedback.

Taxi Medallions and Regulatory Interference

Slate ran an article on taxi medallions in major US cities and how they are related to fare increases and lower wages for taxi drivers. The article posits that treating medallions like a financial instrument is what has lead to lower wages and higher fares. I want to argue that financialization is not bad and that regulatory interference is largely to blame.

Lets first agree that the market for taxi cabs in New York is inefficient. In 1937 when medallions were first issued for taxi cabs the population was around 6.5 million people. Today it is just over 8 million people. We will assume that the per capita usage of cabs remains relatively constant over time. I have no idea if it is true but we will assume it to simplify things. If the issue is that the rents charged by the medallion holders to cab drivers is too high then most likely there is a shortage of medallions. The article does indeed confirm this.

The supply of medallions is regulated by the city government, so it seems like a logical place to start is increasing the number of medallions. Now understandably the owners of the medallions don’t want any additional medallions issued since it would lower the value of their existing medallions. However the problem is fundamental shortage of medallions so more need to be issues. In economics this phenomenon is called artificial scarcity. Indeed Paul Krugman writes about the medallion shortage as the primary example of artificial scarcity in his micro economics text book. So its not really the financialization of the medallions that is the problem. It makes sense for large cab companies to have a pool of medallions since an individual medallion can be used 100% of the time, something that would be impossible if an individual owned the medallion. What is needed is more medallions, not telling individuals (or organizations) that they may not lease them out.

This is a great example of unintended consequences. While it seems rational to ensure that the market players act in an ethical fashion through some sort of licensing process, it does not seem rational to cause a large artificial lack of supply. Increasing the supply would be an easy way to drive down costs.

I will write shortly about why ticket scalping should be legal and why professional sports teams are not good a pricing tickets.