Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
is there any way to use the custom type error machinery to override the default "no instance for X arising from use of Y"? i'm admittedly pretty new to type-level programming
You mean like this? https://hackage.haskell.org/package/base-184.108.40.206/docs/GHC-TypeLits.html#t:TypeError
wow, yes, thanks. exactly like that. i'd seen that bit of documentation but i guess it didn't click since i'm playing with an empty type class; didn't occur to me that I could just drop the where. also ended up needing to tinker with OverlappingInstances.
tangentially related question, is it possible to write a type family which, given a typeclass and a list of types, produces a constraint which holds if any one of the types is a member of the class? I have something like the Member construct from polysemy in mind, but i'm not sure exactly how to port that over to my use case
type family Member (c :: Type -> Constraint) (ts :: [Type]) :: Constraint where
Member c ' = True ~ False
Member c (t : ts) = ?? (c t) (Member c ts)
i've gotten this far but have no idea what ?? should be or if a fitting expression is even possible
No it's not possible.
The very nature of type classes is that anyone could declare an instance anywhere, so it's not possible to tell that an instance definitely does not exist.
Gotcha, thanks. Won't waste any more time scratching my head on this one then