Opened 3 years ago

#12049 new feature request

`OverloadedStrings` for types

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.3
Keywords: CustomTypeErrors Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (0)

Note: See TracTickets for help on using tickets.