[GHC] #11736: Allow unsaturated uses of unlifted types in Core

GHC ghc-devs at haskell.org
Mon Mar 21 18:33:09 UTC 2016


#11736: Allow unsaturated uses of unlifted types in Core
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently Core Lint checks for unsaturated uses of unlifted types in .
 These are easily produced in the new type-indexed `Typeable` scheme. For
 instance, consider solving for `Typeable # (Array# Int)`:

   * We decompose the application into wanteds `Typeable (* -> #) Array#`
 and `Typeable * Int`
   * We construct dictionaries for both, giving us a term `typeRepArray# ::
 TypeRep (* -> #) Array#`

 While nothing seems to blow up with this patch,
 {{{#!patch
 diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
 index 99625c9..2c401de 100644
 --- a/compiler/coreSyn/CoreLint.hs
 +++ b/compiler/coreSyn/CoreLint.hs
 @@ -1040,7 +1040,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))
 }}}

 I otherwise have no reason to believe that this is safe.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11736>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list