Skip to content

Constraint 1-tuple printed as `Solo` (requires TH)

When I say

{-# LANGUAGE TemplateHaskell #-}

module Bug where

import Language.Haskell.TH

refl :: $( return $ TupleT 1 `AppT` (ConT ''Eq `AppT` VarT ''a) ) => a -> Maybe
refl x = x == x

I get

Bug.hs:7:75: error:
    • Expecting one more argument to ‘Maybe’
      Expected a type, but ‘Maybe’ has kind ‘* -> *’
    • In the type signature: refl :: (Solo Eq a) => a -> Maybe

There are two problems here:

  1. Solo Eq a would not parse into the AST that I built -- it should be Solo (Eq a).
  2. What is Solo??

Now, I actually know the answer to (2): Solo is the name of the 1-tuple. But it really shouldn't appear in the output here, as I thought constraint 1-tuples are dropped. My main problem is thus the appearance of Solo here.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information