๐Ÿ“ฆ malash / codewars-solutions

๐Ÿ“„ the-hashtag-generator.hs ยท 16 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16module Codewars.Kata.Hashtag where

import Data.Char

generateHashtag :: String -> Maybe String
generateHashtag cs =
    let result =
          concat
          . map (\(x:xs) -> toUpper x : xs)
          . words
          $ cs
        len = length result
    in if len > 0 && len <= 140
        then Just ('#':result)
        else Nothing