Re: [GHC] #7505: Commentary shipped with GHC sources is outdated

2012-12-21 Thread GHC
#7505: Commentary shipped with GHC sources is outdated
--+-
Reporter:  jstolarek  |  Owner:  
Type:  bug| Status:  new 
Priority:  normal |  Component:  Documentation   
 Version:  7.7|   Keywords:  
  Os:  Unknown/Multiple   |   Architecture:  Unknown/Multiple
 Failure:  Documentation bug  |  Blockedby:  
Blocking: |Related:  
--+-

Comment(by shelarcy):

 I think that we should update source:compiler/DEPEND-NOTES to refer
 wiki:Commentary/ModuleStructure page, if we remove commentary from GHC
 sources.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #7521: Simplifier ticks exhausted when compiling Accelerate example.

2012-12-21 Thread GHC
#7521: Simplifier ticks exhausted when compiling Accelerate example.
---+
Reporter:  eamsden |  Owner:  
Type:  bug | Status:  new 
Priority:  normal  |  Component:  Compiler
 Version:  7.6.1   |   Keywords:  
  Os:  Linux   |   Architecture:  Unknown/Multiple
 Failure:  Compile-time crash  |  Blockedby:  
Blocking:  |Related:  
---+
 When doing $ cabal build for:

 http://github.com/AccelerateHS/accelerate-examples (commit
 def2495a1e7bd88e444540c3494b8674da99e201)

 [31 of 36] Compiling SMVM.Matrix  (
 examples/tests/simple/SMVM/Matrix.hs, dist_accelerate/build/accelerate-
 examples/accelerate-examples-tmp/SMVM/Matrix.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.6.1 for x86_64-unknown-linux):
 Simplifier ticks exhausted
 When trying UnfoldingDone base:GHC.Base.returnIO1{v r5g} [gid]
 To increase the limit, use -fsimpl-tick-factor=N (default 100)
 If you need to do this, let GHC HQ know, and what factor you needed
 To see detailed counts use -ddump-simpl-stats
 Total ticks: 27960

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7361: Segmentation fault on 5f37e0c71ff4af8539c5aebc739b006b4f0c6ebf

2012-12-21 Thread GHC
#7361: Segmentation fault on 5f37e0c71ff4af8539c5aebc739b006b4f0c6ebf
-+--
Reporter:  bgamari   |   Owner:  simonmar
Type:  bug   |  Status:  new 
Priority:  highest   |   Milestone:  7.8.1   
   Component:  Compiler  | Version:  7.7 
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  Runtime crash   
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--

Comment(by bgamari):

 Simon, can I do anything else to help here?

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: DoCon and GHC

2012-12-21 Thread Serge D. Mechveliani
On Fri, Dec 21, 2012 at 01:45:04PM +, Simon Peyton-Jones wrote:
> OK, do this
> 
> * {-# LANGUAGE ScopedTypeVariables, MonoLocalBinds #-}
> 
> * import Categs( Domains1 )
> 
> * Add type sig for dP'
> dP' :: (LinSolvRing (Pol a), CommutativeRing a) => Domains1 (Pol a)
> 
> Then it compiles.
> 
> You are very close to the edge of what can be done!


It works. Thank you.

There remains only a single unlucky module:  T_cubeext.
The test  demotest/Main  works with exception of  T_cubeext,
but I need  T_cubeext.cubicExt  to work.

Please, continue the test with

  make install
  cd demotest
  ghc $doconCpOpt --make Main

(for  $doconCpOpt =  
  -fwarn-unused-matches -fwarn-unused-binds -fwarn-unused-imports 
  -fno-warn-overlapping-patterns -XRecordWildCards -XNamedFieldPuns 
  -XFlexibleContexts -XMultiParamTypeClasses -XUndecidableInstances 
  -XTypeSynonymInstances -XFlexibleInstances -XOverlappingInstances
).

It reports

--
...
T_cubeext.hs:102:20:
Could not deduce (k ~ k1)
from the context (Field k, FactorizationRing (UPol k))
  bound by the type signature for
 cubicExt :: (Field k, FactorizationRing (UPol k)) =>
 k -> k -> Domains1 k -> (Domains1 (E k), [E k], k 
-> E k)
  at T_cubeext.hs:(79,13)-(80,69)
or from (Field k1, FactorizationRing (UPol k1))
  bound by the type signature for
 unA :: (Field k1, FactorizationRing (UPol k1)) => UPol k1
  at T_cubeext.hs:101:9-56
  `k' is a rigid type variable bound by
  the type signature for
cubicExt :: (Field k, FactorizationRing (UPol k)) =>
k -> k -> Domains1 k -> (Domains1 (E k), [E k], k -> E 
k)
  at T_cubeext.hs:79:13
  `k1' is a rigid type variable bound by
   the type signature for
 unA :: (Field k1, FactorizationRing (UPol k1)) => UPol k1
   at T_cubeext.hs:101:9
Expected type: Domains1 k1
  Actual type: Domains1 k
In the second argument of `cToUPol', namely `dK'
In the expression: cToUPol "d" dK unK
In an equation for `unA': unA = cToUPol "d" dK unK

T_cubeext.hs:105:7:
Overlapping instances for LinSolvRing (UPol k1)
  arising from a use of `upEucRing'
Matching instances:
  instance [overlap ok] EuclideanRing a => LinSolvRing (UPol a)
-- Defined in `docon-2.12:Pol2_'
  instance [overlap ok] (LinSolvRing (Pol a), CommutativeRing a) =>
LinSolvRing (UPol (Pol a))
...
--

I tried  {-# LANGUAGE ScopedTypeVariables, MonoLocalBinds #-},
and setting type signatures in various parts in  cubicExt.
But this does not help.

There is another point. In 
 ``cubicExt :: (Field k, FactorizationRing (UPol k)) => ...''

the part   ``, FactorizationRing (UPol k)''  (1)

was always considered as parasitic.  ghc-7.4.1  needs (1) to work,
and at least  ghc-7.4.1  does compile the test.

I thought, may be, the future compilers will allow to omit this part.
At least it is desirable for  ghc-7.6.2  to do the test in any variant,
with (1) or without it. 

Regards,

--
Sergei

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #7520: Implement cardinality analysis

2012-12-21 Thread GHC
#7520: Implement cardinality analysis
-+--
Reporter:  simonpj   |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  
   Component:  Compiler  | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--
 Ilya is well on the way to a cardinality analyser.  Today I realised that
 it'll help a lot with CPS-heavy code.  For example, here's what happens
 with
 {{{
 data DT = DT {
 field1 :: Int
   , field2 :: Int
   , field3 :: Int }
   deriving( Read )
 }}}
 After strictness analysis and simplification we get this:
 {{{
 $wa_sD5 =
   \ (ww_sD1 :: GHC.Prim.Int#)
 (@ b_awu)
 (w_sD3 :: W2.DT -> Text.ParserCombinators.ReadP.P b_awu) ->
 case GHC.Prim.<=# ww_sD1 11 of _ {
   GHC.Types.False -> Text.ParserCombinators.ReadP.Fail @ b_awu;
   GHC.Types.True ->
 Text.Read.Lex.expect1
   a_su6
   @ b_awu
   (\ _ ->
  Text.Read.Lex.expect1
a_suf
@ b_awu
(\ _ ->
   Text.Read.Lex.expect1
 a_sum
 @ b_awu
 (\ _ ->
Text.Read.Lex.expect1
  a_suv
  @ b_awu
  (\ _ ->
 GHC.Read.$fReadInt5
   GHC.Read.$fReadInt_$sconvertInt
   Text.ParserCombinators.ReadPrec.minPrec
   @ b_awu
   (\ (a2_XB0 [Dmd=Just L] :: GHC.Types.Int) ->
  Text.Read.Lex.expect1
lvl_svA
@ b_awu
(\ _ ->
   Text.Read.Lex.expect1
 lvl_svE
 @ b_awu
 (\ _ ->
Text.Read.Lex.expect1
  lvl_svI
  @ b_awu
  (\ _ ->
 GHC.Read.$fReadInt5
 GHC.Read.$fReadInt_$sconvertInt
 Text.ParserCombinators.ReadPrec.minPrec
   @ b_awu
   (\ (a2_XBa [Dmd=Just L]
 :: GHC.Types.Int) ->
 ...
 }}}
 Look at all those nested continuations! Then the subsequent float-out pass
 floats out lots of MFEs, but entirely fruitlessly because all these are
 actually one-shot lambdas.

 I'm not certain that the analysis will catch them all, but it might.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7360: Case-of-identical-alts optimisation fails abjectly

2012-12-21 Thread GHC
#7360: Case-of-identical-alts optimisation fails abjectly
-+--
Reporter:  simonpj   |   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Milestone:  
   Component:  Compiler  | Version:  7.6.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--

Comment(by simonpj):

 See also #7378

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7436: Derived Foldable and Traversable instances become extremely inefficient due to eta-expansion

2012-12-21 Thread GHC
#7436: Derived Foldable and Traversable instances become extremely inefficient 
due
to eta-expansion
-+--
Reporter:  shachaf   |   Owner: 
Type:  bug   |  Status:  patch  
Priority:  normal|   Milestone: 
   Component:  Compiler  | Version:  7.6.1  
Keywords:|  Os:  Unknown/Multiple   
Architecture:  Unknown/Multiple  | Failure:  Runtime performance bug
  Difficulty:  Unknown   |Testcase: 
   Blockedby:|Blocking: 
 Related:|  
-+--
Changes (by simonpj):

 * cc: twanvl, dreixel (added)


Comment:

 OK, let's wrap this one up.

  * Thank you for the patch.  Are you confident that it's good to go?
 '''Pedro''' I believe that you were responsible for at least some of the
 `Traversable` deriving code; can you give an opinion?

  * I wonder if you could add some comments to explain the construction?
 As you say, it may generate slightly strange code.  Something like `Note
 [Avoid eta-expanded code]` with a compact explanation, an example, and a
 pointer to this ticket, would be useful.

  * Are there are there any library changes?

  * I looked at the eta-expansion thing.  Yes, GHC is doing the right thing
 here, as you show.  You might wonder why GHC doesn't eta-reduce `(\e -> s
 e)` to `s`.  The reason is that doing so is unsound if `s` is bottom; then
 eta-reduction might turn a terminating program into a non-terminating one.

 Then I'll commit it.

 Simon

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7162: RULES that never fire (automatically)

2012-12-21 Thread GHC
#7162: RULES that never fire (automatically)
---+
  Reporter:  andygill  |  Owner:  
  Type:  feature request   | Status:  closed  
  Priority:  normal|  Milestone:  7.8.1   
 Component:  Compiler  |Version:  7.7 
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:|  Blockedby:  
  Blocking:|Related:  
---+
Changes (by simonpj):

  * status:  patch => closed
  * resolution:  => fixed


Comment:

 OK I've pushed this
 {{{
 commit c56c355b0f5504f8afd062ca4c78a8bb40905299
 Author: Andrew Farmer 
 Date:   Thu Dec 6 15:47:33 2012 -0600

 Only allow special NeverActive syntax for RULES.

  compiler/parser/Parser.y.pp   |   17 +
  docs/users_guide/glasgow_exts.xml |3 +++
  2 files changed, 16 insertions(+), 4 deletions(-)
 }}}
 plus an extra sentence in the docs
 {{{
 commit d3e2912ac2048346828539e0dfef6c0cefef0d38
 Author: Simon Peyton Jones 
 Date:   Fri Dec 21 13:17:26 2012 +

 Clarify documentation of [~] syntax on RULE activations

  docs/users_guide/glasgow_exts.xml |3 +++
  1 file changed, 3 insertions(+)
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7513: ghc panic in kindFunResult

2012-12-21 Thread GHC
#7513: ghc panic in kindFunResult
---+
  Reporter:  ifigueroap|  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  7.4.1   
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:|  Blockedby:  
  Blocking:|Related:  
---+
Changes (by simonpj):

  * status:  infoneeded => closed
  * resolution:  => fixed


Comment:

 I'm guessing that it's the same, and it's fixed in HEAD, so I'll close
 this ticket.  Reopen if you subsequently discover that HEAD doens't work
 for you.  Thanks!

 Simon

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


ticket/4361

2012-12-21 Thread Serge D. Mechveliani
Copying to the `bugs' list:


On Fri, Dec 21, 2012 at 12:12:09PM +, Simon Peyton-Jones wrote:
> sigh. i suppose I have to reproduce it.  I have only docon2.12-pre, and I get
>
> make build
> runghc Setup.hs build
> Building docon-2.12...
> Preprocessing library docon-2.12...
>
> on the commandline: Warning:
> -no-user-package-conf is deprecated: Use -no-user-package-db instead
>
> DExport.hs:26:8:
> Ambiguous module name `Prelude':
>   it was found in multiple packages: base haskell98-2.0.0.3
> make: *** [build] Error 1
> simonpj@cam-05-unx:~/tmp/docon-2.12-pre/docon/source$
>
>
> How to fix?


  http://botik.ru/pub/local/Mechveliani/ghcQuest/d212-pre-asBug.zip

Please, try to compile this  d212-pre-asBug

-- as it is written there in  install.txt.

I do not know, may be, this   docon2.12-pre  is a smaller report,
if this is essential, and if you still need  docon2.12-pre,
then you could change things in it according to the corresponding
points in  d212-pre-asBug.

But I hoope   d212-pre-asBug  will do.
The responsible module is  Pol3_.hs.

Regards,

--
Sergei


> | -Original Message-
> | From: Serge D. Mechveliani [mailto:mech...@botik.ru]
> | Sent: 21 December 2012 11:48
> | To: Simon Peyton-Jones
> | Cc: glasgow-haskell-bugs@haskell.org
> | Subject: Re: DoCon and GHC
> |
> | On Fri, Dec 21, 2012 at 11:26:30AM +, Simon Peyton-Jones wrote:
> | > I think you need to remove the 'forall a' on the type signature for
> | dP'.
> | > The 'a' you mean is the 'a' from the instance declaration, not a
> | > completely fresh 'a'.
> |
> | This looks reasonable.
> |
> | > Moreover I don't think you need the 'forall' on the 'instance'
> | declaration.
> | > Just 'ScopedTypeVariables' should do it
> |
> | [..]


> | -- Pol3_.hs 
> | ...
> | {-# LANGUAGE ScopedTypeVariables #-}-- (1)
> | **
> |
> | instance (LinSolvRing (Pol a), CommutativeRing a) =>
> | [..]

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7515: reinitializeGlobals doesn't reinitialize dynamic flags

2012-12-21 Thread GHC
#7515: reinitializeGlobals doesn't reinitialize dynamic flags
---+
  Reporter:  danielv   |  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  7.6.1   
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:|  Blockedby:  
  Blocking:|Related:  
---+
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => fixed


Comment:

 Pushed as
 {{{
 commit 66fa1886769c9e4b7aec4d278a797538a6220ced
 Author: Daniel Vainsencher 
 Date:   Thu Dec 13 18:19:43 2012 +

 Likely fix to uninitialized DynFlags in plugins.
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7488: Promotion of newtypes

2012-12-21 Thread GHC
#7488: Promotion of newtypes
---+
  Reporter:  dreixel   |  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  7.7 
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:  polykinds/T7488   |  Blockedby:  
  Blocking:|Related:  
---+

Comment(by simonpj@…):

 commit b8739b28f5bc855b7c5406425b516698cf3b2f0d
 {{{
 Author: Simon Peyton Jones 
 Date:   Fri Dec 21 08:05:58 2012 +

 Allow newtypes to be promoted

 Fixes Trac #7488

  compiler/basicTypes/DataCon.lhs |5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7513: ghc panic in kindFunResult

2012-12-21 Thread GHC
#7513: ghc panic in kindFunResult
-+--
Reporter:  ifigueroap|   Owner:  
Type:  bug   |  Status:  infoneeded  
Priority:  normal|   Milestone:  
   Component:  Compiler  | Version:  7.4.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--

Comment(by ifigueroap):

 Since then I modified my code to work correctly...
 If you think it is not a duplicate of #7368, I think I can search my svn
 history and provide the full project version that triggers the error.

 Replying to [comment:4 ifigueroap]:
 > I'm sorry, I don't have a minimal reproducible example. The error
 ocurred when I was working in monadic code and I put a wrong type
 annotation, something like:
 >
 > {{{
 > do current <- getCurrent :: m (M m)
 > }}}
 >
 > the annotation was wrong because the type of getCurrent was actually
 >
 > {{{
 > (AOT (MbT m)) (M m)
 > }}}
 >
 > where AOT and MbT are some custom monad transformers

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7513: ghc panic in kindFunResult

2012-12-21 Thread GHC
#7513: ghc panic in kindFunResult
-+--
Reporter:  ifigueroap|   Owner:  
Type:  bug   |  Status:  infoneeded  
Priority:  normal|   Milestone:  
   Component:  Compiler  | Version:  7.4.1   
Keywords:|  Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
  Difficulty:  Unknown   |Testcase:  
   Blockedby:|Blocking:  
 Related:|  
-+--

Comment(by ifigueroap):

 I'm sorry, I don't have a minimal reproducible example. The error ocurred
 when I was working in monadic code and I put a wrong type annotation,
 something like:

 {{{
 do current <- getCurrent :: m (M m)
 }}}

 the annotation was wrong because the type of getCurrent was actually

 {{{
 (AOT (MbT m)) (M m)
 }}}

 where AOT and MbT are some custom monad transformers

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: DoCon and GHC

2012-12-21 Thread Serge D. Mechveliani
On Fri, Dec 21, 2012 at 11:26:30AM +, Simon Peyton-Jones wrote:
> I think you need to remove the 'forall a' on the type signature for dP'.  
> The 'a' you mean is the 'a' from the instance declaration, not a 
> completely fresh 'a'.

This looks reasonable.

> Moreover I don't think you need the 'forall' on the 'instance' declaration. 
> Just 'ScopedTypeVariables' should do it


All right, I try to follow both instructions:


-- docon.cabal  -
...
extensions:
   TypeSynonymInstances UndecidableInstances FlexibleContexts
   FlexibleInstances MultiParamTypeClasses OverlappingInstances
   RecordWildCards NamedFieldPuns DoAndIfThenElse
   .
ghc-options:
-fno-warn-overlapping-patterns -fwarn-unused-binds
-fwarn-unused-matches -fwarn-unused-imports
-XRankNTypes  -- ** probably, it spoils nothing
-O
---


-- Pol3_.hs 
... 
{-# LANGUAGE ScopedTypeVariables #-}-- (1) **
 
instance (LinSolvRing (Pol a), CommutativeRing a) =>
   LinSolvRing (UPol (Pol a))
   where
   gxBasis []   = ([], [])
   gxBasis fs@(f:_) = (map back gs, mapmap back mt)
 where
 UPol _ p y dP= f
 (o, n)   = (pPPO p, genLength $ pVars p)
 (toLex, fromLex) = (reordPol $ lexPPO n, reordPol o)
 p'   = (toLex p) `asTypeOf` p  -- (2) **

 dP' :: (LinSolvRing (Pol a), CommutativeRing a) => -- (3) **
Domains1 (Pol a)
 dP' = upLinSolvRing p' Map.empty
 s' = cToUPol y dP' p'
 toOverP'   = ct s' . map (\ (a, j) -> (toLex a,   j)) . upolMons
 fromOverP' = ct f  . map (\ (a, j) -> (fromLex a, j)) . upolMons
 back = fromOverP' . headVarPol dP
 (gs, mt) = gxBasis $ map (fromHeadVarPol . toOverP') fs
-


This does not help:

-
Pol3_.hs:328:25:
Could not deduce (a ~ a1)
from the context (CommutativeRing (UPol (Pol a)),
  MulMonoid (UPol (Pol a)),
  LinSolvRing (Pol a),
  CommutativeRing a)
  bound by the instance declaration at Pol3_.hs:(313,10)-(314,72)
or from (LinSolvRing (Pol a1), CommutativeRing a1)
  bound by the type signature for
 dP' :: (LinSolvRing (Pol a1), CommutativeRing a1) =>
Domains1 (Pol a1)
  at Pol3_.hs:327:12-71
  `a' is a rigid type variable bound by
  the instance declaration at Pol3_.hs:313:10
  `a1' is a rigid type variable bound by
   the type signature for
 dP' :: (LinSolvRing (Pol a1), CommutativeRing a1) =>
Domains1 (Pol a1)
   at Pol3_.hs:327:12
Expected type: Pol a1
  Actual type: Pol a
In the first argument of `upLinSolvRing', namely p'
In the expression: upLinSolvRing p' Map.empty
In an equation for dP': dP' = upLinSolvRing p' Map.empty

Pol3_.hs:331:20:
Could not deduce (EuclideanRing a) arising from a use of dP'
from the context (CommutativeRing (UPol (Pol a)),
  MulMonoid (UPol (Pol a)),
  LinSolvRing (Pol a),
  CommutativeRing a)
  bound by the instance declaration at Pol3_.hs:(313,10)-(314,72)
Possible fix:
 add (EuclideanRing a) to the context of the instance declaration
In the second argument of `cToUPol', namely dP'
In the expression: cToUPol y dP' p'
In an equation for s': s' = cToUPol y dP' p'
--


Regards,

--
Sergei

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: DoCon and GHC

2012-12-21 Thread Serge D. Mechveliani
On Fri, Dec 21, 2012 at 10:12:38AM +, Simon Peyton-Jones wrote:
> I would not use -XMonoLocalBinds for all modules -- that will force you to do 
> more work.
> Instead use it just for the offending Pol3_ module, via {-# LANGUAGE 
> MonoLocalBinds #-}
> 
> Or, probably better, give a type signature inside moduloBasisx, as suggested 
> in the http://hackage.haskell.org/trac/ghc/ticket/4361.  The signature is 
> better because it also makes the program easier to understand!
> 
> Simon
>
> [..]

> | > * Alterantively, give a type signature for x, thus (in this case)
> | >
> | >   moduloBasisx p = let x :: ()
> | >x = upLinSolvRing p
> | >in ()


Now, I am trying  ghc-7.6.1.20121207  built from source on Debian Linux.

-- docon.cabal  -
...
extensions:
  TypeSynonymInstances UndecidableInstances FlexibleContexts
  FlexibleInstances MultiParamTypeClasses OverlappingInstances
  RecordWildCards NamedFieldPuns DoAndIfThenElse
  .
ghc-options:
   -fno-warn-overlapping-patterns -fwarn-unused-binds
   -fwarn-unused-matches -fwarn-unused-imports  
   -XRankNTypes  -- new
   -O
---

`make build'  fails at  Pol3_.hs,  at compiling this instance


-- Pol3_.hs 
...

{-# LANGUAGE ScopedTypeVariables #-}-- (1) **

instance forall a. (LinSolvRing (Pol a), CommutativeRing a) => -- (2) **
  LinSolvRing (UPol (Pol a))
  where
  -- gxBasis  in  P[y],  P = a[x1..xn]. 
  -- Map to  a[y,x1..xn]  apply  gxBasis there,  return to  P:   

  gxBasis []   = ([], [])
  gxBasis fs@(f:_) = (map back gs, mapmap back mt)
where
UPol _ p y dP= f
(o, n)   = (pPPO p, genLength $ pVars p)
(toLex, fromLex) = (reordPol $ lexPPO n, reordPol o)
p'   = (toLex p) `asTypeOf` p   -- (3) **

dP' :: forall a. (LinSolvRing (Pol a), CommutativeRing a) =>  -- (4) **
Domains1 (Pol a)
dP' = upLinSolvRing p' Map.empty
  -- p needs lexPPO reordering, then,
  -- its domain bundle needs change too  
s' = cToUPol y dP' p'
  -- sample for P'[y],  P' = a[x1..xn]  with lexComp  
toOverP'   = ct s' . map (\ (a, j) -> (toLex a,   j)) . upolMons
fromOverP' = ct f  . map (\ (a, j) -> (fromLex a, j)) . upolMons
  -- P[y] <--> P'[y]
back = fromOverP' . headVarPol dP
(gs, mt) = gxBasis $ map (fromHeadVarPol . toOverP') fs
-

What is newly added: 
1)  -XRankNTypes  to  docon.cabal  -- in order to allow  `forall'  to
   `instance'.
2) {-# LANGUAGE ScopedTypeVariables #-}   -- to support explicit 
   polymorphic type signatures in the instance implementation,
3) asTypeOf  for  p',
4) Explicit signature for   dP'.

The report is similar as the old one:


Pol3_.hs:328:25:
Could not deduce (a ~ a1)
from the context (CommutativeRing (UPol (Pol a)),
  MulMonoid (UPol (Pol a)),
  LinSolvRing (Pol a),
  CommutativeRing a)
  bound by the instance declaration at Pol3_.hs:(313,10)-(314,72)
or from (LinSolvRing (Pol a1), CommutativeRing a1)
  bound by the type signature for
 dP' :: (LinSolvRing (Pol a1), CommutativeRing a1) =>
Domains1 (Pol a1)
  at Pol3_.hs:327:12-71
  `a' is a rigid type variable bound by
  the instance declaration at Pol3_.hs:313:17
  `a1' is a rigid type variable bound by
   the type signature for
 dP' :: (LinSolvRing (Pol a1), CommutativeRing a1) =>
Domains1 (Pol a1)
   at Pol3_.hs:327:12
Expected type: Pol a1
  Actual type: Pol a
In the first argument of `upLinSolvRing', namely p'
In the expression: upLinSolvRing p' Map.empty
In an equation for dP': dP' = upLinSolvRing p' Map.empty

Pol3_.hs:331:20:
Could not deduce (EuclideanRing a) arising from a use of dP'
from the context (CommutativeRing (UPol (Pol a)),
  MulMonoid (UPol (Pol a)),
  LinSolvRing (Pol a),
  CommutativeRing a)
  bound by the instance declaration at Pol3_.hs:(313,10)-(314,72)
Possible fix:
  add (EuclideanRing a) to the context of the instance declaration
In the second argument of `cToUPol', namely dP'
In the expression: cToUPol y dP' p'
In an equation for s': s' = cToUPol y dP' p'
-


ghc-7.4.1 compiles everythin

RE: DoCon and GHC

2012-12-21 Thread Simon Peyton-Jones
I would not use -XMonoLocalBinds for all modules -- that will force you to do 
more work.
Instead use it just for the offending Pol3_ module, via {-# LANGUAGE 
MonoLocalBinds #-}

Or, probably better, give a type signature inside moduloBasisx, as suggested in 
the http://hackage.haskell.org/trac/ghc/ticket/4361.  The signature is better 
because it also makes the program easier to understand!

Simon

| -Original Message-
| From: Serge D. Mechveliani [mailto:mech...@botik.ru]
| Sent: 21 December 2012 10:08
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-bugs@haskell.org
| Subject: Re: DoCon and GHC
| 
| On Wed, Jun 20, 2012 at 04:56:01PM +, Simon Peyton-Jones wrote:
| > Serge
| >
| > I hope you are well.
| >
| > I'm making a significant simplification to the type inference engine,
| > which will have a small knock-on effect in DoCon.
| >
| > I implemented a VERY DELICATE HACK to solve your problem before, but
| > it has become a significant problem to maintain the hack, so I'm
| taking it out.
| >
| > See http://hackage.haskell.org/trac/ghc/ticket/4361, and the comments
| > I have added there, which tell you what change to make.  It's very
| minor!
| >
| > This will take effect from GHC 7.6 onwards.  Thanks
| >
| > Simon
| 
| 
| This is on Ticket #4361  "(closed bug: fixed)"
| about compiling  DoCon.
| 
| Its story is as follows.
| 
| * 7.4.0  failed to compile the module  Pol3_  in DoCon due to
|   1) a certain GHC manner of  constraint simplification  (as Simon
| wrote)
|   2) a due to complex enough constraints used in DoCon, in particular,
|  instance (LinSolvRing (Pol a), CommutativeRing a) =>
|   LinSolvRing (UPol (Pol a))
|  set in Pol3_.hs
|  (I do not know how to simplify this constraint without loosing
|   generality).
| 
| * 7.4.1  does compile it, but, as Simon wrote, applies for this a very
|   specific and unstable compilation method.
| * 7.6+  removes this latter method, and  Simon P. Jones concludes
| 
| > Happily, it's extremely easy to fix your source code in either of
| > these two ways:
| >
| > * If you use -XMonoLocalBinds (which is in any case implied by -XGADTs
| >   and -XTypeFamilies), then GHC won't generalise the definition of x
| >in the example, and all will be well.
| >
| > * Alterantively, give a type signature for x, thus (in this case)
| >
| >   moduloBasisx p = let x :: ()
| >x = upLinSolvRing p
| >in ()
| 
| 
| 
| Now, I am trying  ghc-7.6.1.20121207  built from source on Debian Linux.
| 
| 
| I. I try adding   -XMonoLocalBinds   for compiling  DoCon:
| 
| 
| -- doco.cabal  --- ...
| ghc-options:
|   -fno-warn-overlapping-patterns -fwarn-unused-binds
|   -fwarn-unused-matches -fwarn-unused-imports  -XMonoLocalBinds
|   -O
| --
| 
| `make build'  fails at the first module:
| 
| --
| module Prelude_
| where
| ...
| instance (DShow a, DShow b) => DShow (a, b)
|   ...
|   where
|   dShows opts (x, y) =  showChar '(' . shows1 x . showString sep .
| shows1 y . showChar ')'   --
| line 628
| where
| opts'= addToShowOptions (- 1) $ opts {parInShow = Parens}
| sep  = fieldSeparator opts
| shows1 x = (case parInShow opts of Parens -> id
|_  -> unparensUpper "()")
|. dShows opts' x
| 
|   aShows (a, b) =  showString "(pair " . aShows a . showChar ' ' .
|aShows b . showChar ')'
| --
| 
| The report is
| 
| runghc Setup.hs build
| Building docon-2.12...
| Preprocessing library docon-2.12...
| [ 1 of 84] Compiling Prelude_ ( Prelude_.hs,
| dist/build/Prelude_.o )
| 
| Prelude_.hs:628:32:
| Could not deduce (a ~ b)
| from the context (DShow a, DShow b)
|   bound by the instance declaration at Prelude_.hs:622:10-43
|   `a' is a rigid type variable bound by
|   the instance declaration at Prelude_.hs:622:10
|   `b' is a rigid type variable bound by
|   the instance declaration at Prelude_.hs:622:10
| In the first argument of `shows1', namely `y'
| In the first argument of `(.)', namely `shows1 y'
| In the second argument of `(.)', namely shows1 y . showChar ')'
| ...
| ---
| 
| The line 628 is marked in the code as  "-- line 628".
| 
| 
| I suspect that besides  -XMonoLocalBinds, I need also to add some
| explicit type signatures, for example,
|   dShows opts (x, y) = showChar '(' . shows1 (x :: DShow a => a) .
|...
| 
| Because GHC, probably, finds some contradiction in applying  shows1 to
| x :: a  and to  y :: b.
| 
| 
| II. My another attempt will be  removing  -XMonoLocalBinds
| (with this, it compiles many modul

Re: DoCon and GHC

2012-12-21 Thread Serge D. Mechveliani
On Wed, Jun 20, 2012 at 04:56:01PM +, Simon Peyton-Jones wrote:
> Serge
> 
> I hope you are well.
> 
> I'm making a significant simplification to the type inference engine, 
> which will have a small knock-on effect in DoCon.
> 
> I implemented a VERY DELICATE HACK to solve your problem before, but it 
> has become a significant problem to maintain the hack, so I'm taking it out.
> 
> See http://hackage.haskell.org/trac/ghc/ticket/4361, and the comments I 
> have added there, which tell you what change to make.  It's very minor!
> 
> This will take effect from GHC 7.6 onwards.  Thanks
> 
> Simon


This is on Ticket #4361  "(closed bug: fixed)" 
about compiling  DoCon.

Its story is as follows.
 
* 7.4.0  failed to compile the module  Pol3_  in DoCon due to 
  1) a certain GHC manner of  constraint simplification  (as Simon wrote)
  2) a due to complex enough constraints used in DoCon, in particular,  
 instance (LinSolvRing (Pol a), CommutativeRing a) =>
  LinSolvRing (UPol (Pol a))
 set in Pol3_.hs
 (I do not know how to simplify this constraint without loosing 
  generality).

* 7.4.1  does compile it, but, as Simon wrote, applies for this a very 
  specific and unstable compilation method.
* 7.6+  removes this latter method, and  Simon P. Jones concludes 

> Happily, it's extremely easy to fix your source code in either of 
> these two ways:
>
> * If you use -XMonoLocalBinds (which is in any case implied by -XGADTs 
>   and -XTypeFamilies), then GHC won't generalise the definition of x 
>in the example, and all will be well. 
>
> * Alterantively, give a type signature for x, thus (in this case)
>
>   moduloBasisx p = let x :: ()
>x = upLinSolvRing p
>in ()



Now, I am trying  ghc-7.6.1.20121207  built from source on Debian Linux. 


I. I try adding   -XMonoLocalBinds   for compiling  DoCon:


-- doco.cabal  ---
...
ghc-options:
  -fno-warn-overlapping-patterns -fwarn-unused-binds
  -fwarn-unused-matches -fwarn-unused-imports  -XMonoLocalBinds
  -O
--

`make build'  fails at the first module:

--
module Prelude_ 
where
...
instance (DShow a, DShow b) => DShow (a, b)
  ...
  where
  dShows opts (x, y) =  showChar '(' . shows1 x . showString sep .
shows1 y . showChar ')'   -- line 628
where
opts'= addToShowOptions (- 1) $ opts {parInShow = Parens}
sep  = fieldSeparator opts
shows1 x = (case parInShow opts of Parens -> id
   _  -> unparensUpper "()")
   . dShows opts' x

  aShows (a, b) =  showString "(pair " . aShows a . showChar ' ' .
   aShows b . showChar ')'
--

The report is

runghc Setup.hs build
Building docon-2.12...
Preprocessing library docon-2.12...
[ 1 of 84] Compiling Prelude_ ( Prelude_.hs, dist/build/Prelude_.o )

Prelude_.hs:628:32:
Could not deduce (a ~ b)
from the context (DShow a, DShow b)
  bound by the instance declaration at Prelude_.hs:622:10-43
  `a' is a rigid type variable bound by
  the instance declaration at Prelude_.hs:622:10
  `b' is a rigid type variable bound by
  the instance declaration at Prelude_.hs:622:10
In the first argument of `shows1', namely `y'
In the first argument of `(.)', namely `shows1 y'
In the second argument of `(.)', namely shows1 y . showChar ')'
...
---

The line 628 is marked in the code as  "-- line 628".

 
I suspect that besides  -XMonoLocalBinds,
I need also to add some explicit type signatures,
for example,
  dShows opts (x, y) = showChar '(' . shows1 (x :: DShow a => a) . 
   ...

Because GHC, probably, finds some contradiction in applying  shows1  
to  x :: a  and to  y :: b. 


II. My another attempt will be  removing  -XMonoLocalBinds
(with this, it compiles many modules and stops at  Pol3.hs)
and inserting a type signature in an appropriate place
(this will also need to add  ScopedTypeVariables + `forall'
-- thanks to people for hints
). 

If (II) works, then it will be, probably less restrictive than (I).

This is just the current report of my attempt to compile DoCon with GHC.

--
Sergei


___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: DoCon and GHC

2012-12-21 Thread Serge D. Mechveliani
On Thu, Dec 20, 2012 at 07:57:45PM +, Simon Peyton-Jones wrote:
> |  It looks like   http://hackage.haskell.org
> |  
> |  is not valid now. Is this due to the recently announced e-mail lists
> |  reorganization?
> 
> It's working fine for me.  No reorganisation there.
> 
> Simon
> 

Today it is accessible for me two.
And yesterday, I had access to  http://haskell.org  
but not to  http://hackage.haskell.org

All right, may be sevaral middle servers where out.

--
Sergei

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #7488: Promotion of newtypes

2012-12-21 Thread GHC
#7488: Promotion of newtypes
---+
  Reporter:  dreixel   |  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  7.7 
Resolution:  fixed |   Keywords:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  | Difficulty:  Unknown 
  Testcase:  polykinds/T7488   |  Blockedby:  
  Blocking:|Related:  
---+
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => fixed
  * testcase:  => polykinds/T7488


Comment:

 Right, I've fixed this.

 Simon

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs