Consider Foo.hs
:
module Foo where
foo :: Num t => t
foo = 3
running ghc-mod -type
on it like this only gives me the type t
for the signature of foo
, even though the declaration already has the full type signature attached to it:
$ ghc-mod type src/Foo.hs 4 1
4 1 4 8 "t"
This becomes highly limiting when wanting to use ghc-mod
for adding a type to a declaration without one.
Is there a way to get the full type from ghc-mod
?
Alternatively, what are the tools one can use in place of ghc-mod
to achieve this? Can these tools be used alongside with ghc-mod
, (for example in Emacs)?
EDIT: stack-ide
too reports the type to be just t
not the full Num t => t
:
[nil] -> {"tag":"RequestGetExpTypes","contents":{"spanFilePath":"src\/Foo.hs","spanFromLine":4,"spanFromColumn":1,"spanToLine":4,"spanToColumn":4}}
<- {"tag":"ResponseGetExpTypes","contents":[["t",{"spanFromLine":4,"spanFilePath":"src/Foo.hs","spanToColumn":4,"spanFromColumn":1,"spanToLine":4}]]}