Skip to content

Instantly share code, notes, and snippets.

@nekolinuxblog
Created December 23, 2013 05:27
Show Gist options
  • Save nekolinuxblog/8092096 to your computer and use it in GitHub Desktop.
Save nekolinuxblog/8092096 to your computer and use it in GitHub Desktop.
(その14)拡張
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