[Haskell-cafe] Re: some ideas for Haskell', from Python

2009-01-19 Thread ChrisK

Manlio Perillo wrote:

Brandon S. Allbery KF8NH ha scritto:
 >
...in theory. In practice GHC needs help with circular imports, and 
some cycles might be impossible to resolve.




This is interesting.
Where can I find some examples?

Is this explained in the Real World Haskell book?



I have no idea about RWH, but there are certainly mutual import cycles that 
cannot be resolved by using hs-boot files with GHC.


Consider three modules A and B and C, which are A-B-C permutations of


module A(A,AKBC, AKCB)
import B(B,BKAC)
import C(C,CKAB)

data A
AKBC :: Either B C
AKCB :: Either C B

>
> instance Show (A,BKAC,CKAB) where ...

There is no way to break the ?K?? import cycle with just hs-boot files.  I had 
to solve this by generating "helper" modules.


Call the "data A" the rank-1 declarations.  Then the ?K?? are built on rank-1 
types such as "B" and "C" and are rank-2 declarations.  The rank-1 declarations 
can all be put in hs-boot files but the rank-2 declaration import cycle cannot 
be broken with the same hs-boot files.  Some of these need to be put in separate 
modules.


It may be possible to make a useful definition of rank-3 and higher 
declarations.

--
Chris

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: some ideas for Haskell', from Python

2009-01-15 Thread Manlio Perillo

Gleb Alexeyev ha scritto:

Manlio Perillo wrote:


import System.Posix.Files as PF


Try this:

 > import qualified System.Posix.Files as PF

The problem you described should go away.



Ah, thanks!
I really missed the qualified!


Manlio Perillo
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: some ideas for Haskell', from Python

2009-01-15 Thread Gleb Alexeyev

Manlio Perillo wrote:


import System.Posix.Files as PF


Try this:

> import qualified System.Posix.Files as PF

The problem you described should go away.



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe