#4459: Polymorphic Data.Dynamic -----------------------------------------------------+---------------------- Reporter: vivian | Owner: vivian Type: feature request | Status: new Priority: normal | Milestone: 7.4.1 Component: GHC API | Version: 7.1 Keywords: polymorphic, dynamic, class, linking | Testcase: Blockedby: | Difficulty: Os: Unknown/Multiple | Blocking: 4316 Architecture: Unknown/Multiple | Failure: None/Unknown -----------------------------------------------------+----------------------
Comment(by vivian): Replying to [comment:21 simonpj]: > The way to generate dictionaries is to call the type checker. As described in the Commentary http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/HscMain, and http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler, the type checker takes a `(HsExpr Name)`, with no `HsWrap` constructors, and returns an `(HsExpr Id)`, replete with `HsWrap` constructors that do the dictionary application. > This paragraph is from [http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/TypeChecker]. The functions referred to, including `sourceTypeRep` are maybe part of the old typechecker? Of particular interest are the variants SourceTy and NoteTy of TypeRep.Type. The constructor SourceTy :: SourceType -> Type represents a type constraint; that is, a predicate over types represented by a dictionary. The type checker treats a SourceTy as opaque, but during the translation to core it will be expanded into its concrete representation (i.e., a dictionary type) by the function [[GhcModule(compiler/types/Type.lhs])).sourceTypeRep. Note that newtypes are not covered by SourceTypes anymore, even if some comments in GHC still suggest this. Instead, all newtype applications are initially represented as a NewTcApp, until they are eliminated by calls to [[GhcModule(compiler/types/Type.lhs])).newTypeRep. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4459#comment:23> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs