The Binary instance for TypeRep smells a bit expensive
In particular, get
uses getSomeTypeRep
. getSomeTypeRep
, in turn, calls typeRepKind
through its recursion. But typeRepKind
is itself recursive, fully inspecting the spine of its argument. That smells quadratic to me. The solution, I believe, is to change the type of getSomeTypeRep
to BinHandle -> IO (SomeTypeRep, SomeTypeRep)
.