練習問題 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
-}