Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Type information is incomplete. #69

Closed
johntyree opened this Issue · 4 comments

3 participants

@johntyree

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
Merged

Add type insertion and info preview. #15

@Placinta

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

@kazu-yamamoto

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.

@kazu-yamamoto

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.

@johntyree

Yeah this is much improved.

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.