Skip to content

Allow labels starting with uppercase with OverloadedLabels

The following program

{-# LANGUAGE OverloadedLabels, DataKinds, FlexibleInstances,
  MultiParamTypeClasses #-}

import GHC.OverloadedLabels

instance IsLabel "Three" Int where
    fromLabel _ = 3

test :: Int
test = #Three

main :: IO ()
main = print test

fails to compile in ghc 8.0 with a parse error (while it works as expected if we replace "Three" -> "three"). This may be a conscious design decision, but if not I figured I would ask if it would be possible to allow such labels starting with uppercase letters.

I run into this when working on adding support for OverloadedLabels to the gobject-introspection bindings (autogenerated bindings for gtk, etc.), where it would be natural in a few places to write overloaded labels starting with a capital letter. Not hugely important, but sometimes aesthetically more pleasing (imho), and I am not aware of a good reason to forbid them. Perhaps there is one?

Trac metadata
Trac field Value
Version 8.0.1-rc1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information