summaryrefslogtreecommitdiff
path: root/Alpha.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-11-28 09:25:29 -0500
committerBen Sima <ben@bsima.me>2020-11-28 13:07:42 -0500
commit90badda2f8ef96069fae3a00d1726237783b0209 (patch)
treec2b703573d8288deaac56dc6a403deffce468f06 /Alpha.hs
parent8f871af38d05a73065ce3041dd448424d8bb625a (diff)
Enable rudimentary remote builds
Diffstat (limited to 'Alpha.hs')
-rw-r--r--Alpha.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Alpha.hs b/Alpha.hs
index 8b79c4c..556f8df 100644
--- a/Alpha.hs
+++ b/Alpha.hs
@@ -40,11 +40,16 @@ module Alpha
joinWith,
CanSnakeCase (snake),
+ -- * String
+ capitalize,
+
-- * Debugging tools
say,
)
where
+import qualified Data.Char as Char
+import qualified Data.List as List
import Data.String
import Data.Text (Text)
import qualified Data.Text as Text
@@ -68,14 +73,14 @@ f </ g = fmap f g
-- | Normal function application. Do the right side, then pass the
-- return value to the function on the left side.
(<|) :: (a -> b) -> a -> b
-f <| g = f (g)
+f <| g = f g
infixr 0 <|
-- | Reverse function application. Do the left side, then pass the
-- return value to the function on the right side.
(|>) :: a -> (a -> b) -> b
-f |> g = g (f)
+f |> g = g f
-- | Alias for <&>. Can be read as "and then". Basically does into a
-- functor, does some computation, then returns the same kind of
@@ -106,3 +111,7 @@ class CanSnakeCase str where
instance CanSnakeCase Text where
snake = Text.replace " " "-" . Text.toLower
+
+capitalize :: String -> String
+capitalize [] = []
+capitalize str = (Char.toUpper <| List.head str) : (Char.toLower </ List.tail str)