
#15008: Type synonyms with hidden, determined type variables -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Research needed Component: Compiler | Version: 8.5 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I found myself wanting to write (simplified) {{{ type MyMonad m = (MonadReader r m, Show r) }}} but GHC does not accept this, it wants `r` as part of the type synonym. So why did I think this could work? Because `MonadReader` has a functional dependency: {{{ class Monad m => MonadReader r m | m -> r }}} so if `m` determines `r`, why do I have to write `MyMonad r m` and not just `MyMonad m`? Can I not “hide” the fact that, somewhere internal to the `MyMonad` synonym, there is an additional variable `r` around? Clearly supporting this would need a language proposal, but I wanted to open a ticket here first to hear if this would even be possible to implement. ([https://stackoverflow.com/questions/29686920/is-it-possible-to-have- forgetful-type-synonyms-in-haskell Others have wanted this before as well.]) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15008 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler