Skip to content

Instantly share code, notes, and snippets.

@gnumonik
Created April 16, 2021 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnumonik/1ae4bb58f2535ebbe1deff0129fbb1fc to your computer and use it in GitHub Desktop.
Save gnumonik/1ae4bb58f2535ebbe1deff0129fbb1fc to your computer and use it in GitHub Desktop.
test
module Test where
import Data.Char (toUpper)
someFunc :: [Char] -> [[Char]]
someFunc xs = go 1 [] xs
where
go :: Int -> [[Char]] -> [Char] -> [[Char]]
go n acc [] = acc
go n acc xs = if n <= length xs
then go (n + 1) (acc <> [mkUpper n xs]) xs
else acc
mkUpper :: Int -> [Char] -> [Char]
mkUpper n cs =
let fs = replicate (n-1) id
<> [toUpper]
<> replicate (length cs - n) id
in zipWith (\x y -> y x) cs fs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment