overlapping instances in 7.10.1

Sergei Meshveliani mechvel at botik.ru
Wed May 20 19:52:36 UTC 2015


Dear GHC developers,

Please, test  ghc-7.10.1  on making  docon-2.12  

  http://www.botik.ru/pub/local/Mechveliani/docon/

and running its    demotest/Main
(see install.txt).


docon-2.12  has been tested under  ghc-7.8.2,

and it has 
                 extensions: ... OverlappingInstances 
in  docon.cabal.

Making with  ghc-7.10.1  issues a warning and advises to set the related
pragma individually to each corresponding instance.


(1) First, I ignored this warning, and surprisingly, the library has
been made. 

In the  build/  subdirectory there are  .hi and .o  files,
and there have newly appeared the  "dyn" files:

  Matr0_.dyn_hi Matr0_.dyn_o Matr0_.hi Matr0_.o  ...

(I do not know what does it mean "dyn").

Then,
        > make install
reports 

  runghc Setup.hs install --user
  Installing library in
  /home/mechvel/docon/2.12/docon/source/inst/lib/x86_64-linux-ghc-7.10.1/docon_99cUeE74HI58Sb9XilYAZ2

  Registering docon-2.12.1...

Instead of the  .a  file,  ls  shows there

  docon_99cUeE74HI58Sb9XilYAZ2  docon_JzkSttB1MsX3R5AQ1eIgvC

Are these names intended?

Then I command

  > cd demotest 
  > ghc $doconCpOpt -O -rtsopts --make Main
  > ./Main 

It is built and runs. But breaks in the middle with a certain reasonable
DoCon error message.

The DoCon design is so that choosing a different instance among the
overlapping ones may change the algorithm, and the computation cost, but
still must produce the same result. It must -- unless DoCon has a bug in
some of these instances.


(2) All right, I need to set  {-# OVERLAPPABLE #-}  individually to each
instance which may overlap with some other instance in DoCon.

There is declared a great number of instances. And it occurs difficult
for me to recall now: which instance does overlap with something and
which does not 
(at least they all worked correct in ghc-7.8.2).

Well, I can set  {-# OVERLAPPABLE #-}  to _each_ instance.
But such a program does not look nice.

And I would like to be more definite and to set  {-# OVERLAPPING #-}  to
all appropriate places.
Suppose that I forget that some instance overlaps with something and
skipped this pragma. The above test shows that this can lead to a wrong
program to run
(is this feature intended?).

And what will be the consequence if  {-# OVERLAPPING #-}  is set to an
instance which does not overlap with anything?

Can the compiler help to list the overlaps?

Please, advise,

------
Sergei

 
















More information about the Glasgow-haskell-users mailing list