
#16070: Better inferred signatures -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: TypeFamilies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by gridaphobe): Replying to [comment:6 AntC]:
Note also a later comment on that github discussion that the `FieldType` constraint holding implies there's a `HasField` instance -- because `FieldType` is an Associated Type. Using that implication seems harder: Assoc Types are treated as sugar for top-level type families/not necessarily grounded in instances, which already gives trouble.
I was also concerned about this, in particular what happens if we have a `type instance` for an associated type at the top-level? But it turns out that GHC does not allow that, all instances of associated types must be defined in the context of a class instance. So I think using the `FieldType => HasField` implication could work nicely. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16070#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler