Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List
- abc = ["C", "C#/Db", "D", "D#/Eb", "E", "F", "F#/Gb", "G", "G#/Ab", "A", "A#/Bb", "B"]
- transpose' :: [[Char]] -> [Char] -> Maybe [[Char]]
- transpose' scale = fmap (\x -> concat [(drop x scale), (take x scale)]).(`elemIndex` scale)
- major :: [Char] -> Maybe [[Char]]
- major key = let rslt = transpose' abc key in
- case rslt of
- Just lst -> Just [s | s <- lst, idx <- [0, 2, 4, 5, 7, 9, 11], Just idx == elemIndex s lst]
- Nothing -> Nothing
- foo :: Int -> [Char] -> Maybe [[Char]]
- foo shift = (>>= major).fmap (!!shift).major
- ionic = foo 0
- dorian = foo 1
- frigian = foo 2
- lidian = foo 3
- mixolidian = foo 4
- eolian = foo 5
- locrian = foo 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement