Jim, I suppose that's because the first version I posted had extra spaces before the instances. Now I think the posted version is right. Haskell is very strict with indentation.

Tell me if there are more problems with the posted code and I'll try to fix them.