/* remember to import Interlude instead! */ import Prelude () /* ugly, but a real function would block subsequent imports */ #define BUG(C_,M_) (report_bug (C_) (M_) __FILE__ __LINE__) #define head (\xs -> case xs of { (x:_) -> x ; _ -> BUG("head","empty list")}) #define tail (\xs -> case xs of { (_:x) -> x ; _ -> BUG("tail","empty list")}) #define at (let {at_ (y:_) 0 = y; at_ (y:ys) n = if n>0 then at_ ys (n-1) else BUG("at","negative index"); at_ _ _ = BUG ("at","index too large")} in \a x -> at_ a x) #define read (\s -> case [ x | (x,t) <- reads s, ("","") <- lex t] of { [x] -> x ; [] -> BUG("read","no parse"); _ -> BUG("read","ambigous parse")}) #define fromJust (\x -> case x of Just a -> a; Nothing -> BUG("fromJust","Nothing")) #define undefined (error ("Hit 'undefined' in "++__FILE__++", "++show (__LINE__ :: Int))) #define undefinedM (fail ("Hit 'undefinedM' in "++__FILE__++", "++show (__LINE__ :: Int))) #define MESSAGE ""