Skip to content

`OverloadedStrings` for types

Is there any sense in adding

class IsSymbol a where
  type FromSymbol (str :: Symbol) :: a

instance IsSymbol ErrorMessage where
  type FromSymbol str = GHC.TypeLits.Text str

instance IsSymbol ErrorMessage where
  type FromSymbol str = str

where FromSymbol gets placed before type-level string literals:

TypeError ("Warning: ":<>:ShowType ty:<>:" is odd.")

analogous to Data.String.IsString.

Trac metadata
Trac field Value
Version 7.10.3
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