I\'m new to Haskell and would like to know whether it\'s possible to define a function that is only defined on a subset of an already existing type, without actually having
One possibility would be
newtype Even n = Even n getEven (Even n) = 2*n squared :: Num n => Even n -> Even n squared (Even n) = Even (2*n*n)