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

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Wed May 18 08:10:53 CEST 2011


(Re-CC-ing the list)

On 18 May 2011 15:16,  <briand at aracnet.com> wrote:
> On Wed, 18 May 2011 13:52:46 +1000
> Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
>
>> 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).
>>
>
> Well now, that makes perfect sense doesn't it ?
>
> I think my problem is that I think if I import the top-level module then the sub-modules should also be visible, provided I use the full name, or in the case of a qualified name, something link FFT.Base.FFTWReal.
>
> Clearly this is not the case, but why not ?  Is it just the convention that haskell chose, or is there a reason for it ?

Consider Data.ByteString vs Data.ByteString.Lazy; the have the exact
same API but for completely different types.

Also, it's quite often for package foo to have module Data.Foo, and
then module bar extends it with module Data.Foo.Bar; should importing
Data.Foo also bring in Data.Foo.Bar?  What happens if bar isn't
installed?

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



More information about the Haskell-Cafe mailing list