Fast, type safe, extensible haskell-like type switch system