-- | Defines various sentence level combinators that may be based in English and
-- not necessarily have a conceptual link. See the [Wiki](https://github.com/JacquesCarette/Drasil/wiki/Combinator-Documentation)
-- for more information. There are also @C@ variants to each combinator to
-- denote those meant for use at the start of a sentence (capitalizes the first word).
-- This module should be used as a qualified import (usually as @S@),
-- as many function names clash with those in Concepts.hs and NounPhrase.hs.
module Language.Drasil.Sentence.Combinators (
  -- * \"And\" Combinators
  and_, andIts, andThe,
  -- * \"The\" Combinators
  fromThe, inThe, onThe, toThe, isThe, ofThe,
  the_ofThe, the_ofTheC, the_ofGiv, the_ofGivC, the_isExpctdToHvC,
  -- * \"For\" Combinators
  forTPS, forTPP, for, forT, forGen,
  -- * Other Combinators
  of_, ofA, or_, are, in_, is, defnAs, denotes, versus, wrt) where

import Language.Drasil.Classes ( NamedIdea )
import Language.Drasil.Development.Sentence ( titleize, titleize' )
import Language.Drasil.Sentence ( Sentence(S), (+:+) )


sentHelper :: String -> Sentence -> Sentence -> Sentence
-- | Inserts a String between two Sentences
sentHelper :: String -> Sentence -> Sentence -> Sentence
sentHelper String
inStr Sentence
a Sentence
b = Sentence
a Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
inStr Sentence -> Sentence -> Sentence
+:+ Sentence
b

andIts, andThe, fromThe, inThe, the_isExpctdToHvC, isThe, onThe, the_ofGiv, the_ofGivC, ofThe, the_ofThe, the_ofTheC, of_, ofA,
  or_, versus, and_, are, in_, is, toThe, for, denotes, wrt, defnAs :: Sentence -> Sentence -> Sentence

-- | Inserts the words "and its" between two Sentences.
andIts :: Sentence -> Sentence -> Sentence
andIts  = String -> Sentence -> Sentence -> Sentence
sentHelper String
"and its"
-- | Inserts the words "and the" between two Sentences.
andThe :: Sentence -> Sentence -> Sentence
andThe  = String -> Sentence -> Sentence -> Sentence
sentHelper String
"and the"
-- | Inserts the words "from the" between two Sentences.
fromThe :: Sentence -> Sentence -> Sentence
fromThe = String -> Sentence -> Sentence -> Sentence
sentHelper String
"from the"
-- | Inserts the words "in the" between two Sentences.
inThe :: Sentence -> Sentence -> Sentence
inThe   = String -> Sentence -> Sentence -> Sentence
sentHelper String
"in the"
-- | Inserts the words "is the" between two Sentences.
isThe :: Sentence -> Sentence -> Sentence
isThe   = String -> Sentence -> Sentence -> Sentence
sentHelper String
"is the"
-- | Inserts the words "on the" between two Sentences.
onThe :: Sentence -> Sentence -> Sentence
onThe   = String -> Sentence -> Sentence -> Sentence
sentHelper String
"on the"
-- | Inserts the word "and" between two Sentences.
and_ :: Sentence -> Sentence -> Sentence
and_    = String -> Sentence -> Sentence -> Sentence
sentHelper String
"and"
-- | Inserts the word "are" between two Sentences.
are :: Sentence -> Sentence -> Sentence
are    = String -> Sentence -> Sentence -> Sentence
sentHelper String
"are"
-- | Inserts the word "in" between two Sentences.
in_ :: Sentence -> Sentence -> Sentence
in_     = String -> Sentence -> Sentence -> Sentence
sentHelper String
"in"
-- | Inserts the word "is" between two Sentences.
is :: Sentence -> Sentence -> Sentence
is     = String -> Sentence -> Sentence -> Sentence
sentHelper String
"is"
-- | Inserts the word "of" between two Sentences.
of_ :: Sentence -> Sentence -> Sentence
of_     = String -> Sentence -> Sentence -> Sentence
sentHelper String
"of"
-- | Inserts the words "of a" between two Sentences.
ofA :: Sentence -> Sentence -> Sentence
ofA    = String -> Sentence -> Sentence -> Sentence
sentHelper String
"of a"
-- | Inserts the word "or" between two Sentences.
or_ :: Sentence -> Sentence -> Sentence
or_     = String -> Sentence -> Sentence -> Sentence
sentHelper String
"or"
-- | Inserts the word "versus" between two Sentences.
versus :: Sentence -> Sentence -> Sentence
versus = String -> Sentence -> Sentence -> Sentence
sentHelper String
"versus"
-- | Inserts the words "to the" between two Sentences.
toThe :: Sentence -> Sentence -> Sentence
toThe   = String -> Sentence -> Sentence -> Sentence
sentHelper String
"to the"
-- | Inserts the words "of the" between two Sentences.
ofThe :: Sentence -> Sentence -> Sentence
ofThe   = String -> Sentence -> Sentence -> Sentence
sentHelper String
"of the"
-- | Inserts the word "for" between two Sentences.
for :: Sentence -> Sentence -> Sentence
for    = String -> Sentence -> Sentence -> Sentence
sentHelper String
"for"
-- | Inserts the words "denotes the" between two Sentences.
denotes :: Sentence -> Sentence -> Sentence
denotes = String -> Sentence -> Sentence -> Sentence
sentHelper String
"denotes the"
-- | Inserts the words "with respect to" between two Sentences.
wrt :: Sentence -> Sentence -> Sentence
wrt     = String -> Sentence -> Sentence -> Sentence
sentHelper String
"with respect to"
-- | Inserts the words "defined as" between two Sentences.
defnAs :: Sentence -> Sentence -> Sentence
defnAs  = String -> Sentence -> Sentence -> Sentence
sentHelper String
"defined as"

-- | Similar to 'for', but both terms are 'titleize'd.
forT :: (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forT :: forall c d. (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forT c
t1 d
t2 = c -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize c
t1 Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"for" Sentence -> Sentence -> Sentence
+:+ d -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize d
t2
-- | Similar to 'forTT', but takes two arguments (for capitalization or pluralization) to apply to the two terms respectively.
forGen :: (c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forGen :: forall c d.
(c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forGen c -> Sentence
f1 d -> Sentence
f2 c
t1 d
t2 = c -> Sentence
f1 c
t1 Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"for" Sentence -> Sentence -> Sentence
+:+ d -> Sentence
f2 d
t2   

-- | Similar to 'for', but used for titles and first 'NamedIdea' is pluralized.
forTPS :: (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forTPS :: forall c d. (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forTPS = (c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forall c d.
(c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forGen c -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize' d -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize
-- | Similar to 'forTTPS', but both 'NamedIdea's are pluralized.
forTPP :: (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forTPP :: forall c d. (NamedIdea c, NamedIdea d) => c -> d -> Sentence
forTPP = (c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forall c d.
(c -> Sentence) -> (d -> Sentence) -> c -> d -> Sentence
forGen c -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize' d -> Sentence
forall n. NamedIdea n => n -> Sentence
titleize'

-- | Prepends \"The\" and inserts "is expected to have" between two Sentences.
the_isExpctdToHvC :: Sentence -> Sentence -> Sentence
the_isExpctdToHvC Sentence
a Sentence
b = String -> Sentence
S String
"The" Sentence -> Sentence -> Sentence
+:+ String -> Sentence -> Sentence -> Sentence
sentHelper String
"is expected to have" Sentence
a Sentence
b
-- | Prepends "the" and inserts "of a given" between two Sentences.
the_ofGiv :: Sentence -> Sentence -> Sentence
the_ofGiv        Sentence
a Sentence
b = String -> Sentence
S String
"the" Sentence -> Sentence -> Sentence
+:+ String -> Sentence -> Sentence -> Sentence
sentHelper String
"of a given"          Sentence
a Sentence
b
-- | Same as 'ofGiv', except first "the" is capitalized.
the_ofGivC :: Sentence -> Sentence -> Sentence
the_ofGivC       Sentence
a Sentence
b = String -> Sentence
S String
"The" Sentence -> Sentence -> Sentence
+:+ String -> Sentence -> Sentence -> Sentence
sentHelper String
"of a given"          Sentence
a Sentence
b
-- | Same as 'ofThe', but inserts "the" at the beginning of the Sentence.
the_ofThe :: Sentence -> Sentence -> Sentence
the_ofThe    Sentence
a Sentence
b = String -> Sentence
S String
"the" Sentence -> Sentence -> Sentence
+:+ String -> Sentence -> Sentence -> Sentence
sentHelper String
"of the"              Sentence
a Sentence
b
-- | Same as 'the_ofThe', except first "the" is capitalized.
the_ofTheC :: Sentence -> Sentence -> Sentence
the_ofTheC   Sentence
a Sentence
b = String -> Sentence
S String
"The" Sentence -> Sentence -> Sentence
+:+ String -> Sentence -> Sentence -> Sentence
sentHelper String
"of the"              Sentence
a Sentence
b