Skip to content

Commit

Permalink
Remove Yi.Interpreter (replace with 'hint' package), various -Wall
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwheeler@gmail.com committed Jun 17, 2010
1 parent fa2eec1 commit b9f814d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 255 deletions.
65 changes: 2 additions & 63 deletions src/Yi/Eval.hs
Expand Up @@ -14,24 +14,10 @@ import Data.List
import Prelude hiding (error, (.))
import Yi.Regex
import Yi.Core hiding (toDyn, concatMap)
import Yi.Interact hiding (write)
import Yi.Event
import Yi.Dired
import Data.Dynamic
#ifdef GHC_INTERPRETER
import qualified Language.Haskell.Interpreter as LHI
import System.FilePath
import System.Directory
import Control.Monad
#else
import qualified Data.Map as M
import Control.Monad.Reader (asks)
import Yi.Config
import Yi.Interpreter
import Yi.MiniBuffer (FilePatternTag, RegexTag, (:::), CommandArguments)
#endif

#ifdef GHC_INTERPRETER

-- | Returns an Interpreter action that loads the desired modules and interprets the expression.
execEditorAction :: String -> YiM ()
Expand Down Expand Up @@ -80,58 +66,11 @@ flattenExport :: LHI.ModuleElem -> [String]
flattenExport (LHI.Fun x) = [x]
flattenExport (LHI.Class _ xs) = xs
flattenExport (LHI.Data _ xs) = xs
#else
getAllNamesInScope :: YiM [String]
getAllNamesInScope = do
acts <- asks (publishedActions . yiConfig)
return (M.keys acts)


execEditorAction :: String -> YiM ()
execEditorAction s = do
env <- asks (publishedActions . yiConfig)
case toMono =<< interpret =<< addMakeAction =<< rename env =<< parse s of
Left err -> errorEditor err
Right a -> runAction a
where addMakeAction expr = return $ UApp (UVal mkAct) expr
mkAct = [
toDyn (makeAction :: BufferM () -> Action),
toDyn (makeAction :: BufferM Bool -> Action),
toDyn (makeAction :: BufferM Char -> Action),
toDyn (makeAction :: BufferM Int -> Action),
toDyn (makeAction :: BufferM String -> Action),
toDyn (makeAction :: BufferM [String] -> Action),
toDyn (makeAction :: BufferM Region -> Action),
toDyn (makeAction :: BufferM Mark -> Action),
toDyn (makeAction :: BufferM MarkValue -> Action),

toDyn (makeAction :: (String -> BufferM ()) -> Action),
toDyn (makeAction :: (AnyMode -> BufferM ()) -> Action),

toDyn (makeAction :: EditorM () -> Action),

toDyn (makeAction :: YiM () -> Action),
toDyn (makeAction :: YiM String -> Action),
toDyn (makeAction :: YiM BufferRef -> Action),
toDyn (makeAction :: (CommandArguments -> YiM BufferRef) -> Action),

toDyn (makeAction :: (String ::: RegexTag -> YiM ()) -> Action),
toDyn (makeAction :: (String ::: FilePatternTag -> String ::: RegexTag -> YiM ()) -> Action),
toDyn (makeAction :: (String -> YiM ()) -> Action),
toDyn (makeAction :: (CommandArguments -> YiM ()) -> Action),

toDyn (makeAction :: (String -> String -> BufferM ()) -> Action),
toDyn (makeAction :: (String -> String -> BufferM Int) -> Action),
toDyn (makeAction :: (Char -> BufferM ()) -> Action),

toDyn (makeAction :: (BufferRef -> EditorM ()) -> Action)
]
#endif

jumpToE :: String -> Int -> Int -> YiM ()
jumpToE filename line column = do
fnewE filename
withBuffer $ do gotoLn line
withBuffer $ do _ <- gotoLn line
moveXorEol column

errorRegex :: Regex
Expand Down Expand Up @@ -162,7 +101,7 @@ takeCommand x | prompt `isPrefixOf` x = drop (length prompt) x
| otherwise = x

consoleKeymap :: Keymap
consoleKeymap = do event (Event KEnter [])
consoleKeymap = do _ <- event (Event KEnter [])
write $ do x <- withBuffer readLnB
case parseErrorMessage x of
Just (f,l,c) -> jumpToE f l c
Expand Down
2 changes: 1 addition & 1 deletion src/Yi/IncrementalParse.hs
@@ -1,7 +1,7 @@
-- Copyright (c) JP Bernardy 2008
{-# OPTIONS -fglasgow-exts #-}
module Yi.IncrementalParse (recoverWith, symbol, eof, lookNext, testNext,
P, Parser(..), AlexState (..), scanner) where
State, P, Parser(..), AlexState (..), scanner) where
import Parser.Incremental hiding (run)
import Yi.Lexer.Alex (AlexState (..))
import Yi.Prelude
Expand Down
173 changes: 0 additions & 173 deletions src/Yi/Interpreter.hs

This file was deleted.

1 change: 0 additions & 1 deletion src/Yi/Main.hs
Expand Up @@ -11,7 +11,6 @@ module Yi.Main (main) where
import Prelude ()

import Control.Monad.Error
import Control.Monad.Trans.Error (Error(..))
import Data.Char
import Data.List (intercalate)
import Distribution.Text (display)
Expand Down
19 changes: 2 additions & 17 deletions yi.cabal
Expand Up @@ -38,10 +38,6 @@ data-files:
examples/yi-simple.hs
extra-source-files: src/Yi/Lexer/common.hsinc

flag ghcInterpreter
Description: Use the "hint" interpreter for extended commands (M-x) (experimental)
Default: False

flag scion
Default: False
Description: Use the scion library to provide extra commands that interface with GHC (experimental)
Expand Down Expand Up @@ -210,12 +206,6 @@ library
Yi.UI.Cocoa.TextView
Yi.UI.Cocoa.Utils

if flag (ghcInterpreter)
cpp-options: -DGHC_INTERPRETER
else
other-modules:
Yi.Interpreter

if flag (scion)
cpp-options: -DSCION
exposed-modules: Yi.Scion
Expand Down Expand Up @@ -320,14 +310,15 @@ executable yi
build-depends: binary == 0.5.*
build-depends: bytestring >=0.9.1 && <0.9.2
build-depends: derive >=2.3 && <2.4
build-depends: data-accessor >= 0.2.1 && < 0.3
build-depends: data-accessor >= 0.2.1.4 && < 0.3
build-depends: data-accessor-monads-fd == 0.2.*
build-depends: data-accessor-template >= 0.2.1.3 && < 0.2.2
build-depends: dlist >=0.4.1
build-depends: dyre >=0.7
build-depends: filepath>=1.1 && <1.2
build-depends: fingertree >= 0 && <0.1
build-depends: ghc-paths ==0.1.*
build-depends: hint > 0.3.1
build-depends: monads-fd
build-depends: pointedlist >= 0.3.5
build-depends: pureMD5 >= 0.2.3
Expand All @@ -338,7 +329,6 @@ executable yi
build-depends: split == 0.1.*
build-depends: template-haskell >= 2.4 && < 2.5
build-depends: time == 1.1.*
build-depends: transformers >= 0.1 && < 0.3
build-depends: utf8-string >= 0.3.1
build-depends: uniplate
build-depends: unix-compat >=0.1 && <0.2
Expand Down Expand Up @@ -373,11 +363,6 @@ executable yi
build-depends: HOC, HOC-AppKit, HOC-Foundation
cpp-options: -DFRONTEND_COCOA

if flag (ghcInterpreter)
cpp-options: -DGHC_INTERPRETER
build-depends: hint > 0.3.1
-- requires an unreleased version atm.

if flag (scion)
build-depends: ghc == 6.10.*
build-depends: ghc-syb
Expand Down

0 comments on commit b9f814d

Please sign in to comment.