Sergei Meshveliani | 23 May 23:08 2015

overlapping instances in 7.10.1

Dear GHC developers, 

This request overrides my previous one of  "7.10.1-err..."
(it is simpler and more precise).
The archive

presents a question about  ghc-7.10.1.

Make it, please, with  ghc-7.10.1  by   

         ghc $doconCpOpt -O --make Main
$doconCpOpt = 
 -fwarn-unused-matches -fwarn-unused-binds -fwarn-unused-imports 
 -fno-warn-overlapping-patterns -XRecordWildCards -XNamedFieldPuns 
 -XFlexibleContexts -XMultiParamTypeClasses -XUndecidableInstances
 -XTypeSynonymInstances -XFlexibleInstances -fcontext-stack=30

as it is written there in  README.txt.

README.txt  explains which two instances are wrongly resolved
-- as I expect.

In  ghc-7.8.2  they are resolved in a correct way
(and there is a different pragma syntax).
I conclude this from running the test in  docon-2.12.

Am I missing something?
(Continue reading)

Joe Hendrix | 22 May 21:10 2015

Recursive loop in context simplification with GHC 7.10.1


I’m trying to migrate some code that compiles under GHC 7.8.4 to GHC 7.10.1.

It uses the comparison operator (<=) in TypeLits, and seems to get in a recursive loop  when simplifying contexts.

I’ve included part of the output from "-ddump-tc-trace” once it gets stuck in the loop below.

I’d appreciate any help on understanding what is happening.  If it’s useful I could try to extract a
minimal example showing the error, but I thought I’d try to understand what’s happening first.


flatten/flat-cache hit
  GHC.TypeLits.<=? [1, n_abP7[sk]]
Following filled tyvar
  s_aifJ[fuv:0] = 1 GHC.TypeLits.<=? n_abP7[sk]
flatten/flat-cache hit
  GHC.TypeLits.<=? [1, n_abP7[sk]]
Following filled tyvar
  s_aifJ[fuv:0] = 1 GHC.TypeLits.<=? n_abP7[sk]
(Continue reading)

Sergei Meshveliani | 22 May 13:26 2015

error in 7.10.1 ?

Dear GHC developers,

The confirmation token letter from the bug tracker travels too long,  I do not know, why.
Meanwhile I cannot report there.
So, I report it in the below way:

Make it, please, with  ghc-7.10.1   as it is written there in  install.txt,
including making   demotest/Main.

breaks in the middle reporting a DoCon application error

Factorization in  K1[x],  K1  a generic finite extension of a prime
field K = Z/(p) ..
factor f, 
f =  (x^10 + x^7 + x^5 + x^3 + x^2 + (2)*x+ (2))  <-  K[x] =  ((Z/<5>)["t"]/<(t^3 + 4*t + 3)>)["x"]
Domain term of K must contain a Finite field description.

I obtain this for   ghc-7.10.1  made from source by  ghc-7.8.2  on Debian Linux,
x-86, 64 bit.

The story is as follows.


has been tested under   ghc-7.8.2,   and it works.

Now I am trying to port it to  ghc-7.10.1. 
This needs inserting certain pragmas for  OVERLAPPING/OVERLAPPABLE into
some instance declarations.
So I call this port
                           docon-2.12.1.   is the error report  of  docon-2.12.1  to  ghc-7.10.1.

This application has the OVERLAPPABLE pragma set to one instance and the
OVERLAPPING pragma set to many instances.
GHC itself warns of overlaps. Then I
1) set the pragma to the reported instance (pair),
2) recompile the corresponding module
3) rerun
    make configure;  make build.

This process has finished in `making'  the application.
           > cd demotest
           > ghc $doconCpOpt -O --make -rtsopts Main
           > ./Main

produces the above error instead of the test success report.

I suspect that the reason is in treating the instance overlaps
(but there may be another source).

Comparing   docon-2.12  + ghc-7.8.2
to                  7.10.1-errReport-may22-201 + ghc-7.10.1,

can you, please, find:  how to fix the latter version?
Is this a bug in ghc-7.10.1 ?



Glasgow-haskell-users mailing list
Glasgow-haskell-users <at>
Nikita Karetnikov | 22 May 12:06 2015

-Wall and the fail method

Can -Wall be extended to report pattern match failures in do
expressions, like it does for case expressions?

Prelude> :set -Wall
Prelude> let f = do Just x <- return Nothing; return x
Prelude> let g = case Nothing of Just x -> x

<interactive>:9:9: Warning:
    Pattern match(es) are non-exhaustive
    In a case alternative: Patterns not matched: Nothing

One can argue that it's similar to undefined, error, and various
unsafeSomething functions, which I think should be reported as well, if
possible.  But these things can be found already with a simple grep
while a pattern match cannot.

I bet it has been discussed already, but "fail" is a terrible search
term, so I cannot find anything relevant in the archives nor in the bug
Evan Laforge | 21 May 19:49 2015

documentation links broken in 7.10.1

It seems like haddock's index.html generation is broken in 7.10.1.
Namely, it creates links to e.g. Codec-Binary-UTF8-Generic.html when
it should be to utf8-string-1/html/Codec-Binary-UTF8-Generic.html

This is haddock 2.16.0, which comes with the binary distribution for 7.10.1.

I looked at but didn't see
anything related to this, which makes me think it's just me.  You'd
think someone would notice if all documentation links were broken.

Does anyone else see this?
Sergei Meshveliani | 21 May 15:40 2015

overlapping instances 7.10.1


I wrote recently about finding places to set {-# OVERLAPPING #-}
when porting an application from 7.8.2 to 7.10.1.

I am doing this for porting  docon-2.12  from 7.8.2 to 7.10.1.

And  ghc-7.10.1  indeed helped me to find several places to set this
pragma (instead of using the total key -XOverlappingInstances).

Finally, it has come to this module:

Preprocessing library docon-2.12.1...
[48 of 86] Compiling ResRing__  ( ResRing__.hs, dist/build/ResRing__.o )

    Overlapping instances for Eq (Maybe PropValue)
      arising from a use of ‘/=’
    Matching instances:
      instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
      instance (Residue r, Eq a) => Eq (r a) -- Defined in ‘ResEuc0_’
    In the expression: lookup IsGxBasis ps /= Just Yes

As before, I set  
   instance {-# OVERLAPPING #-} (Residue r, Eq a) => Eq (r a)  where

in  ResEuc0_.hs.

But this does not help, the compiler continues with the same report.

I see the difference to previous porting process in that one of the
overlapping instances is of the GHC library, so that I cannot set the
needed overlap pragma for it.

On the other hand, ghc-7.8.2 compiled docon-2.12 successfully.

What my be a way out?



Glasgow-haskell-users mailing list
Glasgow-haskell-users <at>
Sergei Meshveliani | 21 May 14:00 2015

OI in 7.10.1

Please, what is wrong here?

module OI where
class Foo a where foo :: a -> Bool

instance Foo Bool where foo _ = True

data C a = C a

instance {-# OVERLAPPING #-} Foo a => Foo (C a) where foo (C a) = foo a
instance {-# OVERLAPPING #-} Foo (C Bool)       where foo _ = False

By this I intended to test the overlapping instance control. 
I set the pragma as it is shown in the User guide.
    ghc-7.10.1  -c -XFlexibleInstances OI.hs

reports  "Unrecognised pragma".

Please, advise,

Sergei Meshveliani | 20 May 21:52 2015

overlapping instances in 7.10.1

Dear GHC developers,

Please, test  ghc-7.10.1  on making  docon-2.12

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").

        > make install

  runghc Setup.hs install --user
  Installing library in

  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,

Facundo Domínguez | 20 May 17:51 2015

Can GHCi inspect the state of running threads?

   I have a multi-threaded and interactive application that sometimes
stops responding, and it would be helpful being able to inspect the
state when it doesn't.

I thought the GHCi debugger could be useful here, however I see no way
to signal a thread and have GHCi show me its state.

Here is an example GHCi session:

$ cat t.hs
import Control.Concurrent
import Control.Exception
import Control.Monad
import System.IO

spawnThread :: String -> IO ThreadId
spawnThread label =
    forkIO $ flip finally (putStrLn $ "bye " ++ label) $
      forM_ [0..] $ \i -> threadDelay 1000000
$ ghci-7.10.1 t.hs -fbreak-on-exception -v0
*Main> hSetBuffering stdout LineBuffering
*Main> t0 <- spawnThread "t0"
*Main> throwTo t0 (ErrorCall "end")

It looks like I'm not getting the "bye t0" message when stopping the
thread while using -fbreak-on-exception.

Is the debugger supposed to be used like this? Otherwise, is there any
way in which I could inspect the state of a running thread?

Sergei Meshveliani | 19 May 20:59 2015

making 7.10.1

I am trying to `make'  ghc-7.10.1  from source by  ghc-7.8.3
on Debian Linux.
I command

  > ./configure --prefix=/home/mechvel/haskell/ghc/7.10.1/inst0

  > make >& make.log

The former command seems successful:   
  #define HAVE_EVENTFD 1 #define CC_SUPPORTS_TLS 1

  configure: exit 0

The latter command reports 

checking whether to build static libraries... yes
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

And I do not find in  config.log  anything suspicious about  cpp.
config.log  does have several `error' messages, like, say

  conftest.c:9:28: error: ac_nonexistent.h: No such file or directory

But, probably, they are harmless.

Please, how to fix?

Jens Petersen | 13 May 05:28 2015

Fedora ghc-7.10.1 repo


It is a bit later than I wanted but I have prepared a Fedora Copr repo
for ghc-7.10.1.

(note the EPEL7 and F20 builds are currently quick builds and the F21+
builds are perf builds)
I will probably add a cabal-install build soon.

Let me know if you find any problems or if it is useful. :)