{-# LANGUAGE ScopedTypeVariables #-}

-- |
-- Module      : Language.IPA.Parser
-- Copyright   : (c) 2021 Rory Tyler Hayford
--
-- License     : BSD-3-Clause
-- Maintainer  : rory.hayford@protonmail.com
-- Stability   : experimental
-- Portability : GHC
--
-- Parser for IPA literals
module Language.IPA.Parser
    ( -- * IPA parsing
      -- ** Parsing single segments
      parseSegment
    , segmentP
      -- ** Parsing syllables
    , parseSyllable
    , syllableP
    , parseSyllables
    , syllablesP
      -- * X-SAMPA parsing
      -- ** Parsing single segments
    , parseSegmentXSampa
    , segmentXSampaP
      -- ** Parsing syllables
    , parseSyllableXSampa
    , parseSyllablesXSampa
    , syllableXSampaP
    ) where

import           Control.Applicative  ( Alternative((<|>), some, many) )

import           Data.Attoparsec.Text ( IResult(Fail, Done, Partial), Parser )
import qualified Data.Attoparsec.Text as P
import           Data.Foldable        ( asum, foldl' )
import           Data.Functor         ( ($>), (<&>) )
import           Data.Text            ( Text )
import           Data.Text.Normalize  ( NormalizationMode(NFD), normalize )

import           Language.IPA.Types

-- | Parse a single literal segment in IPA notation, returning 'InvalidIPA' upon
-- failure and a 'Segment' upon success. Note that supplying two or more segment
-- literals will cause the parse to fail
--
-- >>> parseSegment "ɨːː"
-- Right (WithSegmentalFeature (Length OverLong) (Vowel Close Central Unrounded))
--
-- >>> parseSegment "ɨːːb"
-- Left (InvalidIPA "Failed to parse character 'b'")
parseSegment :: Text -> Either IPAException Segment
parseSegment :: Text -> Either IPAException Segment
parseSegment Text
t =
    (Text -> IPAException)
-> Text -> IResult Text Segment -> Either IPAException Segment
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidIPA
                 Text
msg
                 (Parser Segment -> Text -> IResult Text Segment
forall a. Parser a -> Text -> Result a
P.parse (Parser Segment
segmentP Parser Segment -> Parser Text () -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) (NormalizationMode -> Text -> Text
normalize NormalizationMode
NFD Text
t))
  where
    msg :: Text
msg = Text
"Failed to parse character(s):"

-- | Parse a literal syllable in IPA notation, returning 'InvalidIPA' upon
-- failure and a 'Syllable' upon success, where the syllable is parameterized by
-- some type @t@ satisfying a 'MultiSegment' constraint. Note that, as with
-- 'parseSegment', supplying two or more syllable literals will cause the parse
-- to fail
--
-- >>> parseSyllable @[] "ma˧˥"
-- Right (WithSuprasegmentalFeature (LexicalToneContour HighRising)
--       (Syllable [Consonant (Pulmonic Voiced Bilabial Nasal),Vowel Open Front Unrounded]))
parseSyllable :: MultiSegment t => Text -> Either IPAException (Syllable t)
parseSyllable :: Text -> Either IPAException (Syllable t)
parseSyllable Text
t =
    (Text -> IPAException)
-> Text
-> IResult Text (Syllable t)
-> Either IPAException (Syllable t)
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidIPA
                 Text
msg
                 (Parser (Syllable t) -> Text -> IResult Text (Syllable t)
forall a. Parser a -> Text -> Result a
P.parse (Parser (Syllable t)
forall (t :: * -> *). MultiSegment t => Parser (Syllable t)
syllableP Parser (Syllable t) -> Parser Text () -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) (NormalizationMode -> Text -> Text
normalize NormalizationMode
NFD Text
t))
  where
    msg :: Text
msg = Text
"Failed to parse segment(s):"

-- | Parse several syllables into a container parameterized by the same type as that
-- parameterizing the individual 'Syllable's. Whitespace between syllables is interpreted
-- as a syllable boundary
--
-- >>> parseSyllables @[] "haːj˧ ɓaː˧"
-- Right [ WithSuprasegmentalFeature (LevelLexicalTone MidTone)
--           (Syllable [ Consonant (Pulmonic Voiceless Glottal (Fricative NonSibilant))
--                     , WithSegmentalFeature (Length Long) (Vowel Open Front Unrounded)
--                     , Consonant (Pulmonic Voiced Palatal Approximant)
--                     ])
--       , WithSuprasegmentalFeature (LevelLexicalTone MidTone)
--           (Syllable [ Consonant (Implosive Voiced Bilabial)
--                     , WithSegmentalFeature (Length Long) (Vowel Open Front Unrounded)
--                     ])
--       ]
parseSyllables :: (MultiSegment t, Monoid (t (Syllable t)))
               => Text
               -> Either IPAException (t (Syllable t))
parseSyllables :: Text -> Either IPAException (t (Syllable t))
parseSyllables Text
t =
    (Text -> IPAException)
-> Text
-> IResult Text (t (Syllable t))
-> Either IPAException (t (Syllable t))
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidIPA
                 Text
msg
                 (Parser (t (Syllable t)) -> Text -> IResult Text (t (Syllable t))
forall a. Parser a -> Text -> Result a
P.parse (Parser (t (Syllable t))
forall (t :: * -> *).
(MultiSegment t, Monoid (t (Syllable t))) =>
Parser (t (Syllable t))
syllablesP Parser (t (Syllable t))
-> Parser Text () -> Parser (t (Syllable t))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) (NormalizationMode -> Text -> Text
normalize NormalizationMode
NFD Text
t))
  where
    msg :: Text
msg = Text
"Failed to parse syllable:"

-- | Parser for syllables. This function is exposed to allow users to create
-- more specific parsers for aggregations of multiple syllables
syllableP :: MultiSegment t => Parser (Syllable t)
syllableP :: Parser (Syllable t)
syllableP = Parser (Syllable t)
withStressP Parser (Syllable t) -> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser (Syllable t)
withFeaturesP Parser (Syllable t) -> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments
  where
    justSegments :: Parser Text (t Segment)
justSegments = Parser Segment -> Parser Text (t Segment)
forall (t :: * -> *) a (f :: * -> *).
(Applicative t, Monoid (t a), Alternative f) =>
f a -> f (t a)
someT Parser Segment
segmentP

    withFeaturesP :: Parser (Syllable t)
withFeaturesP = (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Syllable t -> [SuprasegmentalFeature] -> Syllable t
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature
        (Syllable t -> [SuprasegmentalFeature] -> Syllable t)
-> Parser (Syllable t)
-> Parser Text ([SuprasegmentalFeature] -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments)
        Parser Text ([SuprasegmentalFeature] -> Syllable t)
-> Parser Text [SuprasegmentalFeature] -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SuprasegmentalFeature
-> Parser Text [SuprasegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser Text SuprasegmentalFeature
suprasegmentalFeatureP

    withStressP :: Parser (Syllable t)
withStressP = (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Syllable t -> [SuprasegmentalFeature] -> Syllable t
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature (Syllable t -> [SuprasegmentalFeature] -> Syllable t)
-> Parser (Syllable t)
-> Parser Text ([SuprasegmentalFeature] -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Syllable t)
withStress
        Parser Text ([SuprasegmentalFeature] -> Syllable t)
-> Parser Text [SuprasegmentalFeature] -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SuprasegmentalFeature
-> Parser Text [SuprasegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser Text SuprasegmentalFeature
suprasegmentalFeatureP
      where
        withStress :: Parser (Syllable t)
withStress = SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Parser Text SuprasegmentalFeature
-> Parser Text (Syllable t -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text SuprasegmentalFeature
stressP
            Parser Text (Syllable t -> Syllable t)
-> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments)

-- | Parser for segments. This function is exposed to allow users to create
-- more specific parsers for multi-segment sequences
segmentP :: Parser Segment
segmentP :: Parser Segment
segmentP = Parser Segment
withFeatureP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
pureSegmentP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
optionalP
  where
    pureSegmentP :: Parser Segment
pureSegmentP = Parser Segment
vowelP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Consonant -> Segment
Consonant (Consonant -> Segment) -> Parser Text Consonant -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Consonant
consonantP

    withFeatureP :: Parser Segment
withFeatureP =
        (SegmentalFeature -> Segment -> Segment)
-> Segment -> [SegmentalFeature] -> Segment
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SegmentalFeature -> Segment -> Segment
WithSegmentalFeature (Segment -> [SegmentalFeature] -> Segment)
-> Parser Segment -> Parser Text ([SegmentalFeature] -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Segment
pureSegmentP Parser Text ([SegmentalFeature] -> Segment)
-> Parser Text [SegmentalFeature] -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SegmentalFeature -> Parser Text [SegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser Text SegmentalFeature
segmentalFeatureP

    optionalP :: Parser Segment
optionalP    = Segment -> Segment
Optional
        (Segment -> Segment) -> Parser Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Parser Text Text
"(" Parser Text Text -> Parser Segment -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Parser Segment
withFeatureP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
pureSegmentP) Parser Segment -> Parser Text Text -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
")")

-- | Parser for poly-syllabic sequences, with individual syllables separated
-- by (optional) whitespace
syllablesP :: (MultiSegment t, Monoid (t (Syllable t)))
           => Parser (t (Syllable t))
syllablesP :: Parser (t (Syllable t))
syllablesP = Parser Text (Syllable t) -> Parser (t (Syllable t))
forall (t :: * -> *) a (f :: * -> *).
(Applicative t, Monoid (t a), Alternative f) =>
f a -> f (t a)
someT Parser Text (Syllable t)
withWS
  where
    withWS :: Parser Text (Syllable t)
withWS = Parser Text (Syllable t)
forall (t :: * -> *). MultiSegment t => Parser (Syllable t)
syllableP Parser Text (Syllable t)
-> Parser Text [Char] -> Parser Text (Syllable t)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char -> Parser Text [Char]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser Text Char
P.space

consonantP :: Parser Consonant
consonantP :: Parser Text Consonant
consonantP =
    Parser Text Consonant
clickP Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
implosiveP Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
ejectiveP Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
doublyArticulatedP Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
pulmonicP

vowelP :: Parser Segment
vowelP :: Parser Segment
vowelP = Parser Segment
triphthongP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
diphthongP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Vowel -> Segment
Vowel (Vowel -> Segment) -> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP
  where
    diphthongP :: Parser Segment
diphthongP  = Vowel -> Vowel -> Segment
Diphthong (Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP Parser Text (Vowel -> Segment)
-> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP

    triphthongP :: Parser Segment
triphthongP = Vowel -> Vowel -> Vowel -> Segment
Triphthong (Vowel -> Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Vowel -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP Parser Text (Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Segment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP Parser Text (Vowel -> Segment)
-> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP

    pv :: Height -> Backness -> Roundedness -> Vowel
pv          = Height -> Backness -> Roundedness -> Vowel
Pure

    lowered :: Parser Text Char
lowered     = Char -> Parser Text Char
diacriticP Char
'\x031e'

    pureP :: Parser Text Vowel
pureP       =
        [Parser Text Vowel] -> Parser Text Vowel
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"e" Parser Text Text -> Parser Text Char -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"ø" Parser Text Text -> Parser Text Char -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Front Roundedness
Rounded
             , Parser Text Text
"ɤ" Parser Text Text -> Parser Text Char -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"o" Parser Text Text -> Parser Text Char -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Back Roundedness
Rounded
             , Parser Text Text
"i" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Front Roundedness
Unrounded
             , Parser Text Text
"y" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Front Roundedness
Rounded
             , Parser Text Text
"ɨ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Central Roundedness
Unrounded
             , Parser Text Text
"ʉ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Central Roundedness
Rounded
             , Parser Text Text
"ɯ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Back Roundedness
Unrounded
             , Parser Text Text
"u" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Back Roundedness
Rounded
             , Parser Text Text
"ɪ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Front Roundedness
Unrounded
             , Parser Text Text
"ʏ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Front Roundedness
Rounded
             , Parser Text Text
"ʊ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Back Roundedness
Rounded
             , Parser Text Text
"e" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"ø" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Front Roundedness
Rounded
             , Parser Text Text
"ɘ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"ɵ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Central Roundedness
Rounded
             , Parser Text Text
"ɤ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"o" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Back Roundedness
Rounded
             , Parser Text Text
"ə" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"ɛ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"œ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Front Roundedness
Rounded
             , Parser Text Text
"ɜ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"ɞ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Central Roundedness
Rounded
             , Parser Text Text
"ʌ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"ɔ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Back Roundedness
Rounded
             , Parser Text Text
"æ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearOpen Backness
Front Roundedness
Unrounded
             , Parser Text Text
"ɐ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearOpen Backness
Central Roundedness
Unrounded
             , Parser Text Text
"a" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Front Roundedness
Unrounded
             , Parser Text Text
"ɶ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Front Roundedness
Rounded
             , Parser Text Text
"ä" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Central Roundedness
Unrounded
             , Parser Text Text
"ɑ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Back Roundedness
Unrounded
             , Parser Text Text
"ɒ" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Back Roundedness
Rounded
             ]

pulmonicP :: Parser Consonant
pulmonicP :: Parser Text Consonant
pulmonicP =
    [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Consonant
biliabialP
         , Parser Text Consonant
labioDentalP
         , Parser Text Consonant
dentalP
         , Parser Text Consonant
postAlveolarP
         , Parser Text Consonant
retroflexP
         , Parser Text Consonant
palatalP
         , Parser Text Consonant
velarP
         , Parser Text Consonant
uvularP
         , Parser Text Consonant
pharyngealP
         , Parser Text Consonant
glottalP
           -- Alveolars should go at the end; alveolar plosives appear in
           -- several affricates in other places of articulation
         , Parser Text Consonant
alveolarP
         ]
  where
    biliabialP :: Parser Text Consonant
biliabialP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        bc :: Phonation -> Manner -> Consonant
bc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Bilabial

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"p" Text
"ɸ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"b" Text
"β"
              Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Parser Text Text
"β" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ɸ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʙ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Trill
            , Parser Text Text
"b" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Plosive
            , Parser Text Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless Manner
Plosive
            ]

    labioDentalP :: Parser Text Consonant
labioDentalP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        ldc :: Phonation -> Manner -> Consonant
ldc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
LabioDental

        cs :: [Parser Text Consonant]
cs    = [ Parser Text Text
"ɱ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced Manner
Nasal
                , Parser Text Text
"f" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
                , Parser Text Text
"v" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
                , Parser Text Text
"ʋ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced Manner
Approximant
                , Parser Text Text
"ⱱ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced Manner
Flap
                ]

    dentalP :: Parser Text Consonant
dentalP = Parser Text Text
"θ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
dc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"ð" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
dc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
      where
        dc :: Phonation -> Manner -> Consonant
dc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Dental

    alveolarP :: Parser Text Consonant
alveolarP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        ac :: Phonation -> Manner -> Consonant
ac Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Alveolar

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"n" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"d" Text
"z" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Parser Text Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"z" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"ɹ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Approximant
            , Parser Text Text
"ɾ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Flap
            , Parser Text Text
"r" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Trill
            , Parser Text Text
"ɬ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless Manner
LateralFricative
            , Parser Text Text
"ɮ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralFricative
            , Parser Text Text
"l" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralApproximant
            , Parser Text Text
"ɺ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralFlap
            , Parser Text Text
"tɬ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless Manner
LateralAffricate
            , Parser Text Text
"dɮ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralAffricate
            , Parser Text Text
"t" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"d" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Plosive
            ]

    postAlveolarP :: Parser Text Consonant
postAlveolarP = Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"ʃ"
        Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Text -> Parser Text Text
doubleArticulated Text
"d" Text
"ʒ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"ʃ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"ʒ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
PostAlveolar

    retroflexP :: Parser Text Consonant
retroflexP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        rc :: Phonation -> Manner -> Consonant
rc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Retroflex

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"ɳ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"ʈ" Text
"ʂ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"ɖ" Text
"ʐ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Parser Text Text
"ʂ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"ʐ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"ɻ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Approximant
            , Parser Text Text
"ɽ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Flap
            , Parser Text Text
"ɽr" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Trill
            , Parser Text Text
"ɭ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
LateralApproximant
            , Parser Text Text
"ʈ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"ɖ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Plosive
            ]

    palatalP :: Parser Text Consonant
palatalP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Palatal

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"ɲ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"ɕ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"d" Text
"ʑ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"c" Text
"ç"
              Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"ɟ" Text
"ʝ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Parser Text Text
"ɕ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"ʑ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"ç" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʝ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"j" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Approximant
            , Parser Text Text
"ʎ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
LateralApproximant
            , Parser Text Text
"c" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"ɟ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Plosive
            ]

    velarP :: Parser Text Consonant
velarP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        vc :: Phonation -> Manner -> Consonant
vc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Velar

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"ŋ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"k" Text
"x"
              Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"g" Text
"ɣ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Parser Text Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ɣ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ɰ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Approximant
            , Parser Text Text
"ʟ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
LateralApproximant
            , Parser Text Text
"k" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"g" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Plosive
            ]

    uvularP :: Parser Text Consonant
uvularP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        uc :: Phonation -> Manner -> Consonant
uc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Uvular

        cs :: [Parser Text Consonant]
cs   =
            [ Parser Text Text
"ɴ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"q" Text
"χ"
              Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Text -> Text -> Parser Text Text
doubleArticulated Text
"ɢ" Text
"ʁ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"χ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʁ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʀ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Trill
            , Parser Text Text
"q" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"ɢ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Plosive
            ]

    pharyngealP :: Parser Text Consonant
pharyngealP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Pharyngeal

        cs :: [Parser Text Consonant]
cs   =
            [ Text -> Text -> Parser Text Text
doubleArticulated Text
"ʡ" Text
"ʢ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
            , Parser Text Text
"ħ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʕ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
            , Parser Text Text
"ʡ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Flap
            , Parser Text Text
"ʜ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Trill
            , Parser Text Text
"ʢ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless Manner
Trill
            , Parser Text Text
"ʡ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless Manner
Plosive
            ]

    glottalP :: Parser Text Consonant
glottalP = Text -> Text -> Parser Text Text
doubleArticulated Text
"ʔ" Text
"h"
        Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"ʔ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless Manner
Plosive
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"h" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"ɦ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
      where
        gc :: Phonation -> Manner -> Consonant
gc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Glottal

ejectiveP :: Parser Consonant
ejectiveP :: Parser Text Consonant
ejectiveP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs Parser Text Consonant -> Parser Text Char -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
ejective
  where
    ejective :: Parser Text Char
ejective = Char -> Parser Text Char
diacriticP Char
'\x02bc'

    ej :: Place -> Manner -> Consonant
ej       = Place -> Manner -> Consonant
Ejective

    cs :: [Parser Text Consonant]
cs       =
        [ Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"ɬ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar Manner
LateralAffricate
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"q" Text
"χ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"ʃ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
PostAlveolar (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"ʈ" Text
"ʂ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"ɕ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"k" Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        , Parser Text Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Bilabial Manner
Plosive
        , Parser Text Text
"ɸ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Bilabial (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"f" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
LabioDental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"θ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Dental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"ɬ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar Manner
LateralFricative
        , Parser Text Text
"t" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar Manner
Plosive
        , Parser Text Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"ʃ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
PostAlveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"ʈ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex Manner
Plosive
        , Parser Text Text
"ʂ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"c" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal Manner
Plosive
        , Parser Text Text
"ɕ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"k" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar Manner
Plosive
        , Parser Text Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"q" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular Manner
Plosive
        , Parser Text Text
"χ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"ʡ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Pharyngeal Manner
Plosive
        ]

implosiveP :: Parser Consonant
implosiveP :: Parser Text Consonant
implosiveP = Phonation -> Place -> Consonant
Implosive Phonation
Voiceless (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Place]
cs Parser Text Consonant -> Parser Text Char -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
voiceless
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Phonation -> Place -> Consonant
Implosive Phonation
Voiced (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Place]
cs
  where
    voiceless :: Parser Text Char
voiceless = Char -> Parser Text Char
diacriticP Char
'\x030a'

    cs :: [Parser Text Place]
cs        = [ Parser Text Text
"ɓ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Bilabial
                , Parser Text Text
"ɗ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Alveolar
                , Parser Text Text
"ᶑ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Retroflex
                , Parser Text Text
"ʄ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Palatal
                , Parser Text Text
"ɠ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Velar
                , Parser Text Text
"ʛ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Uvular
                ]

clickP :: Parser Consonant
clickP :: Parser Text Consonant
clickP = Place -> Consonant
Click
    (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"ʘ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Bilabial
             , Parser Text Text
"ǀ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Dental
             , Parser Text Text
"ǃ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Alveolar
             , Parser Text Text
"ǁ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
PostAlveolar
             , Parser Text Text
"ǂ" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Palatal
             ]

doublyArticulatedP :: Parser Consonant
doublyArticulatedP :: Parser Text Consonant
doublyArticulatedP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
  where
    da :: Phonation -> Place -> Place -> Manner -> Consonant
da = Phonation -> Place -> Place -> Manner -> Consonant
DoublyArticulated

    cs :: [Parser Text Consonant]
cs =
        [ Text -> Text -> Parser Text Text
doubleArticulated Text
"n" Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Alveolar Manner
Nasal
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"t" Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Alveolar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"d" Text
"b" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Alveolar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"ŋ" Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Nasal
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"k" Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Velar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"g" Text
"b" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulated Text
"q" Text
"ʡ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Uvular Place
Pharyngeal Manner
Plosive
        , Parser Text Text
"ɥ" Parser Text Text -> Parser Text Char -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Char -> Parser Text Char
P.char Char
'\x030a'
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Palatal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"ɥ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Palatal Manner
Approximant
        , Parser Text Text
"ʍ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"w" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Approximant
        , Parser Text Text
"ɫ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Alveolar Place
Velar Manner
LateralApproximant
        , Parser Text Text
"ɧ" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
PostAlveolar Place
Velar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        ]

segmentalFeatureP :: Parser SegmentalFeature
segmentalFeatureP :: Parser Text SegmentalFeature
segmentalFeatureP = Parser Text SegmentalFeature
secondaryArticulationP Parser Text SegmentalFeature
-> Parser Text SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Parser Text SegmentalFeature] -> Parser Text SegmentalFeature
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text SegmentalFeature]
fs
  where
    fs :: [Parser Text SegmentalFeature]
fs = [ Parser Text Text
"\x030a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> SegmentalFeature
Voicing Phonation
Voiceless
         , Parser Text Text
"\x030c" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> SegmentalFeature
Voicing Phonation
Voiced
         , Parser Text Text
"\x2d0\x2d0" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
OverLong
         , Parser Text Text
"\x2d1" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
HalfLong
         , Parser Text Text
"\x2d0" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
Long
         , Parser Text Text
"\x0306" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
ExtraShort
         , Parser Text Text
"\x036a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Aspirated
         , Parser Text Text
"\x0339" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
MoreRounded
         , Parser Text Text
"\x031c" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
LessRounded
         , Parser Text Text
"\x031f" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Advanced
         , Parser Text Text
"\x0320" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Retracted
         , Parser Text Text
"\x0308" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Centralized
         , Parser Text Text
"\x033d" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
MidCentralized
         , Parser Text Text
"\x1d5d" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Compressed
         , Parser Text Text
"\x0329" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Syllabic
         , Parser Text Text
"\x032f" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
NonSyllabic
         , Parser Text Text
"\x02de" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Rhotacized
         , Parser Text Text
"\x0324" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
BreathyVoice
         , Parser Text Text
"\x0330" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
CreakyVoice
         , Parser Text Text
"\x033c" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
LinguoLabialized
         , Parser Text Text
"\x02b7" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Labialized
         , Parser Text Text
"\x02b2" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Palatalized
         , Parser Text Text
"\x02e0" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Velarized
         , Parser Text Text
"\x02e4" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Pharyngealized
         , Parser Text Text
"\x031d" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Raised
         , Parser Text Text
"\x031e" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Lowered
         , Parser Text Text
"\x0318" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
AdvancedTongueRoot
         , Parser Text Text
"\x0319" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
RetractedTongueRoot
         , Parser Text Text
"\x032a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Dentalized
         , Parser Text Text
"\x033a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Apical
         , Parser Text Text
"\x033b" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Laminal
         , Parser Text Text
"\x0303" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Nasalized
         , Parser Text Text
"\x207f" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
NasalRelease
         , Parser Text Text
"\x02e1" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
LateralRelease
         , Parser Text Text
"\x031a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
NoAudibleRelease
         ]

secondaryArticulationP :: Parser SegmentalFeature
secondaryArticulationP :: Parser Text SegmentalFeature
secondaryArticulationP = Segment -> SegmentalFeature
SecondaryArticulation (Segment -> SegmentalFeature)
-> Parser Segment -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Segment
secondaryP
  where
    secondaryP :: Parser Segment
secondaryP = [Parser Segment] -> Parser Segment
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Segment]
segments

    pc :: Phonation -> Place -> Manner -> Segment
pc         = Phonation -> Place -> Manner -> Segment
PulmonicConsonant

    pv :: Height -> Backness -> Roundedness -> Segment
pv         = Height -> Backness -> Roundedness -> Segment
PureVowel

    segments :: [Parser Segment]
segments   =
        [ Parser Text Text
"\x1d50" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Bilabial Manner
Nasal
        , Parser Text Text
"\x1dac" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
LabioDental Manner
Nasal
        , Parser Text Text
"\x207f" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Alveolar Manner
Nasal
        , Parser Text Text
"\x1daf" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Retroflex Manner
Nasal
        , Parser Text Text
"\x1dae" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Palatal Manner
Nasal
        , Parser Text Text
"\x1d51" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Velar Manner
Nasal
        , Parser Text Text
"\x1db0" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Uvular Manner
Nasal
        , Parser Text Text
"\x1d56" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Bilabial Manner
Plosive
        , Parser Text Text
"\x1d47" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Bilabial Manner
Plosive
        , Parser Text Text
"\x1d57" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Alveolar Manner
Plosive
        , Parser Text Text
"\x1d48" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Alveolar Manner
Plosive
        , Parser Text Text
"\x1d9c" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Palatal Manner
Plosive
        , Parser Text Text
"\x1da1" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Palatal Manner
Plosive
        , Parser Text Text
"\x1d4f" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Velar Manner
Plosive
        , Parser Text Text
"\x1da2" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Velar Manner
Plosive
        , Parser Text Text
"\x02c0" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Glottal Manner
Plosive
        , Parser Text Text
"\x1db2" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Bilabial (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1d5d" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Bilabial (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1da0" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
LabioDental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1d5b" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
LabioDental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1dbf" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Dental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1d9e" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Dental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02e2" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Alveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1dbb" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Alveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1db4" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
PostAlveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1dbe" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
PostAlveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1d9d" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Palatal (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1dbd" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Palatal (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"\x1d9c\x0327" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Palatal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1da8" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Palatal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02e3" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02e0" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1d61" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Uvular (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02b6" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Uvular (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02b0" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Glottal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x02b1" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Glottal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"\x1db9" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
LabioDental Manner
Approximant
        , Parser Text Text
"\x02b4" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Alveolar Manner
Approximant
        , Parser Text Text
"\x02b5" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Retroflex Manner
Approximant
        , Parser Text Text
"\x02b2" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Palatal Manner
Approximant
        , Parser Text Text
"\xab69" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiceless Place
Velar Manner
Approximant
        , Parser Text Text
"\x1dad" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Velar Manner
Approximant
        , Parser Text Text
"\x02b3" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Manner -> Segment
pc Phonation
Voiced Place
Alveolar Manner
Trill
        , Parser Text Text
"\x1df1"
          Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Segment
DoublyArticulatedConsonant Phonation
Voiced Place
Bilabial Place
Velar Manner
Approximant
        , Parser Text Text
"\x2071" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Front Roundedness
Unrounded
        , Parser Text Text
"\x02b8" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Front Roundedness
Rounded
        , Parser Text Text
"\x1da4" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Central Roundedness
Unrounded
        , Parser Text Text
"\x1db6" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Central Roundedness
Rounded
        , Parser Text Text
"\x1d5a" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Back Roundedness
Unrounded
        , Parser Text Text
"\x1d58" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Close Backness
Back Roundedness
Rounded
        , Parser Text Text
"\x1da6" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearClose Backness
Front Roundedness
Unrounded
        , Parser Text Text
"\x1da7" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearClose Backness
Central Roundedness
Unrounded
        , Parser Text Text
"\x1db7" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearClose Backness
Back Roundedness
Rounded
        , Parser Text Text
"\x1d4a" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Mid Backness
Central Roundedness
Unrounded
        , Parser Text Text
"\x1d4a" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Mid Backness
Central Roundedness
Rounded
        , Parser Text Text
"\x1d4b" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
OpenMid Backness
Front Roundedness
Unrounded
        , Parser Text Text
"\xa7f9" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
OpenMid Backness
Front Roundedness
Rounded
        , Parser Text Text
"\x1d9f" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
OpenMid Backness
Central Roundedness
Unrounded
        , Parser Text Text
"\x1dba" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
OpenMid Backness
Back Roundedness
Unrounded
        , Parser Text Text
"\x1d53" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
OpenMid Backness
Back Roundedness
Rounded
        , Parser Text Text
"\x1d46" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearOpen Backness
Front Roundedness
Unrounded
        , Parser Text Text
"\x1d44" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearOpen Backness
Central Roundedness
Unrounded
        , Parser Text Text
"\x1d45" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearOpen Backness
Back Roundedness
Unrounded
        , Parser Text Text
"\x1d9b" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
NearOpen Backness
Back Roundedness
Rounded
        , Parser Text Text
"\x1d43" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Open Backness
Front Roundedness
Unrounded
        , Parser Text Text
"\x1d44" Parser Text Text -> Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Segment
pv Height
Open Backness
Back Roundedness
Rounded
        ]

diacriticP :: Char -> Parser Char
diacriticP :: Char -> Parser Text Char
diacriticP = Char -> Parser Text Char
P.char

doubleArticulated :: Text -> Text -> Parser Text
doubleArticulated :: Text -> Text -> Parser Text Text
doubleArticulated Text
x Text
y = Text -> Parser Text Text
P.string (Text -> Parser Text Text) -> Text -> Parser Text Text
forall a b. (a -> b) -> a -> b
$ Text
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
invertedBreve Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
y
  where
    invertedBreve :: Text
invertedBreve = Text
"\x0361"

suprasegmentalFeatureP :: Parser SuprasegmentalFeature
suprasegmentalFeatureP :: Parser Text SuprasegmentalFeature
suprasegmentalFeatureP = [Parser Text SuprasegmentalFeature]
-> Parser Text SuprasegmentalFeature
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text SuprasegmentalFeature]
fs
  where
    fs :: [Parser Text SuprasegmentalFeature]
fs = [ Parser Text SuprasegmentalFeature
toneContourP
         , Parser Text SuprasegmentalFeature
toneContourDiacriticP
         , Parser Text SuprasegmentalFeature
levelToneP
         , Parser Text SuprasegmentalFeature
levelToneDiacriticP
         , [Parser Int] -> Parser Text SuprasegmentalFeature
forall (t :: * -> *).
Foldable t =>
t (Parser Int) -> Parser Text SuprasegmentalFeature
toneNumberP [Parser Int]
digits
         , Parser Text Text
"." Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SuprasegmentalFeature
Break
         , Parser Text Text
"\x203f" Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SuprasegmentalFeature
Linking
         ]

    levelToneP :: Parser Text SuprasegmentalFeature
levelToneP = LevelTone -> SuprasegmentalFeature
LevelLexicalTone
        (LevelTone -> SuprasegmentalFeature)
-> Parser Text LevelTone -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text LevelTone] -> Parser Text LevelTone
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"\x02e5" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraHighTone
                 , Parser Text Text
"\x02e6" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
HighTone
                 , Parser Text Text
"\x02e7" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
MidTone
                 , Parser Text Text
"\x02e8" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
LowTone
                 , Parser Text Text
"\x02e9" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraLowTone
                 ]

    levelToneDiacriticP :: Parser Text SuprasegmentalFeature
levelToneDiacriticP = LevelTone -> SuprasegmentalFeature
LevelLexicalToneDiacritic
        (LevelTone -> SuprasegmentalFeature)
-> Parser Text LevelTone -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text LevelTone] -> Parser Text LevelTone
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"\x030b" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraHighTone
                 , Parser Text Text
"\x0341" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
HighTone
                 , Parser Text Text
"\x0304" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
MidTone
                 , Parser Text Text
"\x0340" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
LowTone
                 , Parser Text Text
"\x030f" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraLowTone
                 , Parser Text Text
"\xa71c" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
DownStep
                 , Parser Text Text
"\xa71b" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
UpStep
                 ]

    toneContourP :: Parser Text SuprasegmentalFeature
toneContourP = ToneContour -> SuprasegmentalFeature
LexicalToneContour
        (ToneContour -> SuprasegmentalFeature)
-> Parser Text ToneContour -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text ToneContour] -> Parser Text ToneContour
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"\x02e9\x02e5" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Rising
                 , Parser Text Text
"\x02e5\x02e9" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Falling
                 , Parser Text Text
"\x02e7\x02e5" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighRising
                 , Parser Text Text
"\x02e9\x02e7" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowRising
                 , Parser Text Text
"\x02e5\x02e7" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighFalling
                 , Parser Text Text
"\x02e7\x02e9" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowFalling
                 , Parser Text Text
"\x02e7\x02e6\x02e8" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
RisingFalling
                 , Parser Text Text
"\x02e7\x02e8\x02e6" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
FallingRising
                 , Parser Text Text
"\x2197" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
GlobalRise
                 , Parser Text Text
"\x2199" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
GlobalFall
                 ]

    toneContourDiacriticP :: Parser Text SuprasegmentalFeature
toneContourDiacriticP = ToneContour -> SuprasegmentalFeature
LexicalToneContourDiacritic
        (ToneContour -> SuprasegmentalFeature)
-> Parser Text ToneContour -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text ToneContour] -> Parser Text ToneContour
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"\x0302" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Rising
                 , Parser Text Text
"\x030c" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Falling
                 , Parser Text Text
"\x1dc9" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighRising
                 , Parser Text Text
"\x1dc5" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowRising
                 , Parser Text Text
"\x1dc7" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighFalling
                 , Parser Text Text
"\x1dc6" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowFalling
                 , Parser Text Text
"\x1dc8" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
RisingFalling
                 , Parser Text Text
"\x1dc9" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
FallingRising
                 ]

    digits :: [Parser Int]
digits = [ Parser Text Text
"\x2070" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
0
             , Parser Text Text
"\x00b9" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
1
             , Parser Text Text
"\x00b2" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
2
             , Parser Text Text
"\x00b3" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
3
             , Parser Text Text
"\x2074" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
4
             , Parser Text Text
"\x2075" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
5
             , Parser Text Text
"\x2076" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
6
             , Parser Text Text
"\x2077" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
7
             , Parser Text Text
"\x2078" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
8
             , Parser Text Text
"\x2079" Parser Text Text -> Int -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Int
9
             ]

stressP :: Parser SuprasegmentalFeature
stressP :: Parser Text SuprasegmentalFeature
stressP = Parser Text Text
"\x02c8" Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Stress -> SuprasegmentalFeature
Stress Stress
Primary Parser Text SuprasegmentalFeature
-> Parser Text SuprasegmentalFeature
-> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"\x02cc" Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Stress -> SuprasegmentalFeature
Stress Stress
Secondary

toneNumberP :: (Foldable t) => t (Parser Int) -> Parser SuprasegmentalFeature
toneNumberP :: t (Parser Int) -> Parser Text SuprasegmentalFeature
toneNumberP t (Parser Int)
digits = Int -> SuprasegmentalFeature
ToneNumber
    (Int -> SuprasegmentalFeature)
-> Parser Int -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Parser Int -> Parser Text [Int]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some (t (Parser Int) -> Parser Int
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum t (Parser Int)
digits) Parser Text [Int] -> ([Int] -> Int) -> Parser Int
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (Int -> Int -> Int) -> Int -> [Int] -> Int
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (\Int
a Int
b -> Int
b Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
a Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
10) Int
0)

consT :: (Applicative t, Monoid (t a)) => a -> t a -> t a
consT :: a -> t a -> t a
consT a
x t a
xs = a -> t a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
x t a -> t a -> t a
forall a. Semigroup a => a -> a -> a
<> t a
xs

manyT :: (Applicative t, Monoid (t a), Alternative f) => f a -> f (t a)
manyT :: f a -> f (t a)
manyT f a
v = f (t a)
manyT'
  where
    manyT' :: f (t a)
manyT' = f (t a)
someT' f (t a) -> f (t a) -> f (t a)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> t a -> f (t a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure t a
forall a. Monoid a => a
mempty

    someT' :: f (t a)
someT' = a -> t a -> t a
forall (t :: * -> *) a.
(Applicative t, Monoid (t a)) =>
a -> t a -> t a
consT (a -> t a -> t a) -> f a -> f (t a -> t a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f a
v f (t a -> t a) -> f (t a) -> f (t a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f (t a)
manyT'

someT :: (Applicative t, Monoid (t a), Alternative f) => f a -> f (t a)
someT :: f a -> f (t a)
someT f a
v = a -> t a -> t a
forall (t :: * -> *) a.
(Applicative t, Monoid (t a)) =>
a -> t a -> t a
consT (a -> t a -> t a) -> f a -> f (t a -> t a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f a
v f (t a -> t a) -> f (t a) -> f (t a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> f a -> f (t a)
forall (t :: * -> *) a (f :: * -> *).
(Applicative t, Monoid (t a), Alternative f) =>
f a -> f (t a)
manyT f a
v

handleResult :: (Text -> IPAException)
             -> Text
             -> IResult Text b
             -> Either IPAException b
handleResult :: (Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
ty Text
t IResult Text b
i = case IResult Text b
i of
    Done Text
_ b
r    -> b -> Either IPAException b
forall a b. b -> Either a b
Right b
r
    Fail Text
ch [[Char]]
_ [Char]
_ -> IPAException -> Either IPAException b
forall a b. a -> Either a b
Left (IPAException -> Either IPAException b)
-> (Text -> IPAException) -> Text -> Either IPAException b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> IPAException
ty (Text -> Either IPAException b) -> Text -> Either IPAException b
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
forall a. Monoid a => [a] -> a
mconcat [ Text
t, Text
" ", Text
"'", Text
ch, Text
"'" ]
    Partial Text -> IResult Text b
p   -> (Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
ty Text
t (Text -> IResult Text b
p Text
forall a. Monoid a => a
mempty)

-------------------------------------------------------------------------------
--                               X-SAMPA Parser                              --
-------------------------------------------------------------------------------
-- | As 'parseSegment', but in X-SAMPA notation
parseSegmentXSampa :: Text -> Either IPAException Segment
parseSegmentXSampa :: Text -> Either IPAException Segment
parseSegmentXSampa Text
t =
    (Text -> IPAException)
-> Text -> IResult Text Segment -> Either IPAException Segment
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidXSampa
                 Text
msg
                 (Parser Segment -> Text -> IResult Text Segment
forall a. Parser a -> Text -> Result a
P.parse (Parser Segment
segmentXSampaP Parser Segment -> Parser Text () -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) Text
t)
  where
    msg :: Text
msg = Text
"Failed to parse character(s):"

-- | As 'parseSyllable', but in X-SAMPA notation
parseSyllableXSampa
    :: MultiSegment t => Text -> Either IPAException (Syllable t)
parseSyllableXSampa :: Text -> Either IPAException (Syllable t)
parseSyllableXSampa Text
t =
    (Text -> IPAException)
-> Text
-> IResult Text (Syllable t)
-> Either IPAException (Syllable t)
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidXSampa
                 Text
msg
                 (Parser (Syllable t) -> Text -> IResult Text (Syllable t)
forall a. Parser a -> Text -> Result a
P.parse (Parser (Syllable t)
forall (t :: * -> *). MultiSegment t => Parser (Syllable t)
syllableXSampaP Parser (Syllable t) -> Parser Text () -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) Text
t)
  where
    msg :: Text
msg = Text
"Failed to parse segment(s):"

-- | As 'parseSyllables', but in X-SAMPA notation
parseSyllablesXSampa :: (MultiSegment t, Monoid (t (Syllable t)))
                     => Text
                     -> Either IPAException (t (Syllable t))
parseSyllablesXSampa :: Text -> Either IPAException (t (Syllable t))
parseSyllablesXSampa Text
t =
    (Text -> IPAException)
-> Text
-> IResult Text (t (Syllable t))
-> Either IPAException (t (Syllable t))
forall b.
(Text -> IPAException)
-> Text -> IResult Text b -> Either IPAException b
handleResult Text -> IPAException
InvalidXSampa
                 Text
msg
                 (Parser (t (Syllable t)) -> Text -> IResult Text (t (Syllable t))
forall a. Parser a -> Text -> Result a
P.parse (Parser (t (Syllable t))
forall (t :: * -> *).
(MultiSegment t, Monoid (t (Syllable t))) =>
Parser (t (Syllable t))
syllablesXSampaP Parser (t (Syllable t))
-> Parser Text () -> Parser (t (Syllable t))
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text ()
forall t. Chunk t => Parser t ()
P.endOfInput) Text
t)
  where
    msg :: Text
msg = Text
"Failed to parse syllable:"

-- | As 'segmentP', but in X-SAMPA notation
segmentXSampaP :: Parser Segment
segmentXSampaP :: Parser Segment
segmentXSampaP = Parser Segment
withFeatureP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
pureSegmentP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
optionalP
  where
    pureSegmentP :: Parser Segment
pureSegmentP = Parser Segment
vowelXSampaP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Consonant -> Segment
Consonant (Consonant -> Segment) -> Parser Text Consonant -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Consonant
consonantXSampaP

    withFeatureP :: Parser Segment
withFeatureP = (SegmentalFeature -> Segment -> Segment)
-> Segment -> [SegmentalFeature] -> Segment
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SegmentalFeature -> Segment -> Segment
WithSegmentalFeature (Segment -> [SegmentalFeature] -> Segment)
-> Parser Segment -> Parser Text ([SegmentalFeature] -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Segment
pureSegmentP
        Parser Text ([SegmentalFeature] -> Segment)
-> Parser Text [SegmentalFeature] -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SegmentalFeature -> Parser Text [SegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser Text SegmentalFeature
segmentalFeatureXSampaP

    optionalP :: Parser Segment
optionalP    = Segment -> Segment
Optional
        (Segment -> Segment) -> Parser Segment -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Parser Text Text
"(" Parser Text Text -> Parser Segment -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Parser Segment
withFeatureP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
pureSegmentP) Parser Segment -> Parser Text Text -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
")")

-- | As 'syllableP', but in X-SAMPA notation
syllableXSampaP :: MultiSegment t => Parser (Syllable t)
syllableXSampaP :: Parser (Syllable t)
syllableXSampaP = Parser (Syllable t)
withStressP Parser (Syllable t) -> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser (Syllable t)
withFeaturesP Parser (Syllable t) -> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments
  where
    justSegments :: Parser Text (t Segment)
justSegments = Parser Segment -> Parser Text (t Segment)
forall (t :: * -> *) a (f :: * -> *).
(Applicative t, Monoid (t a), Alternative f) =>
f a -> f (t a)
someT Parser Segment
segmentXSampaP

    withFeaturesP :: Parser (Syllable t)
withFeaturesP = (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Syllable t -> [SuprasegmentalFeature] -> Syllable t
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature
        (Syllable t -> [SuprasegmentalFeature] -> Syllable t)
-> Parser (Syllable t)
-> Parser Text ([SuprasegmentalFeature] -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments)
        Parser Text ([SuprasegmentalFeature] -> Syllable t)
-> Parser Text [SuprasegmentalFeature] -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SuprasegmentalFeature
-> Parser Text [SuprasegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
some Parser Text SuprasegmentalFeature
suprasegmentalFeatureXSampaP

    withStressP :: Parser (Syllable t)
withStressP = (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Syllable t -> [SuprasegmentalFeature] -> Syllable t
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature (Syllable t -> [SuprasegmentalFeature] -> Syllable t)
-> Parser (Syllable t)
-> Parser Text ([SuprasegmentalFeature] -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser (Syllable t)
withStress
        Parser Text ([SuprasegmentalFeature] -> Syllable t)
-> Parser Text [SuprasegmentalFeature] -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text SuprasegmentalFeature
-> Parser Text [SuprasegmentalFeature]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser Text SuprasegmentalFeature
suprasegmentalFeatureXSampaP
      where
        withStress :: Parser (Syllable t)
withStress = SuprasegmentalFeature -> Syllable t -> Syllable t
forall (t :: * -> *).
SuprasegmentalFeature -> Syllable t -> Syllable t
WithSuprasegmentalFeature (SuprasegmentalFeature -> Syllable t -> Syllable t)
-> Parser Text SuprasegmentalFeature
-> Parser Text (Syllable t -> Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text SuprasegmentalFeature
stressXSampaP
            Parser Text (Syllable t -> Syllable t)
-> Parser (Syllable t) -> Parser (Syllable t)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (t Segment -> Syllable t
forall (t :: * -> *). t Segment -> Syllable t
Syllable (t Segment -> Syllable t)
-> Parser Text (t Segment) -> Parser (Syllable t)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text (t Segment)
justSegments)

syllablesXSampaP :: (MultiSegment t, Monoid (t (Syllable t)))
                 => Parser (t (Syllable t))
syllablesXSampaP :: Parser (t (Syllable t))
syllablesXSampaP = Parser Text (Syllable t) -> Parser (t (Syllable t))
forall (t :: * -> *) a (f :: * -> *).
(Applicative t, Monoid (t a), Alternative f) =>
f a -> f (t a)
someT Parser Text (Syllable t)
withWS
  where
    withWS :: Parser Text (Syllable t)
withWS = Parser Text (Syllable t)
forall (t :: * -> *). MultiSegment t => Parser (Syllable t)
syllableXSampaP Parser Text (Syllable t)
-> Parser Text [Char] -> Parser Text (Syllable t)
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char -> Parser Text [Char]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
many Parser Text Char
P.space

consonantXSampaP :: Parser Consonant
consonantXSampaP :: Parser Text Consonant
consonantXSampaP = Parser Text Consonant
clickXSampaP
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
implosiveXSampaP
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
ejectiveXSampaP
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
doublyArticulatedXSampaP
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Consonant
pulmonicXSampaP

vowelXSampaP :: Parser Segment
vowelXSampaP :: Parser Segment
vowelXSampaP = Parser Segment
triphthongP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Segment
diphthongP Parser Segment -> Parser Segment -> Parser Segment
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Vowel -> Segment
Vowel (Vowel -> Segment) -> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP
  where
    diphthongP :: Parser Segment
diphthongP  = Vowel -> Vowel -> Segment
Diphthong (Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP Parser Text (Vowel -> Segment)
-> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP

    triphthongP :: Parser Segment
triphthongP = Vowel -> Vowel -> Vowel -> Segment
Triphthong (Vowel -> Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Vowel -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Text Vowel
pureP Parser Text (Vowel -> Vowel -> Segment)
-> Parser Text Vowel -> Parser Text (Vowel -> Segment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP Parser Text (Vowel -> Segment)
-> Parser Text Vowel -> Parser Segment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Text Vowel
pureP

    pv :: Height -> Backness -> Roundedness -> Vowel
pv          = Height -> Backness -> Roundedness -> Vowel
Pure

    lowered :: Parser Text Text
lowered     = Parser Text Text
"_o"

    pureP :: Parser Text Vowel
pureP       =
        [Parser Text Vowel] -> Parser Text Vowel
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"e" Parser Text Text -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"2" Parser Text Text -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Front Roundedness
Rounded
             , Parser Text Text
"7" Parser Text Text -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"o" Parser Text Text -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
lowered Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Back Roundedness
Rounded
             , Parser Text Text
"i" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Front Roundedness
Unrounded
             , Parser Text Text
"y" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Front Roundedness
Rounded
             , Parser Text Text
"1" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Central Roundedness
Unrounded
             , Parser Text Text
"}" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Central Roundedness
Rounded
             , Parser Text Text
"M" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Back Roundedness
Unrounded
             , Parser Text Text
"u" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Close Backness
Back Roundedness
Rounded
             , Parser Text Text
"I" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Front Roundedness
Unrounded
             , Parser Text Text
"Y" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Front Roundedness
Rounded
             , Parser Text Text
"U" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearClose Backness
Back Roundedness
Rounded
             , Parser Text Text
"e" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"2" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Front Roundedness
Rounded
             , Parser Text Text
"@" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"8" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Central Roundedness
Rounded
             , Parser Text Text
"7" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"o" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
CloseMid Backness
Back Roundedness
Rounded
             , Parser Text Text
"@" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Mid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"E" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Front Roundedness
Unrounded
             , Parser Text Text
"9" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Front Roundedness
Rounded
             , Parser Text Text
"3" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Central Roundedness
Unrounded
             , Parser Text Text
"3" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Central Roundedness
Rounded
             , Parser Text Text
"V" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Back Roundedness
Unrounded
             , Parser Text Text
"O" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
OpenMid Backness
Back Roundedness
Rounded
             , Parser Text Text
"{" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearOpen Backness
Front Roundedness
Unrounded
             , Parser Text Text
"6" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
NearOpen Backness
Central Roundedness
Unrounded
             , Parser Text Text
"a" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Front Roundedness
Unrounded
             , Parser Text Text
"&" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Front Roundedness
Rounded
             , Parser Text Text
"A" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Back Roundedness
Unrounded
             , Parser Text Text
"Q" Parser Text Text -> Vowel -> Parser Text Vowel
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Height -> Backness -> Roundedness -> Vowel
pv Height
Open Backness
Back Roundedness
Rounded
             ]

pulmonicXSampaP :: Parser Consonant
pulmonicXSampaP :: Parser Text Consonant
pulmonicXSampaP =
    [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Consonant
biliabialP
         , Parser Text Consonant
labioDentalP
         , Parser Text Consonant
dentalP
         , Parser Text Consonant
postAlveolarP
         , Parser Text Consonant
retroflexP
         , Parser Text Consonant
palatalP
         , Parser Text Consonant
velarP
         , Parser Text Consonant
uvularP
         , Parser Text Consonant
pharyngealP
         , Parser Text Consonant
glottalP
         , Parser Text Consonant
alveolarP
         ]
  where
    biliabialP :: Parser Text Consonant
biliabialP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        bc :: Phonation -> Manner -> Consonant
bc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Bilabial

        cs :: [Parser Text Consonant]
cs   = [ Parser Text Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Nasal
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"p" Text
"p" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash
                 Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"b" Text
"B"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
               , Parser Text Text
"B" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"p" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"B" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Trill
               , Parser Text Text
"b" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiced Manner
Plosive
               , Parser Text Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
bc Phonation
Voiceless Manner
Plosive
               ]

    labioDentalP :: Parser Text Consonant
labioDentalP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        ldc :: Phonation -> Manner -> Consonant
ldc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
LabioDental

        cs :: [Parser Text Consonant]
cs    = [ Parser Text Text
"F" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced Manner
Nasal
                , Parser Text Text
"f" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
                , Parser Text Text
"v" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
                , Parser Text Text
"P" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ldc Phonation
Voiced Manner
Approximant
                ]

    dentalP :: Parser Text Consonant
dentalP = Parser Text Text
"T" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
dc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"D" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
dc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
      where
        dc :: Phonation -> Manner -> Consonant
dc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Dental

    alveolarP :: Parser Text Consonant
alveolarP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        ac :: Phonation -> Manner -> Consonant
ac Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Alveolar

        cs :: [Parser Text Consonant]
cs   = [ Parser Text Text
"n" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Nasal
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"s"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"d" Text
"z"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
               , Parser Text Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
               , Parser Text Text
"z" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
               , Parser Text Text
"r" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Approximant
               , Parser Text Text
"4" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Flap
               , Parser Text Text
"r" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Trill
               , Parser Text Text
"K" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless Manner
LateralFricative
               , Parser Text Text
"K" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralFricative
               , Parser Text Text
"l" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
LateralApproximant
               , Parser Text Text
"t" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiceless Manner
Plosive
               , Parser Text Text
"d" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
ac Phonation
Voiced Manner
Plosive
               ]

    postAlveolarP :: Parser Text Consonant
postAlveolarP = Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"S"
        Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"d" Text
"Z" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"S" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"Z" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
PostAlveolar

    retroflexP :: Parser Text Consonant
retroflexP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        rc :: Phonation -> Manner -> Consonant
rc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Retroflex

        retroflexDiacritic :: Parser Text Char
retroflexDiacritic = Char -> Parser Text Char
diacriticP Char
'`'

        cs :: [Parser Text Consonant]
cs                 =
            [ Parser Text Text
"n" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Nasal
            , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t`" Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic
              Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"d`" Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic
              Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
            , Parser Text Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"z" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
            , Parser Text Text
"r" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Approximant
            , Parser Text Text
"r" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Flap
            , Parser Text Text
"l" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
LateralApproximant
            , Parser Text Text
"t" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiceless Manner
Plosive
            , Parser Text Text
"d" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
retroflexDiacritic Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
rc Phonation
Voiced Manner
Plosive
            ]

    palatalP :: Parser Text Consonant
palatalP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Palatal

        cs :: [Parser Text Consonant]
cs   = [ Parser Text Text
"J" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Nasal
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash
                 Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
Sibilant)
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"d" Text
"z" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash
                 Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
Sibilant)
               , Parser Text Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
Sibilant)
               , Parser Text Text
"z" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
Sibilant)
               , Parser Text Text
"C" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"j" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"j" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Approximant
               , Parser Text Text
"L" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
LateralApproximant
               , Parser Text Text
"c" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless Manner
Plosive
               , Parser Text Text
"J" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced Manner
Plosive
               ]

    velarP :: Parser Text Consonant
velarP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        vc :: Phonation -> Manner -> Consonant
vc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Velar

        cs :: [Parser Text Consonant]
cs   = [ Parser Text Text
"N" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Nasal
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"k" Text
"x"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"g" Text
"G"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
               , Parser Text Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"G" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"m" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Approximant
               , Parser Text Text
"L" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
LateralApproximant
               , Parser Text Text
"k" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiceless Manner
Plosive
               , Parser Text Text
"g" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
vc Phonation
Voiced Manner
Plosive
               ]

    uvularP :: Parser Text Consonant
uvularP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
      where
        uc :: Phonation -> Manner -> Consonant
uc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Uvular

        cs :: [Parser Text Consonant]
cs   = [ Parser Text Text
"N" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Nasal
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"q" Text
"X"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"G\\" Text
"R"
                 Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"X" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"R" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
               , Parser Text Text
"R" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Trill
               , Parser Text Text
"q" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiceless Manner
Plosive
               , Parser Text Text
"G" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
uc Phonation
Voiced Manner
Plosive
               ]

    pharyngealP :: Parser Text Consonant
pharyngealP = Parser Text Text
"X" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"?" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
pc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
      where
        pc :: Phonation -> Manner -> Consonant
pc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Pharyngeal

    glottalP :: Parser Text Consonant
glottalP = Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"?" Text
"h" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash
        Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"?" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless Manner
Plosive
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"h" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiceless (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"h" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Manner -> Consonant
gc Phonation
Voiced (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
      where
        gc :: Phonation -> Manner -> Consonant
gc Phonation
v = Phonation -> Place -> Manner -> Consonant
Pulmonic Phonation
v Place
Glottal

ejectiveXSampaP :: Parser Consonant
ejectiveXSampaP :: Parser Text Consonant
ejectiveXSampaP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs Parser Text Consonant -> Parser Text Text -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
ejective
  where
    ejective :: Parser Text Text
ejective = Parser Text Text
"_>"

    ej :: Place -> Manner -> Consonant
ej       = Place -> Manner -> Consonant
Ejective

    cs :: [Parser Text Consonant]
cs       =
        [ Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"q" Text
"X" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"S"
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
PostAlveolar (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t`" Text
"s`"
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash
          Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal (Sibilance -> Manner
Affricate Sibilance
Sibilant)
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"k" Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar (Sibilance -> Manner
Affricate Sibilance
NonSibilant)
        , Parser Text Text
"p" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Bilabial Manner
Plosive
        , Parser Text Text
"p" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Bilabial (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"f" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
LabioDental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"T" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Dental (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"t" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar Manner
Plosive
        , Parser Text Text
"s" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Alveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"S" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
PostAlveolar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"t`" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex Manner
Plosive
        , Parser Text Text
"s`" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Retroflex (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"c" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal Manner
Plosive
        , Parser Text Text
"s" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Palatal (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        , Parser Text Text
"k" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar Manner
Plosive
        , Parser Text Text
"x" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"q" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular Manner
Plosive
        , Parser Text Text
"X" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place -> Manner -> Consonant
ej Place
Uvular (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        ]

implosiveXSampaP :: Parser Consonant
implosiveXSampaP :: Parser Text Consonant
implosiveXSampaP = Phonation -> Place -> Consonant
Implosive Phonation
Voiceless (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Place]
cs Parser Text Consonant -> Parser Text Text -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
implosive Parser Text Consonant -> Parser Text Text -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
voiceless
    Parser Text Consonant
-> Parser Text Consonant -> Parser Text Consonant
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Phonation -> Place -> Consonant
Implosive Phonation
Voiced (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Place]
cs Parser Text Consonant -> Parser Text Text -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Text
implosive
  where
    voiceless :: Parser Text Text
voiceless = Parser Text Text
"_0"

    implosive :: Parser Text Text
implosive = Parser Text Text
"_<"

    cs :: [Parser Text Place]
cs        = [ Parser Text Text
"b" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Bilabial
                , Parser Text Text
"d" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Alveolar
                , Parser Text Text
"d`" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Retroflex
                , Parser Text Text
"f" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Palatal
                , Parser Text Text
"g" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Velar
                , Parser Text Text
"G" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Uvular
                ]

clickXSampaP :: Parser Consonant
clickXSampaP :: Parser Text Consonant
clickXSampaP = Place -> Consonant
Click
    (Place -> Consonant) -> Parser Text Place -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text Place] -> Parser Text Place
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"O" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Bilabial
             , Parser Text Text
"|" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Dental
             , Parser Text Text
"!" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Alveolar
             , Parser Text Text
"|" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Text
"|" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
PostAlveolar
             , Parser Text Text
"=" Parser Text Text -> Place -> Parser Text Place
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Place
Palatal
             ]
    Parser Text Consonant -> Parser Text Char -> Parser Text Consonant
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Parser Text Char
slash

doublyArticulatedXSampaP :: Parser Consonant
doublyArticulatedXSampaP :: Parser Text Consonant
doublyArticulatedXSampaP = [Parser Text Consonant] -> Parser Text Consonant
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text Consonant]
cs
  where
    da :: Phonation -> Place -> Place -> Manner -> Consonant
da = Phonation -> Place -> Place -> Manner -> Consonant
DoublyArticulated

    cs :: [Parser Text Consonant]
cs =
        [ Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"n" Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Alveolar Manner
Nasal
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"t" Text
"p"
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Alveolar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"d" Text
"b"
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Alveolar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"N" Text
"m" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Nasal
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"k" Text
"p"
          Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Velar Manner
Plosive
        , Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
"g" Text
"b" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Plosive
        , Parser Text Text
"H_0" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Palatal (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"H" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Palatal Manner
Approximant
        , Parser Text Text
"W" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
Bilabial Place
Velar (Sibilance -> Manner
Fricative Sibilance
NonSibilant)
        , Parser Text Text
"w" Parser Text Text -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiced Place
Bilabial Place
Velar Manner
Approximant
        , Parser Text Text
"x" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char -> Consonant -> Parser Text Consonant
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> Place -> Place -> Manner -> Consonant
da Phonation
Voiceless Place
PostAlveolar Place
Velar (Sibilance -> Manner
Fricative Sibilance
Sibilant)
        ]

segmentalFeatureXSampaP :: Parser SegmentalFeature
segmentalFeatureXSampaP :: Parser Text SegmentalFeature
segmentalFeatureXSampaP = Parser Text SegmentalFeature
secondaryArticulationP Parser Text SegmentalFeature
-> Parser Text SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> [Parser Text SegmentalFeature] -> Parser Text SegmentalFeature
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text SegmentalFeature]
fs
  where
    fs :: [Parser Text SegmentalFeature]
fs = [ Parser Text Text
"_0" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> SegmentalFeature
Voicing Phonation
Voiceless
         , Parser Text Text
"_v" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Phonation -> SegmentalFeature
Voicing Phonation
Voiced
         , Parser Text Text
"::" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
OverLong
         , Parser Text Text
":" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
HalfLong
         , Parser Text Text
":" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
Long
         , Parser Text Text
"_X" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Length -> SegmentalFeature
Length Length
ExtraShort
         , Parser Text Text
"_h" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Aspirated
         , Parser Text Text
"_O" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
MoreRounded
         , Parser Text Text
"_c" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
LessRounded
         , Parser Text Text
"_+" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Advanced
         , Parser Text Text
"_-" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Retracted
         , Parser Text Text
"_\"" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Centralized
         , Parser Text Text
"_x" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
MidCentralized
         , Parser Text Text
"=" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Syllabic
         , Parser Text Text
"_^" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
NonSyllabic
         , Parser Text Text
"`" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Rhotacized
         , Parser Text Text
"_t" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
BreathyVoice
         , Parser Text Text
"_k" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
CreakyVoice
         , Parser Text Text
"_w" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Labialized
         , Parser Text Text
"'" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Palatalized
         , Parser Text Text
"_G" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Velarized
         , Parser Text Text
"_?" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Pharyngealized
         , Parser Text Text
"_r" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Raised
         , Parser Text Text
"_o" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Lowered
         , Parser Text Text
"_A" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
AdvancedTongueRoot
         , Parser Text Text
"_q" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
RetractedTongueRoot
         , Parser Text Text
"_d" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Dentalized
         , Parser Text Text
"_a" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Apical
         , Parser Text Text
"_m" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Laminal
         , Parser Text Text
"~" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
Nasalized
         , Parser Text Text
"_l" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
LateralRelease
         , Parser Text Text
"_}" Parser Text Text
-> SegmentalFeature -> Parser Text SegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SegmentalFeature
NoAudibleRelease
         ]

suprasegmentalFeatureXSampaP :: Parser SuprasegmentalFeature
suprasegmentalFeatureXSampaP :: Parser Text SuprasegmentalFeature
suprasegmentalFeatureXSampaP = [Parser Text SuprasegmentalFeature]
-> Parser Text SuprasegmentalFeature
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [Parser Text SuprasegmentalFeature]
fs
  where
    fs :: [Parser Text SuprasegmentalFeature]
fs           =
        [ Parser Text SuprasegmentalFeature
toneContourP, Parser Text SuprasegmentalFeature
levelToneP, Parser Text Text
"." Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SuprasegmentalFeature
Break, Parser Text Text
"-" Parser Text Text -> Parser Text Char -> Parser Text Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Parser Text Char
slash Parser Text Char
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> SuprasegmentalFeature
Linking ]

    levelToneP :: Parser Text SuprasegmentalFeature
levelToneP   = LevelTone -> SuprasegmentalFeature
LevelLexicalTone
        (LevelTone -> SuprasegmentalFeature)
-> Parser Text LevelTone -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text LevelTone] -> Parser Text LevelTone
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"_T" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraHighTone
                 , Parser Text Text
"_H" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
HighTone
                 , Parser Text Text
"_M" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
MidTone
                 , Parser Text Text
"_L" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
LowTone
                 , Parser Text Text
"_B" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
ExtraLowTone
                 , Parser Text Text
"!" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
DownStep
                 , Parser Text Text
"^" Parser Text Text -> LevelTone -> Parser Text LevelTone
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> LevelTone
UpStep
                 ]

    toneContourP :: Parser Text SuprasegmentalFeature
toneContourP = ToneContour -> SuprasegmentalFeature
LexicalToneContour
        (ToneContour -> SuprasegmentalFeature)
-> Parser Text ToneContour -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Text ToneContour] -> Parser Text ToneContour
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum [ Parser Text Text
"_R" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Rising
                 , Parser Text Text
"_F" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
Falling
                 , Parser Text Text
"_H_T" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighRising
                 , Parser Text Text
"_B_L" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowRising
                 , Parser Text Text
"_H_F" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
HighFalling
                 , Parser Text Text
"_L_B" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
LowFalling
                 , Parser Text Text
"_R_F" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
RisingFalling
                 , Parser Text Text
"_F_R" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
FallingRising
                 , Parser Text Text
"<R>" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
GlobalRise
                 , Parser Text Text
"<F>" Parser Text Text -> ToneContour -> Parser Text ToneContour
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> ToneContour
GlobalFall
                 ]

slash :: Parser Char
slash :: Parser Text Char
slash = Char -> Parser Text Char
P.char Char
'\\'

doubleArticulatedXSampa :: Text -> Text -> Parser Text
doubleArticulatedXSampa :: Text -> Text -> Parser Text Text
doubleArticulatedXSampa Text
x Text
y = Text -> Parser Text Text
P.string (Text -> Parser Text Text) -> Text -> Parser Text Text
forall a b. (a -> b) -> a -> b
$ Text
x Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"_" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
y

stressXSampaP :: Parser SuprasegmentalFeature
stressXSampaP :: Parser Text SuprasegmentalFeature
stressXSampaP = (Parser Text Text
"\"" Parser Text Text -> Parser Text Text -> Parser Text Text
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"\'") Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Stress -> SuprasegmentalFeature
Stress Stress
Primary Parser Text SuprasegmentalFeature
-> Parser Text SuprasegmentalFeature
-> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Parser Text Text
"%" Parser Text Text
-> SuprasegmentalFeature -> Parser Text SuprasegmentalFeature
forall (f :: * -> *) a b. Functor f => f a -> b -> f b
$> Stress -> SuprasegmentalFeature
Stress Stress
Secondary