[GHC] #14266: AllowAmbiguousTypes doesn't play well with default class methods
GHC
ghc-devs at haskell.org
Thu Sep 21 19:38:33 UTC 2017
#14266: AllowAmbiguousTypes doesn't play well with default class methods
-------------------------------------+-------------------------------------
Reporter: chris-martin | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This example does compile,
{{{
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ExplicitForAll #-}
class A t where
f :: forall x m. Monoid x => t m -> m
f = undefined
instance A [] where
f = undefined
}}}
and it seems that the following really ought to be equivalent to it, since
all I have done is remove a method definition which is identical to the
default:
{{{
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ExplicitForAll #-}
class A t where
f :: forall x m. Monoid x => t m -> m
f = undefined
instance A []
}}}
But instead GHC 8.0.2 gives an error of "Could not deduce (Monoid x0)" on
the instance declaration.
(I've also posed the same question on stackoverflow:
https://stackoverflow.com/q/46350839/402884.)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14266>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list