[GHC] #14840: QuantifiedConstraints: Can't define class alias
GHC
ghc-devs at haskell.org
Thu Feb 22 14:46:18 UTC 2018
#14840: QuantifiedConstraints: Can't define class alias
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.5
Keywords: | Operating System: Unknown/Multiple
QuantifiedConstraints wipT2893 |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{#!hs
{-# Language TypeInType, MultiParamTypeClasses, TypeFamilies,
FlexibleContexts, FunctionalDependencies, AllowAmbiguousTypes,
QuantifiedConstraints, GADTs, ConstraintKinds, KindSignatures, RankNTypes,
FlexibleInstances, UndecidableInstances, TypeOperators #-}
import Data.Kind
class Reifies s a | s -> a where
reflect :: proxy s -> a
newtype Lift :: forall k. (Type -> Constraint) -> Type -> k -> Type where
Lift :: a -> Lift cls a s
data family Def :: (k -> Constraint) -> (k -> Type)
class (forall s a. Reifies s (Def cls a) => cls (Lift cls a s)) =>
ReifiableConstraint cls
instance (forall s a. Reifies s (Def cls a) => cls (Lift cls a s)) =>
ReifiableConstraint cls
}}}
gives an error
{{{
$ ghci -ignore-dot-ghci Bug.hs
GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/Bug.hs, interpreted )
/tmp/Bug.hs:14:10: error:
• Could not deduce: cls (Lift cls a s)
arising from the superclasses of an instance declaration
from the context: forall (s :: k) a.
Reifies s (Def cls a) =>
cls (Lift cls a s)
bound by the instance declaration at /tmp/Bug.hs:14:10-93
or from: Reifies s (Def cls a)
bound by a quantified context at /tmp/Bug.hs:1:1
• In the instance declaration for ‘ReifiableConstraint cls’
|
14 | instance (forall s a. Reifies s (Def cls a) => cls (Lift cls a s)) =>
ReifiableConstraint cls
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
Prelude>
}}}
This is a rare occasion that the class alias trick fails for me so
~+~yay~+~. But is it intended?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14840>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list