-- |
-- Module      :  MMSyn7s
-- Copyright   :  (c) OleksandrZhabenko 2020
-- License     :  MIT
--
-- Maintainer  :  olexandr543@yahoo.com
--
-- A program and a library that show a sorted list of the Ukrainian sounds 
-- representations that can be used by mmsyn7 series of programs
--

module MMSyn7s where

import qualified Data.Vector as V
import Data.List (sort, nub)
import Melodics.Ukrainian (convertToProperUkrainian)
import System.Environment (getArgs)


-- | Function takes Ukrainian text being written without quotes as command line arguments and prints the sorted list of the Ukrainian sounds representations 
-- that can be used further in mmsyn7 series of programs.
main7s :: IO ()
main7s = do
  texts <- getArgs
  putStrLn ""
  putStrLn . show . sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian . unwords $ texts

-- | Function takes Ukrainian text being a @String@ and returns a sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of programs.
show7s :: String -> [String]
show7s xs = sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian $ xs

-- | Function takes Ukrainian text being a @String@ and returns a @String@ that is shown sorted list of the Ukrainian sounds representations that can be used further in mmsyn7 series of programs.
show7s2 :: String -> String
show7s2 xs = show . sort . nub . V.toList . V.filter (\x -> x /= "-" && x /= "1" && x /= "0") . convertToProperUkrainian $ xs