Ticket #4459 (new feature request)
Polymorphic Data.Dynamic
| Reported by: | vivian | Owned by: | vivian |
|---|---|---|---|
| Priority: | low | Milestone: | 7.6.1 |
| Component: | GHC API | Version: | 7.1 |
| Keywords: | polymorphic, dynamic, class, linking | Cc: | haskell.vivian.mcphail@…, mmitar@…, leather@… |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | |
| Test Case: | Blocked By: | ||
| Blocking: | #4316 | Related Tickets: |
Description (last modified by igloo) (diff)
At some point in the compilation process an expression acquires a fully-specified, possibly polymorphic, type. If we add an operation that join that type and that expresssion, say TypedAny, then we can implement the part of #4316 requested by mitar.
In GHCi we can evaluate HValues and also string them together with bind statements.
The function
applyDynamic :: TypedAny -> TypedAny -> Maybe TypedAny
includes in its implementation a dictionary lookup and possible dynamic object linking for class methods.
the function
fromDynamic :: TypedAny -> Maybe a
like applyDynamic, runs the typechecker at runtime to unify (and possibly link) the dynamic type (TypedAny) and the static type (a).
Conjecture Since we already have typecase (classes), with type families, this feature provides/simulates dependent types.
