[GHC] #8026: DatatypeContexts should be fixed, not deprecated
GHC
ghc-devs at haskell.org
Mon Sep 22 16:09:06 UTC 2014
#8026: DatatypeContexts should be fixed, not deprecated
-------------------------------------+-------------------------------------
Reporter: gidyn | Owner:
Type: feature | Status: new
request | Milestone:
Priority: normal | Version: 7.6.3
Component: Compiler | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by goldfire):
This proposal ''does'' propose a change to the type system, as it proposes
a change to the set of well-typed programs. The same is true of partial
type signatures. Type inference is an algorithm that implements a way to
enforce the constraints of a type system.
Your example is clear for that simple situation. But, Haskell's type
system is not that simple! For example:
{{{
data Eq a => HasEq a = MkHasEq a
deriving Typeable
data Show a => HasShow a = MkHasShow a
a :: Maybe (HasEq a) -> Maybe (HasEq a) -> Bool
a (Just x) (Just y) = x == y
a _ _ = Nothing
b :: Either (HasEq a) (HasShow a) -> String -- what constraints are used
here???
b (Left x) = show (x == x)
b (Right x) = show x
c :: Proxy (HasEq a) -> () -- what constraints are used here???
c _ = ()
data Dynamic = forall a. Typeable a => MkDyn a
d :: Dynamic -> Maybe Bool
d (MkDyn y) | Just (MkHasEq z) <- cast y = Just (z == z) -- where does
the Eq constraint come from??
d _ = Nothing
}}}
Your examples seem to address specific, easy cases. But, we need to
consider all the wide range of compositions with other Haskell features!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8026#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list