Skip to content

Instantly share code, notes, and snippets.

@nekolinuxblog
Created December 22, 2013 17:00
Show Gist options
  • Save nekolinuxblog/8085367 to your computer and use it in GitHub Desktop.
Save nekolinuxblog/8085367 to your computer and use it in GitHub Desktop.
(その14)型クラス
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