Using several extensions, I can do something like this:
{-
{-
{-
{-
type family TF (a :: Bool) where
TF 'True = Int
TF 'False = Double
data D a where
D :: TF a -> D a
Note that the constructor Dcan work in two ways. Or:
D :: Int -> D 'True
or
D :: Double -> D 'False
Using this template, I can completely change the arguments to the constructor depending on its type, reusing its name.
However, I also need the number of arguments to depend on the name.
I know that I could just replace some arguments ()or Void, but I would rather delete them completely.
Is there any way to do this?
source
share