Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,932
    • Issues 4,932
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 470
    • Merge requests 470
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #19167
Closed
Open
Created Jan 04, 2021 by Richard Eisenberg@raeDeveloper

Regression around overloaded literals and type applications

The new eager instantiation approach (adopted as a part of Quick Look) does not treat overloaded literals as "heads". This causes trouble when using them with type applications, which can be useful when using -XRebindableSyntax. Specifically, the following module compiles with released GHCs:

{-# LANGUAGE RebindableSyntax, RankNTypes, TypeApplications, OverloadedStrings,
             OverloadedLists, TypeFamilies #-}

module Bug where

import qualified Prelude as P
import qualified GHC.Exts as P
import Data.List.NonEmpty ( NonEmpty )

fromInteger :: P.Integer -> forall a. P.Num a => a
fromInteger n = P.fromInteger n

shouldBeAnInt = 3 @P.Int

newtype RevString = RevString P.String
  deriving P.Show

instance P.IsString RevString where
  fromString str = RevString (P.reverse str)

fromString :: P.String -> forall a. P.IsString a => a
fromString str = P.fromString str

shouldBeARevString = "hello" @RevString

fromListN :: P.Int -> [elt] -> forall list. (P.IsList list, elt ~ P.Item list) => list
fromListN n l = P.fromListN n l

shouldBeANonEmpty = ['x', 'y', 'z'] @(NonEmpty P.Char)

All three shouldBe definitions are rejected with HEAD. But accepted by 8.x

Edited Jan 04, 2021 by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking