Well what I had in mind was something related to an answer I just wrote
You have a Report type. It can be either a Failure or Success, and either XML or JSON
of course you can just write Report = Report Outcome Type
but what if you could actually compose FailureOrSuccess and that type
data MaybeFailing a = Fail a | Success a
data ContentType a = XML a | JSON a
type Report a = MaybeFailing (ContentType a) -- ~ ContentType (MaybeFailing a)
aaaand then in pattern matches, you can unwrap either layer
@BartekBanachewicz I wouldn't do it like that, I'd write a specific data type rather than a composable one since I think it'd give much more information. Like a Fail | JSON | XML or something like that.