#5830: Arrow if/then/else sugar breaks type inference
---------------------------------------+------------------------------------
Reporter: jamey | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.4 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: GHC rejects valid program | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------------+------------------------------------
Starting in GHC 7.0, using the Arrows if/then/else syntactic sugar for
ArrowChoice doesn't propagate type constraints the way I expect. This bug
still exists in 7.2.
The expected type of the result of the conditional should constrain the
type of each branch of the conditional. Instead, the branches remain
unconstrained. If the arrow in the branches is polymorphic and its
argument type doesn't completely constrain its result (I used "read" in
this test case) then GHC reports that the types are ambiguous:
{{{
Ambiguous type variable `c0' in the constraint:
(Read c0) arising from a use of `read'
}}}
Using the case-expression sugar instead works fine.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5830>
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