[project @ 2001-02-23 12:24:10 by simonmar]
[ghc-hetmet.git] / ghc / compiler / utils / Util.lhs
index 52966b8..b351729 100644 (file)
@@ -40,7 +40,7 @@ module Util (
        mapAccumL, mapAccumR, mapAccumB, foldl2, count,
 
        -- comparisons
-       thenCmp, cmpList, prefixMatch, postfixMatch,
+       thenCmp, cmpList, prefixMatch, suffixMatch,
 
        -- strictness
        seqList, ($!),
@@ -66,6 +66,7 @@ module Util (
 
     ) where
 
+#include "../includes/config.h"
 #include "HsVersions.h"
 
 import List            ( zipWith4 )
@@ -138,9 +139,9 @@ nTimes n f = f . nTimes (n-1) f
 %************************************************************************
 
 \begin{code}
-unJust :: Maybe a -> String -> a
-unJust (Just x) who = x
-unJust Nothing  who = panic ("unJust of Nothing, called by " ++ who)
+unJust :: String -> Maybe a -> a
+unJust who (Just x) = x
+unJust who Nothing  = panic ("unJust of Nothing, called by " ++ who)
 \end{code}
 
 %************************************************************************
@@ -657,8 +658,8 @@ prefixMatch _pat [] = False
 prefixMatch (p:ps) (s:ss) | p == s    = prefixMatch ps ss
                          | otherwise = False
 
-postfixMatch :: Eq a => [a] -> [a] -> Bool
-postfixMatch pat str = prefixMatch (reverse pat) (reverse str)
+suffixMatch :: Eq a => [a] -> [a] -> Bool
+suffixMatch pat str = prefixMatch (reverse pat) (reverse str)
 \end{code}
 
 %************************************************************************