Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Plugin function definition #16

Closed
alanz opened this issue Nov 4, 2015 · 2 comments
Closed

Plugin function definition #16

alanz opened this issue Nov 4, 2015 · 2 comments
Milestone

Comments

@alanz
Copy link
Collaborator

alanz commented Nov 4, 2015

At the moment the plugin callback function for a particular command is defined as

type Dispatcher = forall m. (MonadIO m,GHC.GhcMonad m,HasIdeState m) 
                         => IdeRequest -> m IdeResponse

The monad used inside HIE is defined as

newtype IdeM a = IdeM { unIdeM :: GM.GhcModT (GM.GmOutT (StateT IdeState IO)) a}
      deriving ( Functor
               , Applicative
               , Alternative
               , Monad
               , MonadPlus
               , MonadIO
               , GM.GmEnv
               , GM.GmOut
               , GM.MonadIO
               , ExceptionMonad
               )

data IdeState = IdeState
  {
    idePlugins :: Plugins
  } deriving (Show)

There is a specific haskell-ide-plugin-api package for the Dispatcher type, and IdeM is defined
in the main haskell-ide-egine package.

There are a number of options for this.

  1. Leave things as they are. But then the GhcModT is not available to a plugin action.
  2. Make Dispatcher have the signature IdeRequest -> IdeM IdeResponse
    This means the IdeM type has to be in haskell-ide-plugin-api, and the various instances
    required become orphans, or need to be in haskell-ide-plugin-api.
  3. Include GhcModT in the constraints on the Dispatcher

Another consideration is that the haskell-ide-engine looks like it may be a
general IDE backend, usable for other languages e.g. PureScript, Idris, et al.
In this case having anything GHC related is unneccessary. In this case,
perhaps the type should be simply

type Dispatcher = forall m. (MonadIO m,HasIdeState m) 
                         => IdeRequest -> m IdeResponse
@alanz
Copy link
Collaborator Author

alanz commented Nov 10, 2015

Note: Dispatcher is in the process of being renamed to CommandFunc via #51

@alanz
Copy link
Collaborator Author

alanz commented Dec 16, 2015

Closed via #130

@alanz alanz closed this as completed Dec 16, 2015
@alanz alanz added this to the prehistory milestone Feb 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant