summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Alpha.hs10
-rw-r--r--Hero/App.hs7
2 files changed, 10 insertions, 7 deletions
diff --git a/Alpha.hs b/Alpha.hs
index 98c161b..e96089f 100644
--- a/Alpha.hs
+++ b/Alpha.hs
@@ -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
diff --git a/Hero/App.hs b/Hero/App.hs
index 9391eac..56289f8 100644
--- a/Hero/App.hs
+++ b/Hero/App.hs
@@ -72,13 +72,6 @@ instance ToJSON ComicId where
instance FromJSON ComicId where
parseJSON = genericParseJSON Data.Aeson.defaultOptions
--- | Class for turning different string types to snakeCase.
-class CanSnakeCase str where
- snake :: str -> str
-
-instance CanSnakeCase Text where
- snake = Data.Text.replace " " "-" . Data.Text.toLower
-
-- | Used for looking up images on S3, mostly
comicSlug :: Comic -> Text
comicSlug Comic {..} = snake comicName <> "-" <> comicIssue