Unable to match instance signatures
Richard said GHC should be able to infer this
{-# Language PolyKinds #-}
{-# Language RankNTypes #-}
{-# Language TypeFamilies #-}
{-# Language FlexibleInstances #-}
{-# Language InstanceSigs #-}
import Data.Kind
class Ríki ob where
type Arr :: ob -> ob -> Type
ið :: forall (a :: ob). Arr a a
instance Ríki Type where
type Arr = (->)
ið :: Arr a a
ið a = a
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci ~/hs/693_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/baldur/hs/693_bug.hs, interpreted )
/home/baldur/hs/693_bug.hs:18:3: error:
• Couldn't match kind ‘ob’ with ‘*’
‘ob’ is a rigid type variable bound by
the type signature for:
ið :: forall ob (a :: ob). Arr a a
at /home/baldur/hs/693_bug.hs:17:9-15
When matching types
p0 :: *
a :: ob
Expected type: Arr a a
Actual type: p0 -> p0
• The equation(s) for ‘ið’ have one argument,
but its type ‘Arr a a’ has none
In the instance declaration for ‘Ríki *’
• Relevant bindings include
ið :: Arr a a (bound at /home/baldur/hs/693_bug.hs:18:3)
|
18 | ið a = a
| ^^^^^^^^
Failed, no modules loaded.
It works if we specify the kind of a or use (->)
ið :: forall (a :: Type). Arr a a
ið :: a -> a
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |