haskell / haskeline

A Haskell library for line input in command-line programs.
https://hackage.haskell.org/package/haskeline
BSD 3-Clause "New" or "Revised" License
221 stars 75 forks source link

Missing MonadIO and MonadTrans instances for InputT #25

Closed notogawa closed 9 years ago

notogawa commented 9 years ago

When build haskeline-0.7.2.1 by ghc 7.10.1, missing instances.

$ ghci
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude> import System.Console.Haskeline
Prelude System.Console.Haskeline> import Control.Monad.IO.Class
Prelude System.Console.Haskeline Control.Monad.IO.Class> import Control.Monad.Trans
Prelude System.Console.Haskeline Control.Monad.IO.Class Control.Monad.Trans> :i InputT
type role InputT representational nominal
newtype InputT (m :: * -> *) a
  = haskeline-0.7.2.1:System.Console.Haskeline.InputT.InputT {haskeline-0.7.2.1:System.Console.Haskeline.InputT.unInputT :: transformers-0.4.2.0:Control.Monad.Trans.Reader.ReaderT
                                                                                                                              haskeline-0.7.2.1:System.Console.Haskeline.Term.RunTerm
                                                                                                                              (transformers-0.4.2.0:Control.Monad.Trans.Reader.ReaderT
                                                                                                                                 (GHC.IORef.IORef
                                                                                                                                    System.Console.Haskeline.History.History)
                                                                                                                                 (transformers-0.4.2.0:Control.Monad.Trans.Reader.ReaderT
                                                                                                                                    (GHC.IORef.IORef
                                                                                                                                       haskeline-0.7.2.1:System.Console.Haskeline.Command.KillRing.KillRing)
                                                                                                                                    (transformers-0.4.2.0:Control.Monad.Trans.Reader.ReaderT
                                                                                                                                       Prefs
                                                                                                                                       (transformers-0.4.2.0:Control.Monad.Trans.Reader.ReaderT
                                                                                                                                          (Settings
                                                                                                                                             m)
                                                                                                                                          m))))
                                                                                                                              a}
        -- Defined in ‘haskeline-0.7.2.1:System.Console.Haskeline.InputT’
instance [overlap ok] Monad m => Monad (InputT m)
  -- Defined in ‘haskeline-0.7.2.1:System.Console.Haskeline.InputT’
instance [overlap ok] Monad m => Functor (InputT m)
  -- Defined in ‘haskeline-0.7.2.1:System.Console.Haskeline.InputT’
instance [overlap ok] Monad m => Applicative (InputT m)
  -- Defined in ‘haskeline-0.7.2.1:System.Console.Haskeline.InputT’
instance [overlap ok] MonadException m => MonadException (InputT m)
  -- Defined in ‘haskeline-0.7.2.1:System.Console.Haskeline.InputT’
Prelude System.Console.Haskeline Control.Monad.IO.Class Control.Monad.Trans>
judah commented 9 years ago

Strange, I'm having trouble reproducing this (with ghc-7.10.1 and haskeline-7.2.1). Maybe this is a problem with ghci not printing the instance? What happens if you actually try to run code that uses them? For example:

Prelude> :m +System.Console.Haskeline Control.Monad.IO.Class 
Prelude System.Console.Haskeline Control.Monad.IO.Class> runInputT defaultSettings $ liftIO $ return "hi"
"hi"

The only other thing I can think of is that maybe haskeline is built from a different version of transformers than what you're importing into ghci?

notogawa commented 9 years ago

Sorry, different version transformer is unexpectedly installed and used. Thanks !