Render multi-line strings more prettily in Template Haskell
Kathleen Fisher writes: In the quasi-quoter, would it be hard to have the code that reports an error print the quoted string using putStrLn instead of show? For example, I get error messages like the following:
Examples/Simple.hs:1:1:
Exception when trying to run compile-time code:
user error ("Examples/Simple.hs" (line 73, column 38):
unexpected "\""
expecting identifier or "[")
Code: Language.Haskell.TH.Quote.quoteDec
forest
" type Hosts_f = File Hosts_t -- Hosts_t is expected to be a PADS type \n\n type Scores_d = Directory { scores :: File Ptext }\n\n type Simple_d (file_name :: String ) = Directory \n { local is \"local.txt\" :: File Hosts_t where <| (get_owner local_md) == \"kfisher\" | \n , remote is <|file_name ++ \".txt\"|> :: Hosts_f where <| (get_modes remote_md) == \"-rw-r--r--\" |>\n , nested is <|getHost local|> :: Scores_d where <| (get_group nested_md) == (get_owner local_md) |> \n , mylink_sym is \"mylink\" :: SymLink where <| mylink_sym == \"quantum\" |>\n , mylink :: Scores_d\n-- , mylink :: SymLink Scores_d where <| sym_link mylink == \"quantum\" |>\n , airef is ai_file :: File AI_t\n } "
It'd be a lot easier to find the syntax error if all those '\n's were printed as newlines.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |