class MyEq a where
myeq ::a->a->Bool
myeq x y = not( mynoteq x y )
mynoteq ::a->a->Bool
mynoteq x y = not (myeq x y)
class BasicEq3 a where
isEqual3 :: a -> a -> Bool
isEqual3 x y = not (isNotEqual3 x y)
isNotEqual3 :: a -> a -> Bool
isNotEqual3 x y = not (isEqual3 x y)
data MyShow a = One a | Nodata
instance (Show a) => Show(MyShow a) where
show Nodata = "Nodata"
show (One a) = show a
main::IO()
main = print $ show (Nodata::MyShow Int)
main = print (One 789)
Haskell小例子
最新推荐文章于 2022-08-16 11:00:00 发布