Skip to content

Instantly share code, notes, and snippets.

@totem3
Created February 4, 2012 09:05
Show Gist options
  • Save totem3/1736581 to your computer and use it in GitHub Desktop.
Save totem3/1736581 to your computer and use it in GitHub Desktop.
てへぺろ(・ω<)(ghciでutf-8の表示の仕方が分からなかったので妥協)
data Int = GHC.Types.I# GHC.Prim.Int# -- Defined in GHC.Types
instance Bounded Int -- Defined in GHC.Enum
instance Enum Int -- Defined in GHC.Enum
instance Eq Int -- Defined in GHC.Base
instance Integral Int -- Defined in GHC.Real
instance Num Int -- Defined in GHC.Num
instance Ord Int -- Defined in GHC.Base
instance Read Int -- Defined in GHC.Read
instance Real Int -- Defined in GHC.Real
instance Show Int -- Defined in GHC.Show
class (Eq a, Show a) => Num a where
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
abs :: a -> a
signum :: a -> a
fromInteger :: Integer -> a
-- Defined in GHC.Num
instance Num Int -- Defined in GHC.Num
instance Num Integer -- Defined in GHC.Num
instance Num Double -- Defined in GHC.Float
instance Num Float -- Defined in GHC.Float
teheperos :: [a] -> String
teheperos xs = "TEHEPERO(ow<)" `strProd` (length xs)
strProd :: String -> Int -> String
strProd cs 0 = ""
strProd cs n = cs ++ strProd cs (n-1)
teheperos2 :: (Num a, Ord a) => a -> String
teheperos2 n = "TEHEPERO(ow<)" `strProd2` n
strProd2 :: (Num a, Ord a) => String -> a -> String
strProd2 cs n | n <= 0 = ""
| n > 0 = cs ++ strProd2 cs (n-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment