Created
April 1, 2014 09:08
-
-
Save Nucleareal/9910605 to your computer and use it in GitHub Desktop.
可変長引数のメモ
This file contains hidden or 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
| {-# LANGUAGE FlexibleInstances #-} | |
| class Watashi a where | |
| next :: [String] -> a | |
| instance Watashi String where | |
| next = unwords . reverse | |
| instance (Watashi r) => Watashi (String -> r) where | |
| next xs b = next $ b:xs | |
| watashi :: (Watashi a) => a | |
| watashi = next [] | |
| main :: IO () | |
| main = do | |
| putStrLn $ watashi | |
| putStrLn $ watashi " ( ^o^)" | |
| putStrLn $ watashi " ( ^o^)!" " " "(^o^ )" | |
| putStrLn $ watashi " ( ^o^) (^o^ )" | |
| putStrLn $ watashi " ( ^o(^o^ )" | |
| putStrLn $ watashi " ( ^o^)" "(^q^)" "(^o^ )" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment