-
Notifications
You must be signed in to change notification settings - Fork 216
has_repr
and has_to_string
type classes
#1664
Comments
The idea behind Python's |
A small correction to what @leodemoura wrote: currently we have #eval to_string 'a' -- "'a'"
#eval to_string "abc" -- "̈\"abc"\" |
@avigad Note that #eval to_string 'a' -- "a"
#eval to_string "abc" -- "abc"
-- But, the same example with `repl` will produce the weird double quotes.
#eval repr 'a' -- "'a'"
#eval repr "abc" -- "̈\"abc\"" |
See issue leanprover#1664 This is just the first step to implement proposal described at issue leanprover#1664.
…tring` instance See leanprover#1664
…ces should be `has_to_string` since they do not produce results that can be parsed by Lean See leanprover#1664
The commits above close this issue. |
The current type class
has_to_string
is similar to theShow
Haskell typeclass.The instances for
string
andchar
produced quoted values.This is inconvenient since we often just need to convert a value (
char
,nat
,string
,int
, etc) into a "plain" string (no quotes). @johoelzl suggested we add ahas_repr
type class. The idea is to rename the currenthas_to_string
type class tohas_repr
, and add a newhas_to_string
whose instances are supposed to produce plain (i.e., no quotes) strings.The text was updated successfully, but these errors were encountered: