-- NOTE: -- -- All variable names (except exported names) must start with `__'. -- This prevents tests from breaking just because of changes to the prelude. data Bool = True | False; data List __a = Cons __a (List __a) | Nil; -- maybe the most inefficient implementation of converting an Int to a string... showInt :: Int -> List Char; showInt __i = if __i == -9 then "-9" else ( if __i == -8 then "-8" else ( if __i == -7 then "-7" else ( if __i == -6 then "-6" else ( if __i == -5 then "-5" else ( if __i == -4 then "-4" else ( if __i == -3 then "-3" else ( if __i == -2 then "-2" else ( if __i == -1 then "-1" else ( if __i == 0 then "0" else ( if __i == 1 then "1" else ( if __i == 2 then "2" else ( if __i == 3 then "3" else ( if __i == 4 then "4" else ( if __i == 5 then "5" else ( if __i == 6 then "6" else ( if __i == 7 then "7" else ( if __i == 8 then "8" else ( if __i == 9 then "9" else ( let __x = __i % 10; __y = __i / 10; in showInt __y ++ showInt __x ))))))))))))))))))); class Show __a where { show :: __a -> List Char; } instance Show Int where { show __i = showInt __i; } instance Show Char where { show __c = Cons __c Nil; } instance Show Bool where { show __b = case __b of True -> "True"; False -> "False"; ; } instance Show __a => Show (List __a) where { show __l = let __f __l = (foldr (\__a __b -> if null __b then show __a else show __a ++ ", " ++ __b) "" __l); in "[" ++ __f __l ++ "]"; } instance Show __a, Show __b => Show ((__a, __b)) where { show p = case p of Pair __f __s -> "(" ++ show __f ++ ", " ++ show __s ++ ")";; } error :: List Char -> __a; error = error; undefined :: __a; undefined = error "undefined"; (||) :: Bool -> Bool -> Bool; (||) __b1 __b2 = if __b1 then True else __b2; (&&) :: Bool -> Bool -> Bool; (&&) __b1 __b2 = if __b1 then __b2 else False; (++) :: List __a -> List __a -> List __a; (++) __l1 __l2 = case __l1 of Nil -> __l2; Cons __x __l -> Cons __x (__l ++ __l2); ; map :: (__a -> __b) -> List __a -> List __b; map __f __l = case __l of Nil -> Nil; Cons __x __l' -> Cons (__f __x) (map __f __l'); ; null :: List __a -> Bool; null __x = case __x of Nil -> True; Cons __y __z -> False;; foldr :: (__a -> __b -> __b) -> __b -> List __a -> __b; foldr __f __z __l = case __l of Nil -> __z; Cons __x __xs -> __f __x (foldr __f __z __xs); ; length :: List __a -> Int; length __l = case __l of Nil -> 0; Cons __x __xs -> 1 + (length __xs);; take :: Int -> List __a -> List __a; take __n __l = if __n <= 0 then Nil else case __l of Nil -> Nil; Cons __x __l' -> Cons __x (take (__n - 1) __l'); ;