
#15895: Unable to match instance signatures -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: InstanceSigs | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Richard said GHC should be able to infer this {{{#!hs {-# 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 `(->)` {{{#!hs ið :: forall (a :: Type). Arr a a }}} {{{#!hs ið :: a -> a }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15895 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler