Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Type information is incomplete. #69

johntyree opened this Issue · 6 comments

5 participants


When using the type features of ghc-mod, it never returns any TypeClass constraints or even the right namespaces. As a result, the types are not 'usable'. For example the type of the following function

import Data.Vector.Unboxed as U
test = U.Singleton (0 :: Int)

is given as Vector Int, but this won't compile because Vector is not in scope at this point, only U.Vector.

A second issue arises with TypeClass constraints. For example, let's require a simple one like so:

fractionalOrElse a b = a / b

ghc-mod reports the type as a -> a -> a, but if we add that type annotation it fails because a is not an instance of Fractional. What we really need is Fractional a => a -> a-> a. Is there anything we can do about this?

@johntyree johntyree referenced this issue in eagletmt/ghcmod-vim

Add type insertion and info preview. #15


Bumping this up. No typeclass constraints and namespaces are being returned in the result. Whereas :type in GHCi works as expected.


Consider this:

import qualified Data.Vector.Unboxed as U

test = U.singleton (0 :: Int)

ghc-mod inserts:

test :: U.Vector Int
test = U.singleton (0 :: Int)

So, qualified is important.


Also consider this:

fractionalOrElse a b = a / b

We can have:

fractionalOrElse :: Fractional a => a -> a -> a
fractionalOrElse a b = a / b

So, no problem or the problem has been fixed.


Yeah this is much improved.


is this issue fixed?

i still can't get constraint.


I think it's broken again, I looked into that a while back and it needs some very black GHC magic foo to get it to work.

@DanielG DanielG reopened this
@DanielG DanielG self-assigned this
@DanielG DanielG added this to the v5.4.0.0 milestone
@lierdakil lierdakil referenced this issue in atom-haskell/ide-haskell

Insert type doesn't put in typeclass #93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.