#7173: Unnecessary constraints in inferred type
---------------------------------+------------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Old description:
> Carter Schonwald reports: when playing with the current hackage versions
> of Epic and Idris to make them play nice with ghc7.6rc1
> * http://hackage.haskell.org/package/idris-0.9.2.1
> *http://hackage.haskell.org/package/epic-0.9.3 (current version on
> github now builds on ghc 7.6, https://github.com/edwinb/EpiVM)
>
> I ran into some funny type inference problems. Namely, using the
> idris-0.9.2.1 source and iteratively seeing how ghc complains,
> I repeated found that ghc would infer extraneous class constraints with
> variables that don't appear in the function type!
>
> eg `(Num a, Ord a) => PArg -> Doc`, when the correct type to infer would
> be `PArg -> Doc`.
>
> Here are some gists with links to more info
> https://gist.github.com/3365312
> https://gist.github.com/3365073
> https://gist.github.com/3364775
>
> Anyways, I'm not sure what to make of this, is this a reasonable artifact
> of type inference getting confused on functions with a large number of
> case analyses when various typeclass extensions are enabled? Or Is this
> a bug in terms of what inference should be able to handle?
New description:
Carter Schonwald reports: when playing with the current hackage versions
of Epic and Idris to make them play nice with ghc7.6rc1
* http://hackage.haskell.org/package/idris-0.9.2.1
* http://hackage.haskell.org/package/epic-0.9.3 (current version on
github now builds on ghc 7.6, https://github.com/edwinb/EpiVM)
I ran into some funny type inference problems. Namely, using the
idris-0.9.2.1 source and iteratively seeing how ghc complains,
I repeated found that ghc would infer extraneous class constraints with
variables that don't appear in the function type!
eg `(Num a, Ord a) => PArg -> Doc`, when the correct type to infer would
be `PArg -> Doc`.
Here are some gists with links to more info
https://gist.github.com/3365312
https://gist.github.com/3365073
https://gist.github.com/3364775
Anyways, I'm not sure what to make of this, is this a reasonable artifact
of type inference getting confused on functions with a large number of
case analyses when various typeclass extensions are enabled? Or Is this a
bug in terms of what inference should be able to handle?
--
Comment(by simonpj):
Instructions to reproduce, assuming ghc 7.6 rc, plus having cabal
installed
1. `cabal unpack` the most recent `haskeline`, and fix it so it can
build. This involves updating the `Setup.hs` file for haskeline, as
there's no longer a `Control.Exception.Extensible` (instead its just
`Control.Exception.Base`), so that just needs to be swapped. `cabal
install` that.
2. `git clone https://github.com/cartazio/EpiVM`
3. `cd EpiVM ; git checkout patch-1 ; cabal build ; cabal configure ;
cabal build ; cabal install`
4. Now you can try doing `cabal install idris` and you should get the
following type error message: https://gist.github.com/3405712
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7173#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs