{-# OPTIONS_HADDOCK show-extensions #-}
-- |
-- Module : Data.Phonetic.Languages.Undefined
-- Copyright : (c) OleksandrZhabenko 2021
-- License : MIT
-- Stability : Experimental
-- Maintainer : olexandr543@yahoo.com
--
-- This is a computational scheme for generalized usage of the phonetic languages approach.
-- The functions themselves are 'undefined' but with some type. They are just templates and some general idea.
-- Please, provide your own implementation instead of using these ones.
module Data.Phonetic.Languages.Undefined {-# WARNING "This module contains just some templates and ideas. Please, provide the analogous functions by yourself, these ones while used returns 'undefined'. " #-} (
-- * Convert to the 'PhoneticsRepresentationPL'.
stringToPRPL
-- * Apply conversion from 'PhoneticsRepresentationPL'.
, fromPRPL2X
, rules
, rulesPR
-- * Convert from the 'PhoneticsRepresentationPL' after applying 'rulesPR' function
-- or from the 'PhoneticsRepresentationPLX' after applying 'rulesX' function.
, showRepr
-- * Divide into syllables after both conversions.
, toSyllables
) where
import Data.Phonetic.Languages.Base
{-| Every 'Char' value represents here the phonetic phenomenon, mostly (usually, or often) some phoneme.
-}
rulesPR :: PhoneticsRepresentationPL -> Char
rulesPR (PREmpty xs) = rules xs Nothing Nothing
rulesPR (PRAfter xs ys) = rules xs (Just ys) Nothing
rulesPR (PRBefore xs zs) = rules xs Nothing (Just zs)
rulesPR (PR xs ys zs) = rules xs (Just ys) (Just zs)
{-# INLINE rulesPR #-}
fromPRPL2X :: PhoneticsRepresentationPL -> PhoneticsRepresentationPLX
fromPRPL2X y@(PREmpty xs) = PREmptyC xs (rulesPR y)
fromPRPL2X y@(PRAfter xs ys) = PRAfterC xs ys (rulesPR y)
fromPRPL2X y@(PRBefore xs zs) = PRBeforeC xs zs (rulesPR y)
fromPRPL2X y@(PR xs ys zs) = PRC xs ys zs (rulesPR y)
{-# INLINE fromPRPL2X #-}
{-| The text is converted to the phonetic languages representation by this function.
It is intended to be exported qualified, so that the function in every language
implementation has the same name and signature as here and the data type is used there.
Please, use this function only as a type and semantics template and implement your own one where needed.
If you can define some function 'stringToPRPL' where every 'PhoneticRepresentationPL' corresponds to the distinguishable
phonetic phenomenae then it is a considerable application for the possible phonetic languages approach usability for the
data.
-}
stringToPRPL :: String -> [PhoneticsRepresentationPL]
stringToPRPL = undefined
{-| Every 'Char' value represents here the phonetic phenomenon, mostly (usually, or often) some phoneme.
It is intended to be exported qualified, so that the function in every language
implementation has the same name and signature as here and the data type is used there.
Please, use this function only as a type and semantics template and implement your own one where needed.
-}
rules
:: String -- ^ Is gotten as 'string' from 'PhoneticsRepresentationPL'
-> Maybe String -- ^ Is gotten as 'afterString' from 'PhoneticsRepresentationPL'. Is 'Nothing' if there is no any.
-> Maybe String -- ^ Is gotten as 'beforeString' from 'PhoneticsRepresentationPL'. Is 'Nothing' if there is no any.
-> Char
rules = undefined
{-| Converts the converted from the 'PhoneticsRepresentationPL' conversion 'String' to syllables.
It is intended to be exported qualified, so that the function in every language
implementation has the same name and signature as here and the data type is used there.
Please, use this function only as a type and semantics template and implement your own one where needed.
-}
toSyllables :: String -> [String]
toSyllables = undefined
{-| Converts the converted from the 'PhoneticsRepresentationPL' conversion 'Char' to the usual written
in the language 'String' for the phenomenon.
It is intended to be exported qualified, so that the function in every language
implementation has the same name and signature as here and the data type is used there.
Please, use this function only as a type and semantics template and implement your own one where needed.
After you have defined the 'rules' and 'showRepr' functions, you can implement the instance for 'Show' class
for the 'PhoneticRepresentationPL' as:
instance Show PhoneticsRepresentationPL where
show = showRepr . rulesPR
{-# INLINE show #-}
Similarly for the 'PhoneticsRepresentationPLX':
instance Show PhoneticsRepresentationPLX where
show = showRepr . rulesX
{-# INLINE show #-}
-}
showRepr :: Char -> String
showRepr = undefined