[darcs-users] darcs patch: do not use concatenation in src/Context.hs

Nicolas Pouillard nicolas.pouillard at gmail.com
Fri Jan 9 09:00:17 UTC 2009


Excerpts from trentbuck's message of Fri Jan 09 02:58:42 +0100 2009:
> Florent Becker <florent.becker at ens-lyon.org> writes:
> 
> > Trent W. Buck wrote:
> >
> >> Eric Kow <kowey at darcs.net> writes:
> >> 
> >>> Content-Description: A darcs patch for your repository!
> >>>> +  putStrLn $ varname ++ " =\"" ++ concatMap escape ls ++ "\""
> >>>> +    where
> >>>> +      escape '\n' = "\\n\\\n\\"
> >>>> +      escape '"'  = "\\\""
> >>>> +      escape '\\' = "\\\\"
> >>>> +      escape c = [c]
> >>>
> >>> All those backslashes confuse me, although I (think I) get the idea
> >>> that you're trying to doubly-protect them, once for this code and once
> >>> for the generated code.
> >> 
> >> Would (show) or (show . show) help here?
> >
> > I don't think so, the problem is to get the character/string escaped, but
> > not surrounded by quotes.
> 
> take (n-1) . drop 1 . show? ;-)

init . tail . show

-- 
Nicolas Pouillard


More information about the darcs-users mailing list