1 module Miranda(cjustify, lay, layn, limit, ljustify, merge, rep, rjustify, spaces,
2 {-force,seq,-}sort) where
6 cjustify :: Int -> String -> String
7 cjustify n s = spaces l ++ s ++ spaces r
17 f (_:xs) n = n : f xs (n+1)
20 lay :: [String] -> String
21 lay = concat . map (++"\n")
23 layn :: [String] -> String
24 layn = concat . zipWith f [1..]
26 f :: Int -> String -> String
27 f n x = rjustify 4 (show n) ++ ") " ++ x ++ "\n"
29 limit :: (Eq a) => [a] -> a
30 limit (x:y:ys) | x == y = x
31 | otherwise = limit (y:ys)
32 limit _ = error "Miranda.limit: bad use"
34 ljustify :: Int -> String -> String
35 ljustify n s = s ++ spaces (n - length s)
37 merge :: (Ord a) => [a] -> [a] -> [a]
40 merge xxs@(x:xs) yys@(y:ys) | x <= y = x : merge xs yys
41 | otherwise = y : merge xxs ys
43 rep :: Int -> b -> [b]
44 rep n x = take n (repeat x)
46 rjustify :: Int -> String -> String
47 rjustify n s = spaces (n - length s) ++ s
49 spaces :: Int -> String
51 spaces n = ' ' : spaces (n-1)
57 converse f a b = flip f a b
60 e :: (Floating a) => a
63 filemode f = error "Miranda.filemode"
66 hugenum :: (Floating a) => a
67 hugenum = error "hugenum" --!!!
68 integer x = x == truncate x
70 map2 f xs ys = zipWith f xs ys
73 member xs x = x `elem` xs
78 numval :: (Num a) => String -> a
80 postfix xs x = xs ++ [x]
82 scan f z l = scanl f z l
86 tinynum :: (Floating a) => a
87 tinynum = error "tinynum"
88 undef = error "undefined"
89 zip2 xs ys = zip xs ys