feat: abstracted out argumentMaker

This commit is contained in:
Nick 2024-11-15 23:28:32 -06:00
parent 55eb3a8a60
commit 833c6b5d94
6 changed files with 345 additions and 232 deletions

View file

@ -0,0 +1,53 @@
module Debate.Arguments.Ancestry.AncestralDiets exposing (..)
import Debate.Types exposing (..)
argumentAncestralDiets : Argument
argumentAncestralDiets =
{ argumentTitle = "Argument for Using the Term Retard"
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = "C(x)"
, definiens = "(x) slur's negative connotations have been neutralised"
}
, { definiendum = "B(x)"
, definiens = "(x) slur has been rendered non-bigoted via altered usage"
}
, { definiendum = "D(x)"
, definiens = "oppressed people will continue to suffer from the use of (x) slur"
}
, { definiendum = "S(x)"
, definiens = "it is permissible to neutralise the term retard's negative connotations"
}
, { definiendum = "A(x)"
, definiens = "it is generally permissible to use the term retard with an altered non-bigoted meaning"
}
, { definiendum = "r"
, definiens = "retard"
}
]
, argumentFormalization =
[ { premises =
[ { premise = "For all slurs, (x) slur's negative connotations have been neutralised if and only if, (x) slur has been rendered non-bigoted via altered usage."
, notation = "(x(CxBx))"
}
, { premise = "For all slurs, if it is not the case that (x) slur's negative connotations have been neutralised, then oppressed people will continue to suffer from the use of (x) slur."
, notation = "(x(¬CxDx))"
}
, { premise = "It is not the case that the term retard's negative connotations have been neutralised."
, notation = "(¬Cr)"
}
, { premise = "If the term retard has not been rendered non-bigoted via altered usage and oppressed people will continue to suffer from the use of the term retard, then it is permissible to neutralise the term retard's negative connotations."
, notation = "(¬BrDrSr)"
}
, { premise = "If it is permissible to neutralise the term retard's negative connotations, then It is generally permissible to use the term retard with an altered non-bigoted meaning."
, notation = "(SrAr)"
}
]
, conclusion = "Therefore, it is generally permissible to use the term retard with an altered non-bigoted meaning."
, conclusionNotation = "(Ar)"
}
]
}

View file

@ -0,0 +1,53 @@
module Debate.Arguments.Ethics.EthicalSlurs exposing (..)
import Debate.Types exposing (..)
argumentEthicalSlurs : Argument
argumentEthicalSlurs =
{ argumentTitle = "Argument for Using the Term Retard"
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = "C(x)"
, definiens = "(x) slur's negative connotations have been neutralised"
}
, { definiendum = "B(x)"
, definiens = "(x) slur has been rendered non-bigoted via altered usage"
}
, { definiendum = "D(x)"
, definiens = "oppressed people will continue to suffer from the use of (x) slur"
}
, { definiendum = "S(x)"
, definiens = "it is permissible to neutralise the term retard's negative connotations"
}
, { definiendum = "A(x)"
, definiens = "it is generally permissible to use the term retard with an altered non-bigoted meaning"
}
, { definiendum = "r"
, definiens = "retard"
}
]
, argumentFormalization =
[ { premises =
[ { premise = "For all slurs, (x) slur's negative connotations have been neutralised if and only if, (x) slur has been rendered non-bigoted via altered usage."
, notation = "(x(CxBx))"
}
, { premise = "For all slurs, if it is not the case that (x) slur's negative connotations have been neutralised, then oppressed people will continue to suffer from the use of (x) slur."
, notation = "(x(¬CxDx))"
}
, { premise = "It is not the case that the term retard's negative connotations have been neutralised."
, notation = "(¬Cr)"
}
, { premise = "If the term retard has not been rendered non-bigoted via altered usage and oppressed people will continue to suffer from the use of the term retard, then it is permissible to neutralise the term retard's negative connotations."
, notation = "(¬BrDrSr)"
}
, { premise = "If it is permissible to neutralise the term retard's negative connotations, then It is generally permissible to use the term retard with an altered non-bigoted meaning."
, notation = "(SrAr)"
}
]
, conclusion = "Therefore, it is generally permissible to use the term retard with an altered non-bigoted meaning."
, conclusionNotation = "(Ar)"
}
]
}

View file

@ -0,0 +1,53 @@
module Debate.Arguments.Nutrition.Malondialdehyde exposing (..)
import Debate.Types exposing (..)
argumentMalondialdehyde : Argument
argumentMalondialdehyde =
{ argumentTitle = "Title"
, propositionTitle = "Proposition"
, propositionSummary = "Summary"
, definitionTable =
[ { definiendum = "C(x)"
, definiens = "prop 1"
}
, { definiendum = "B(x)"
, definiens = "prop 2"
}
, { definiendum = "D(x)"
, definiens = "prop 3"
}
, { definiendum = "S(x)"
, definiens = "prop 4"
}
, { definiendum = "A(x)"
, definiens = "prop 5"
}
, { definiendum = "r"
, definiens = "variable 1"
}
]
, argumentFormalization =
[ { premises =
[ { premise = "premise 1"
, notation = "(x(CxBx))"
}
, { premise = "premise 2"
, notation = "(x(¬CxDx))"
}
, { premise = "premise 3"
, notation = "(¬Cr)"
}
, { premise = "premise 4"
, notation = "(¬BrDrSr)"
}
, { premise = "premise 5"
, notation = "(SrAr)"
}
]
, conclusion = "conclusion"
, conclusionNotation = "(Ar)"
}
]
}

133
frontend/src/Debate/Helpers.elm Executable file
View file

@ -0,0 +1,133 @@
module Debate.Helpers exposing (..)
import Config.Colour as T exposing (..)
import Config.Format as O exposing (..)
import Debate.Types exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Border as D exposing (..)
import Element.Font as F
import Html
import Html.Attributes as H exposing (style, title, wrap)
import Layouts
import Page exposing (Page)
import Route exposing (Route)
import Shared
import View exposing (View)
argumentMaker : Argument -> Element msg
argumentMaker makeRowInput =
let
argRows : List (Element msg)
argRows =
let
argumentFormatting =
[ centerX, F.center, spacing 3 ]
in
List.indexedMap
(\index argumentEntry ->
column (paragraphFormat ++ [ spacing 3, paddingEach { top = 30, right = 0, bottom = 0, left = 0 } ])
(List.indexedMap
(\premiseIndex premiseWithNotation ->
column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ") ")
, text premiseWithNotation.premise
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text premiseWithNotation.notation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
)
argumentEntry.premises
++ [ column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("C" ++ String.fromInt (index + 1) ++ ") ")
, text argumentEntry.conclusion
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text argumentEntry.conclusionNotation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
]
)
)
makeRowInput.argumentFormalization
in
column
[ paragraphWidth, alignLeft, spacing 8, paddingEach { top = 0, right = 0, bottom = 60, left = 0 } ]
[ paragraph (paragraphBoldFormat ++ [ F.size 20 ])
[ text makeRowInput.argumentTitle |> el [ F.color colourTheme.nonHighlightedText, F.bold ]
]
, paragraph (paragraphBoldFormat ++ [ F.size 18 ])
[ text "Proposition: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph (paragraphBoldFormat ++ [ F.size 18 ])
[ text "Summary: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, wrappedRow (paragraphBoldFormat ++ [ alignLeft ])
[ Element.table
[ spacing 0
, D.rounded 10
, D.width 1
, D.color colourTheme.nonHighlightedDarkText
, clip
]
{ data = makeRowInput.definitionTable
, columns =
[ { header =
el
[ F.bold
, D.widthEach { bottom = 1, top = 1, left = 1, right = 1 }
, D.color colourTheme.nonHighlightedDarkText
, padding 8
]
(text "Definiendum" |> el [ F.color colourTheme.highlightText ])
, width = fill |> maximum 50
, view =
\definition ->
row
[ F.color colourTheme.highlightText
, F.bold
, D.widthEach { bottom = 1, top = 0, left = 1, right = 1 }
, D.color colourTheme.nonHighlightedDarkText
, padding 8
, Element.height fill
]
[ text definition.definiendum
, row [ alignRight ] [ text ":=" ]
]
}
, { header =
el
[ F.bold
, D.widthEach { bottom = 1, top = 1, left = 0, right = 1 }
, D.color colourTheme.nonHighlightedDarkText
, padding 8
]
(text "Definiens" |> el [ F.color colourTheme.highlightText ])
, width = fill
, view =
\definition ->
paragraph
[ F.color colourTheme.nonHighlightedText
, F.regular
, D.widthEach { bottom = 1, top = 0, left = 0, right = 1 }
, D.color colourTheme.nonHighlightedDarkText
, padding 8
, Element.height fill
]
[ text definition.definiens ]
}
]
}
]
, column [ centerX ] argRows
]

35
frontend/src/Debate/Types.elm Executable file
View file

@ -0,0 +1,35 @@
module Debate.Types exposing (..)
type alias ArgumentCategory =
{ categoryName : String
, arguments : List Argument
}
type alias Argument =
{ argumentTitle : String
, propositionTitle : String
, propositionSummary : String
, definitionTable : List Definition
, argumentFormalization : List ArgumentEntry
}
type alias ArgumentEntry =
{ premises : List PremiseWithNotation
, conclusion : String
, conclusionNotation : String
}
type alias PremiseWithNotation =
{ premise : String
, notation : String
}
type alias Definition =
{ definiendum : String
, definiens : String
}

View file

@ -3,6 +3,10 @@ module Pages.Debate exposing (Model, Msg, page)
import Config.Colour as T exposing (..)
import Config.Format as O exposing (..)
import Config.Identity as I exposing (..)
import Debate.Arguments.Ancestry.AncestralDiets exposing (..)
import Debate.Arguments.Ethics.EthicalSlurs exposing (..)
import Debate.Arguments.Nutrition.Malondialdehyde exposing (..)
import Debate.Helpers exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Border as D exposing (..)
@ -94,237 +98,19 @@ debateList : Element msg
debateList =
column
pageList
argumentList
type alias MakeRowInput =
{ argumentTitle : String
, propositionTitle : String
, propositionSummary : String
, definitionTable : List Definition
, argumentFormalization : List ArgumentEntry
}
type alias PremiseWithNotation =
{ premise : String
, notation : String
}
type alias ArgumentEntry =
{ premises : List PremiseWithNotation
, conclusion : String
, conclusionNotation : String
}
type alias Definition =
{ definiendum : String
, definiens : String
}
type alias Category =
{ categoryName : String
, propositions : List MakeRowInput
}
makeRow : MakeRowInput -> Element msg
makeRow makeRowInput =
let
argRows : List (Element msg)
argRows =
let
argumentFormatting =
[ centerX, F.center, spacing 3 ]
in
List.indexedMap
(\index argumentEntry ->
column (paragraphFormat ++ [ spacing 3, paddingEach { top = 30, right = 0, bottom = 0, left = 0 } ])
(List.indexedMap
(\premiseIndex premiseWithNotation ->
column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ") ")
, text premiseWithNotation.premise
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text premiseWithNotation.notation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
)
argumentEntry.premises
++ [ column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("C" ++ String.fromInt (index + 1) ++ ") ")
, text argumentEntry.conclusion
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text argumentEntry.conclusionNotation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
]
)
)
makeRowInput.argumentFormalization
in
column
[ paragraphWidth, alignLeft, spacing 8 ]
[ paragraph paragraphBoldFormat
[ text makeRowInput.argumentTitle |> el [ F.color colourTheme.nonHighlightedText, F.bold ]
]
, paragraph paragraphBoldFormat
[ text "Proposition: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph paragraphBoldFormat
[ text "Summary: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, wrappedRow (paragraphBoldFormat ++ [ alignLeft ])
[ Element.table [ spacing 8 ]
{ data = makeRowInput.definitionTable
, columns =
[ { header = el [ F.bold ] (text "Definiendum" |> el [ F.color colourTheme.highlightText ])
, width = fill |> maximum 50
, view =
\definition ->
text definition.definiendum
|> el [ F.color colourTheme.highlightText, F.bold ]
}
, { header = el [ F.bold ] (text "Definiens" |> el [ F.color colourTheme.highlightText ])
, width = fill
, view =
\definition ->
paragraph [ F.color colourTheme.nonHighlightedText, F.regular ]
[ text definition.definiens ]
}
<|
List.map
(\category ->
column [ spacing 20 ]
[ el (nonHighlightedTitleFormat ++ [ centerX ]) (text category.categoryName)
, column [] (List.map argumentMaker category.arguments)
]
}
)
[ { categoryName = "Ethics"
, arguments =
[ argumentAncestralDiets
, argumentEthicalSlurs
, argumentMalondialdehyde
]
}
]
, column [ centerX ] argRows
]
argumentList : List (Element msg)
argumentList =
List.map
(\category ->
column [ spacing 20 ]
[ el (nonHighlightedTitleFormat ++ [ centerX ]) (text category.categoryName)
, column [] (List.map makeRow category.propositions)
]
)
[ { categoryName = "Dietary Patterns"
, propositions =
[ { argumentTitle = "Argument for Using the Term Retard"
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = "C(x)"
, definiens = "(x) slur's negative connotations have been neutralised"
}
, { definiendum = "B(x)"
, definiens = "(x) slur has been rendered non-bigoted via altered usage"
}
, { definiendum = "D(x)"
, definiens = "oppressed people will continue to suffer from the use of (x) slur"
}
, { definiendum = "S(x)"
, definiens = "it is permissible to neutralise the term retard's negative connotations"
}
, { definiendum = "A(x)"
, definiens = "it is generally permissible to use the term retard with an altered non-bigoted meaning"
}
, { definiendum = "r"
, definiens = "retard"
}
]
, argumentFormalization =
[ { premises =
[ { premise = "For all slurs, (x) slur's negative connotations have been neutralised if and only if, (x) slur has been rendered non-bigoted via altered usage."
, notation = "(x(CxBx))"
}
, { premise = "For all slurs, if it is not the case that (x) slur's negative connotations have been neutralised, then oppressed people will continue to suffer from the use of (x) slur."
, notation = "(x(¬CxDx))"
}
, { premise = "It is not the case that the term retard's negative connotations have been neutralised."
, notation = "(¬Cr)"
}
, { premise = "If the term retard has not been rendered non-bigoted via altered usage and oppressed people will continue to suffer from the use of the term retard, then it is permissible to neutralise the term retard's negative connotations."
, notation = "(¬BrDrSr)"
}
, { premise = "If it is permissible to neutralise the term retard's negative connotations, then It is generally permissible to use the term retard with an altered non-bigoted meaning."
, notation = "(SrAr)"
}
]
, conclusion = "Therefore, it is generally permissible to use the term retard with an altered non-bigoted meaning."
, conclusionNotation = "(Ar)"
}
]
}
, { argumentTitle = ""
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = ""
, definiens = ""
}
, { definiendum = ""
, definiens = ""
}
]
, argumentFormalization =
[ { premises =
[ { premise = ""
, notation = ""
}
, { premise = ""
, notation = ""
}
, { premise = "."
, notation = ""
}
]
, conclusion = ""
, conclusionNotation = ""
}
]
}
, { argumentTitle = ""
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = ""
, definiens = ""
}
, { definiendum = ""
, definiens = ""
}
]
, argumentFormalization =
[ { premises =
[ { premise = ""
, notation = ""
}
, { premise = ""
, notation = ""
}
, { premise = "."
, notation = ""
}
]
, conclusion = ""
, conclusionNotation = ""
}
]
}
]
}
]