Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Last active September 1, 2018 22:19
Show Gist options
  • Save lorenzo/40da377033753926e8825bdbf4fc6336 to your computer and use it in GitHub Desktop.
Save lorenzo/40da377033753926e8825bdbf4fc6336 to your computer and use it in GitHub Desktop.
module Main where
import qualified Data.Char
main = print go
go =
let l = ['a', 'b', 'a', 'A', 'b', 'B']
in foldr choose [] l
where
choose ch xs
| null xs = [ch]
| Data.Char.toLower ch == Data.Char.toLower (head xs) = tail xs
| otherwise = ch : xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment