-- Copyright 2013 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

-- | A stub module that doesn't do a good job at interpreting haskell but does
-- a great job at linking quickly.
module Cmd.ReplStub (
    Session, make_session
    , interpreter, interpret, complete
) where
import Control.Monad

import qualified Util.Thread as Thread
import qualified Cmd.Cmd as Cmd
import qualified App.ReplProtocol as ReplProtocol
import Global

type Session = ()

make_session :: IO Session
make_session :: IO Session
make_session = forall (m :: * -> *) a. Monad m => a -> m a
return ()

interpreter :: Session -> IO ()
interpreter :: Session -> IO Session
interpreter () = forall (f :: * -> *) a b. Applicative f => f a -> f b
forever forall a b. (a -> b) -> a -> b
$ Seconds -> IO Session
Thread.delay Seconds
10

type Cmd = Cmd.CmdT IO ReplProtocol.CmdResult

interpret :: Session -> Text -> IO Cmd
interpret :: Session -> Text -> IO Cmd
interpret () Text
expr =
    forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ Text -> CmdResult
ReplProtocol.raw forall a b. (a -> b) -> a -> b
$ Text
"repl not linked in: " forall a. Semigroup a => a -> a -> a
<> forall a. Show a => a -> Text
showt Text
expr

complete :: Session -> Text -> IO [Text]
complete :: Session -> Text -> IO [Text]
complete () Text
_ = forall (m :: * -> *) a. Monad m => a -> m a
return []