練習問題 2.6.2.
以下の宣言を考える.
data Jane = MkJane Int
newtype Dick = MkDick Int
適当な関数を定義して,
Janeと
Dickが異なることを例示せよ.
data宣言と
newtype宣言の違い示す.
jane = undefined
dick = undefined
sureJane :: Jane -> Bool
sureJane (MkJane x) = True
sureDick :: Dick -> Bool
sureDick (MkDick x) = True
{-
? sureJane jane
*** Exception: Prelude.undefined
? sureDick dick
True
-}