User loginNavigation 
returntype polymorphism of monads done right in a dynamic languageWhile monads can be encoded in dynamicallytyped language, the usual encodings are usually uglier than monads in typeclassbased language because type inference is not there to help determine which monad instance we're talking about. Some usecases of type inference can be replaced by dynamic type dispatch, but not the socalled "return type polymorphism" where it is the type expected by the context that matters, not the type carried by values. Monads are just one instance where returntype polymorphism matters (in the form of "return : forall a, a > m a"), but this is a general problem with other structures (typically structures with a default element such as monoids/groups). Intuitively it seems that this problem would be solveable by keeping, in the dynamic type representation, a "not known yet" marker, and using the free monad operations in this case. But there is a gap from intuition from usable code, and Tony GarnockJones just wrote a very nice blog post exposing this technique in Racket: Monads in DynamicallyTyped Languages
By gasche at 20150126 10:14  LtU Forum  previous forum topic  next forum topic  other blogs  3403 reads

Browse archivesActive forum topics 
Recent comments
1 hour 21 min ago
5 hours 20 sec ago
18 hours 58 min ago
21 hours 12 min ago
1 day 3 hours ago
1 day 13 hours ago
1 day 14 hours ago
1 day 16 hours ago
1 day 17 hours ago
1 day 18 hours ago