Created
December 23, 2013 05:27
-
-
Save nekolinuxblog/8092096 to your computer and use it in GitHub Desktop.
(その14)拡張
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Human = Human {h_name :: String} | |
data Neko = Neko {n_name :: String} | |
data Inu = Inu {i_name :: String} | |
class Aisatu a where | |
hello :: a -> String | |
goodMorning :: a -> String | |
goodNight :: a -> String | |
instance Aisatu Human where | |
hello x = "hello, " ++ h_name x | |
goodMorning x = "Good Morning, " ++ h_name x | |
goodNight x = "Good Night, " ++ h_name x | |
instance Aisatu Neko where | |
hello x = "hello, " ++ n_name x | |
goodMorning x = "Good Morning, " ++ n_name x | |
goodNight x = "Good Night, " ++ n_name x | |
instance Aisatu Inu where | |
hello x = "hello, " ++ i_name x | |
goodMorning x = "Good Morning, " ++ i_name x | |
goodNight x = "Good Night, " ++ i_name x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment