Created
December 22, 2013 17:00
-
-
Save nekolinuxblog/8085367 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} | |
class Hello a where | |
hello :: a -> String | |
instance Hello Human where | |
hello h = "hello, " ++ h_name h | |
instance Hello Neko where | |
hello n = "hello, " ++ n_name n | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment