[Main compiles. Scared to test it... jupdike@gmail.com**20080205182245] { hunk ./Limes.lhs 41 -> +> _ + _ = error "Num Signum, not implemented" +> abs _ = error "Num Signum, not implemented" +> signum _ = error "Num Signum, not implemented" hunk ./Main.lhs 16 +> import Text.ParserCombinators.Parsec +> import Data.Char + hunk ./Main.lhs 25 +> import Limes hunk ./Main.lhs 35 -> import Limes hunk ./Main.lhs 42 -> type State = (Expr, Table) - ----------------------------------------------------------------------- +> type MyState = (Expr, Table) hunk ./Main.lhs 44 ----------------------------------------------------------------------- +> g # f = f . g hunk ./Main.lhs 47 -> putLine "for help type /help" >> +> putStrLn "for help type /help" >> hunk ./Main.lhs 55 -> evaluate :: State -> String -> IO State -> evaluate s x = case runParser (expression s) x of -> Left (Nothing, _) -> -> putLine "sorry" >> return s -> Left (Just (t, s'), _) -> -> putLine (pretty 78 t) >> return s' -> Right _ -> -> putLine "syntax error" >> return s +> evaluate :: MyState -> String -> IO MyState +> evaluate s str = case runParser (expression s) () "" str of +> Left _ -> putStrLn "syntax error" >> return s +> Right Nothing -> sorry s +> Right (Just (t, s')) -> putStrLn (pretty 78 t) >> return s' + +> sorry s = putStrLn "sorry, does not compute" >> return s hunk ./Main.lhs 70 -> expression (e, t) = ((lit '\" & var &= \x -> opt expr e &= \e -> -> unit (wrap x (Just . derive) e)) -> ? (lit '|' & var &= \x -> opt expr e &= \e -> -> unit (wrap x (integrate t) e)) -> ? (lit '[' & expr &= \e1 -> lit '/' & expr &= \e2 -> -> lit ']' & opt expr e &= \e -> -> unit (wrap "" (Just . replace (abstract "" e1, +> opt m a = m <|> return a + +> expression :: (Expr, Table) -> Text.ParserCombinators.Parsec.Parser (Maybe (Txt, MyState)) +> expression (e, t) = ( (lit '\'' >> var >>= \x -> opt expr e >>= \e -> +> return (wrap x (Just . derive) e)) +> <|> (lit '|' >> var >>= \x -> opt expr e >>= \e -> +> return (wrap x (integrate t) e)) +> <|> (lit '[' >> expr >>= \e1 -> lit '/' >> expr >>= \e2 -> +> lit ']' >> opt expr e >>= \e -> +> return (wrap "" (Just . replace (abstract "" e1, hunk ./Main.lhs 81 -> ? (lits "lim" & var &= \x -> lits "->" & -> ext expr &= \a -> opt expr e &= \e -> -> unit (wrap' x (limes (mapE (abstract "") a)) e)) -> ? (lits "st2" & -> unit (wrap "" (Just . standard2) e)) -> ? (lits "st3" & number &= \n -> -> unit (wrap "" (Just . standard3 (read n)) e)) -> ? (expr &= \e -> -> unit (wrap "" Just e))) -> &= \r -> end & unit r +> <|> (lits "lim" >> var >>= \x -> lits "->" >> +> ext expr >>= \a -> opt expr e >>= \e -> +> return (wrap' x (limes (mapE (abstract "") a)) e)) +> <|> (lits "st2" >> +> return (wrap "" (Just . standard2) e)) +> <|> (lits "st3" >> number >>= \n -> +> return (wrap "" (Just . standard3 (read n)) e)) +> <|> (expr >>= \e -> +> return (wrap "" Just e)) ) +> >>= \r -> eof >> return r hunk ./Main.lhs 93 -> # mapM (standard1 # rapply x # \e' -> (pp e', (e', t))) +> # mapMaybe (standard1 # rapply x # \e' -> (pp e', (e', t))) hunk ./Main.lhs 95 -> # mapM (mapE (standard1 # rapply "") # \v -> (pp v, (e, t))) +> # mapMaybe (mapE (standard1 # rapply "") # \v -> (pp v, (e, t))) hunk ./Main.lhs 107 -> mapM f Nothing = Nothing -> mapM f (Just a) = Just (f a) +> mapMaybe f Nothing = Nothing +> mapMaybe f (Just a) = Just (f a) hunk ./Main.lhs 157 -> getNatArg [] = failWith (UserError "argument expected") +> getNatArg [] = error "argument expected" hunk ./Main.lhs 160 -> | otherwise = failWith (UserError "number expected") +> | otherwise = error "number expected" hunk ./Parse.lhs 20 - > import Limes ( Extended(..) ) +> import Limes -- ( Extended(..) ) hunk ./Parse.lhs 22 -> data Extended val = MInfty | Proper val | Infty -> deriving (Eq) + > data Extended val = MInfty | Proper val | Infty + > deriving (Eq) hunk ./Table.lhs 60 -> --optional (lit ';') (lit ';') +> option ';' (lit ';') }