Ad
Code
Diff
  • module ToUpperFirst where
    
        import Data.Char (toUpper)
        
        toUpperFirst (x : xs) = toUpper x : xs
        toUpperFirst _ = ""
    • module ToUpperFirst where
    • import Data.Char
    • import Data.Char (toUpper)
    • toUpperFirst "" = ""
    • toUpperFirst (x : xs) = (toUpper x) : xs
    • toUpperFirst (x : xs) = toUpper x : xs
    • toUpperFirst _ = ""
Code
Diff
  • module AddNumbers where
    
    add_arr :: Num a => [a] -> a
    add_arr = sum
    • module AddNumbers where
    • add_arr x = sum x
    • add_arr :: Num a => [a] -> a
    • add_arr = sum
Code
Diff
  • module ToUpperFirst where
    
    import Data.Char (toUpper)
        
    mapcap :: String -> String
    mapcap = unwords . map (\(l:ls) -> toUpper l:ls) . words
    
    • module ToUpperFirst where
    • import Data.Char
    • import Data.List
    • import Data.Char (toUpper)
    • mapcap :: String -> String
    • mapcap = concat . intersperse " " . fmap (\(l:ls) -> (toUpper l):ls) . words
    • mapcap = unwords . map (\(l:ls) -> toUpper l:ls) . words