
#11011: Add type-indexed type representations (`TypeRep a`) -------------------------------------+------------------------------------- Reporter: bjmprice | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): One bit of trickiness that I've encountered while looking at this is the that fact Core Lint disallows unsaturated applications of unlifted types. So, for instance, if we have, {{{#!hs data TTTypeRep (a :: k) where TrTyCon :: !Fingerprint -> !(TyCon a) -> TTypeRep (a :: k) TrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1). !Fingerprint -> TTypeRep (a :: k1 -> k2) -> TTypeRep (b :: k1) -> TTypeRep (a b) }}} And we ask for `Typeable (Array# Int)`, we will attempt to decompose `Array# Int` and end up with a subterm, {{{#!hs array#Rep :: TTypeRep Array# array#Rep = TrTyCon @(* -> #) @Array# fprint array#TyCon }}} in the resulting representation, which currently fails Core Lint due to, {{{#!patch diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 26e7257..861a9bc 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1042,7 +1042,7 @@ lintType ty@(TyConApp tc tys) = lintType ty' -- Expand type synonyms, so that we do not bogusly complain -- about un-saturated type synonyms - | isUnliftedTyCon tc || isTypeSynonymTyCon tc || isTypeFamilyTyCon tc + | isTypeSynonymTyCon tc || isTypeFamilyTyCon tc -- Also type synonyms and type families , length tys < tyConArity tc = failWithL (hang (text "Un-saturated type application") 2 (ppr ty)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11011#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler