[GHC] #12923: MultiParamTypeClasses + ExtendedDefaultRules
GHC
ghc-devs at haskell.org
Sun Dec 4 08:04:27 UTC 2016
#12923: MultiParamTypeClasses + ExtendedDefaultRules
-------------------------------------+-------------------------------------
Reporter: amindfv | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
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:
-------------------------------------+-------------------------------------
-XExtendedDefaultRules allows us to avoid ambiguity for unannotated
numeric literals:
{{{#!hs
{-# LANGUAGE ExtendedDefaultRules #-}
data A = A deriving Show
class ToA a where
toA :: a -> A
instance ToA Double where
toA _ = A
main = print (toA 5 :: A)
}}}
But if we have a multi-param typeclass, -XExtendedDefaultRules doesn't
help us:
{{{#!hs
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
data A x = A deriving Show
class ToA a x where
toA :: a -> A x
instance ToA Double x where
toA _ = A
main = print (toA 5 :: A Bool)
}}}
It would be really nice for an EDSL I'm working on to be able to use
extended defaults here!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12923>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list