main = do
    RL.initialise
    i <- mkDebugEngine 1e-3
    fix $ \loop -> do
        l <- RL.getLineEdited "> "
        case l of
            Nothing -> return ()
            Just "" -> loop
            Just "exit" -> return ()
            Just s -> do
                case readMaybe s of
                    Nothing -> putStrLn "Parse Error"
                    Just a -> i [a]
                loop
    RL.restore
    return ()
    where
        readMaybe s = case reads s of
                        ((a, _):_) -> return a
                        _          -> Nothing
main = do
    RL.initialise
    i <- mkDebugEngine 1e-3
    fix $ \loop -> do
        l <- RL.getLineEdited "> "
        case l of
            Nothing -> return ()
            Just "" -> loop
            Just "exit" -> return ()
            Just s -> do
                case readMaybe s of
                    Nothing -> putStrLn "Parse Error"
                    Just a -> i [a]
                loop
    RL.restore
    return ()
    where
        readMaybe s = case reads s of
                        ((a, _):_) -> return a
                        _          -> Nothing
main = do
    RL.initialise
    i <- mkDebugEngine 1e-3
    fix $ \loop -> do
        l <- RL.getLineEdited "> "
        case l of
            Nothing -> return ()
            Just "" -> loop
            Just "exit" -> return ()
            Just s -> do
                case readMaybe s of
                    Nothing -> putStrLn "Parse Error"
                    Just a -> i [a]
                loop
    RL.restore
    return ()
    where
        readMaybe s = case reads s of
                        ((a, _):_) -> return a
                        _          -> Nothing