You can certainly write that, but I worry that it will result in a match failure… maybe type erasure will save you, I haven’t tried.