[GHC] #14581: coerce String type in annotations with OverloadedStrings enabled

#14581: coerce String type in annotations with OverloadedStrings enabled -------------------------------------+------------------------------------- Reporter: mgmeier | Owner: (none) Type: feature | Status: new request | Priority: low | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Compiling the following snippet fails with the error message for not being able to resolve the constraint IsString for the given annotation (I've chosen some random HLint annotation here): {{{#!hs {-# LANGUAGE OverloadedStrings #-} module Foo where {-# ANN module "HLint: ignore Use <$>" #-} }}} Stating the type explicitly works fine, changing the annotation like this: {{{#!hs {-# ANN module ("HLint: ignore Use <$>" :: String) #-} }}} Note: this is actually only a minor annoyance which may or may not be confusing to newcomers. However since annotations use the String type, wouldn't it be possible to resolve the constraint in this case / coerce the value when inside an annotation? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14581 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14581: coerce String type in annotations with OverloadedStrings enabled -------------------------------------+------------------------------------- Reporter: mgmeier | Owner: (none) Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.2.1 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 mgmeier): Addendum: or is the general idea of annotations that you should be ably to annotate some definition with *any* Haskell value? In this case, the behavior would make sense and my request wouldn't, so you can close it :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14581#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14581: coerce String type in annotations with OverloadedStrings enabled -------------------------------------+------------------------------------- Reporter: mgmeier | Owner: (none) Type: feature request | Status: closed Priority: low | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => invalid Comment: Replying to [comment:1 mgmeier]:
Addendum: or is the general idea of annotations that you should be able to annotate some definition with ''any'' Haskell value?
Yes. [https://downloads.haskell.org/~ghc/8.2.2/docs/html/users_guide/extending_ghc... #annotating-values Per the users' guide:]
Any expression that has both `Typeable` and `Data` instances may be attached to a top-level value binding using an `ANN` pragma.
Thus both `String` and `Text` could be used in an `ANN` pragma, so you'd need to resolve the ambiguity yourself. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14581#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC