Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Created April 22, 2021 10:02
Show Gist options
  • Save lovesegfault/4e5242468f437d571cd3a2e2968e8cc5 to your computer and use it in GitHub Desktop.
Save lovesegfault/4e5242468f437d571cd3a2e2968e8cc5 to your computer and use it in GitHub Desktop.
module Acronym (abbreviate) where
import Data.Text (Text, toUpper, split, concat)
import Data.Char (isSpace)
abbreviate :: Text -> Text
abbreviate = split(\c -> isSpace c || c `elem` [ '-', '_' ])
. Data.Text.concat
-- abbreviate = map toUpper
-- . concatMap (take 1)
-- . split (\c -> isSpace c || c `elem` [ '-', '_' ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment