Simplifying a GADT with Uniplate
问题 I'm trying to answer this stackoverflow question, using uniplate as I suggested, but the only solution I've come up with so far is pretty ugly. This seems like a fairly common issue, so I wanted to know if there was a more elegant solution. Basically, we've got a GADT which resolves to either Expression Int or Expression Bool (ignoring codataIf = If (B True) codataIf codataIf ): data Expression a where I :: Int -> Expression Int B :: Bool -> Expression Bool Add :: Expression Int -> Expression