Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,868
    • Issues 4,868
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16027
Closed
Open
Created Dec 10, 2018 by John Ericson@Ericson2314Developer

Cannot use DefaultSignatures for TypeFamiles

I'm surprised there wasn't a ticket for this. Maybe I just couldn't find it.

In short, I want to do something like:

class Monad m => MyMonad m where
    type AssociatedMonad m :: Type -> Type
    default type AssociatedMonad m :: (m ~ t m', MonadTrans t, MyMonad m') => Type -> Type
    type AssociatedMonad (t m') = t (AssociatedMonad m')

    fun :: Foo -> m ()
    default fun :: (m ~ t m', MonadTrans t, MyMonad m') => Foo -> m ()
    fun = lift . fun

The syntax is a bit weird, but I hope in the process of implementing constrained type families the syntax properly analogous to the term-level would shake itself out.

The use-case, like the normal method original, is to assist with monad transformer boilerplate. MonadTrans wouldn't be enough, but MFunctor from mmorph might be depending on the method using the associated type.

Trac metadata
Trac field Value
Version 8.6.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking