class Read r where read :: String -> r
Haskell supports return-type polymorphism. Clojure, being dynamically typed, cannot in general support this kind of overloading.
I think it's a trade-off though. Can Haskell dispatch on a value rather than a type?
The Monad class actually depends on it too:
class Monad m where (>>=) :: m a -> (a -> m b) -> m b return :: a -> m a
This means you cannot really implement Haskell-like monads with dynamic typing. You have to implement them in a less general way.
As for dispatching on runtime values, that is ordinary pattern matching:
f (RuntimeValue1 x y) = ... case 1 ... f (RuntimeValue2 x y) = ... case 2 ...
Ahh, yeah I've heard this before. It totally slipped my mind.
>As for dispatching on runtime values, that is ordinary pattern matching
Can you extend the patterns of a function at runtime (or even across modules)?
Haskell supports return-type polymorphism. Clojure, being dynamically typed, cannot in general support this kind of overloading.