diff options
Diffstat (limited to 'Alpha.hs')
-rw-r--r-- | Alpha.hs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,4 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} -- | Commonly useful functions, a Prelude replacement. -- @@ -37,6 +38,8 @@ module Alpha lchomp, joinWith, + CanSnakeCase(snake), + -- * Debugging tools say, ) @@ -98,3 +101,10 @@ joinWith = intercalate don't :: Bool -> Bool don't = do not {-# ANN don't ("HLint: ignore Redundant do" :: String) #-} + +-- | Class for turning different string types to snakeCase. +class CanSnakeCase str where + snake :: str -> str + +instance CanSnakeCase Text where + snake = Text.replace " " "-" . Text.toLower |