But taking my own sort of approach to some parts of the design and I noticed it was hard to get the type inference to workout in the do-notation and I tracked it down to this minimal example of the issue. It's a little bit weird to me coming from a Haskell background because the equivalent Haskell program type checks just fine:
class P a where
p :: a -> Maybe a
instance P [a] where
p = Just
main = do
print (p "what")
(You might object and say they are slightly different programs, but I can also change the instance to [Char] and I only need to enable FlexibleInstances which is a pretty conservative extension and then it type checks again.)
If I need to put Self in the signature of p then it's back to the drawing board I guess.
The reason you'd want a trait like that is some kind of a compile-time strategy pattern. So you could do TypeParam::p(a). But that's the kind of place where you don't want <_>::p(a) picking Foo::p or Bar::p.
Yep, this exactly. You'll need that self parameter to mske inference work out nicely. Note: you co up ld require that the type family implements Default and Copy to mske it easier to work with.