
20 Apr
2024
20 Apr
'24
12:35 p.m.
On Sat, 20 Apr 2024, George Colpitts wrote:
Thanks for everybody's replies
To give more context the original code from Ch. 12 of Bird's Thinking Functionally with Haskell was:
let (xs, ys) = break (== ch) str in
if null ys then [] else [(xs, tail ys)])
I replaced it with
let (xs, ys@(_ : t)) = break (== ch) str in
if null ys then [] else [(xs, t)])
This won't work. ys@(_ : t) only matches on non-empty lists. It will also give you warnings, but this warning may not be contained in -Wall depending on the GHC version.