[Haskell-cafe] why doesn't ghc give you a type signature that works ?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Wed May 18 05:52:46 CEST 2011


On 18 May 2011 13:44,  <briand at aracnet.com> wrote:
> for example:
>
> I will ask the glorious compiler, and it says:
>
> *Main> :t calcFFT
> calcFFT
>  :: (Math.FFT.Base.FFTWReal r) =>
>     V.Vector (Complex r) -> V.Vector (Complex r)
>
> I then put the signature in my code, reload it, and:
>
>  Not in scope: type constructor or class `Math.FFT.Base.FFTWReal'
>
>
> It seems very strange to me that the fully qualified module name doesn't work, nor does any combination thereof, e.g. FFT.FFTWReal, FFT.Base.FFTWReal, etc...
>
> I'm importing FFT as:
>
>  import qualified Math.FFT as FFT

What's happening is that the type involves the FFTWReal class.
However, this isn't immediately visible to ghci as it isn't in scope,
but it can figure out that it's found in Math.FFT.Base.  As such, you
need to import that module as well (as opposed to just the Math.FFT
class you have already imported).

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com



More information about the Haskell-Cafe mailing list