Skip to content

Generate wildcard type parameters#200

Merged
arybczak merged 2 commits intohaskell-effectful:masterfrom
janmasrovira:master
Feb 14, 2024
Merged

Generate wildcard type parameters#200
arybczak merged 2 commits intohaskell-effectful:masterfrom
janmasrovira:master

Conversation

@janmasrovira
Copy link
Copy Markdown
Contributor

@janmasrovira janmasrovira commented Feb 13, 2024

Consider the following code:

data Output (o :: GHC.Type) :: Effect where
  Output :: o -> Output o m ()

makeEffect ''Output

Compiling this with warnings turned on generates the following warning:

warning: [GHC-40910] [-Wunused-type-patterns]
    Defined but not used on the right hand side: type variable ‘o’
   |
12 | makeEffect ''Output

This is because the generated definition looks like this:

type instance DispatchOf (Output o) = 'Dynamic

And the variable o is not used in the rhs.

To fix this, I've substituted all type variables with wildcard, so the generated code would look like this instead:

type instance DispatchOf (Output _) = 'Dynamic

@arybczak
Copy link
Copy Markdown
Member

Thanks. Please add an appropriate changelog entry to effectful-th.

@janmasrovira
Copy link
Copy Markdown
Contributor Author

done

@arybczak arybczak merged commit 2037be9 into haskell-effectful:master Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants