data Formula = Atom Int | Not Formula | And Formula Formula | Or Formula Formula | Imply Formula Formula deriving (Show) equiv :: Formula -> Formula -> Formula equiv p q = And (p `Imply` q) (q `Imply` p) sample :: Formula sample = And p q `equiv` Not (Or (Not p) (Not q)) where p = Atom 0 q = Atom 1 この値は(評価後には)メモリ上では以下のように表現されます。 And p q と Not (Or (Not p) (Not q)) とが 2つの Imply の間で共有されていることが分かります。 H