Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Sentence constructors #700

Closed
elwazana opened this issue Jun 22, 2018 · 36 comments
Closed

Removing Sentence constructors #700

elwazana opened this issue Jun 22, 2018 · 36 comments
Assignees

Comments

@elwazana
Copy link
Collaborator

@szymczdm @JacquesCarette Hello Dr. Carette and Dan, @samm82 and I were looking through notes folder for stuff we could possibly work on and we were wondering what you meant by:

- Spec: a lot of the Sentence constructors should be deleted...

Do you mean these?

-- | Helper function for wrapping sentences in parentheses.
sParen :: Sentence -> Sentence
sParen x = S "(" :+: x :+: S ")"
sParenNum :: Int -> Sentence
sParenNum y = sParen (S (show y))
-- | Helper function for wrapping sentences in square brackets.
sSqBr :: Sentence -> Sentence
sSqBr x = Sp SqBrOpen :+: x :+: Sp SqBrClose
sSqBrNum :: Int -> Sentence
sSqBrNum y = sSqBr (S (show y))
-- | Helper for concatenating two sentences with a space between them.
(+:+) :: Sentence -> Sentence -> Sentence
EmptyS +:+ b = b
a +:+ EmptyS = a
a +:+ b = a :+: S " " :+: b
-- | Helper for concatenating two sentences with a comma and space between them.
sC :: Sentence -> Sentence -> Sentence
a `sC` b = a :+: S "," +:+ b
-- | Helper which concatenates two sentences using '+:+' then adds a period to
-- the end.
(+:+.) :: Sentence -> Sentence -> Sentence
a +:+. b = a +:+ b :+: S "."
-- | Helper which concatenates two sentences using ':+:' then adds a period to
-- the end.
(+.) :: Sentence -> Sentence -> Sentence
a +. b = a :+: b :+: S "."
-- | Helper which concatenates two sentences using '+:+' then adds a colon to
-- the end.
(+:) :: Sentence -> Sentence -> Sentence
a +: b = a +:+ b :+: S ":"
-- | Helper for concatenating two sentences with a semi-colon and space between them.
semiCol :: Sentence -> Sentence -> Sentence
a `semiCol` b = a :+: S ";" +:+ b
sParenDash :: Sentence -> Sentence
sParenDash = \x -> S " (" :+: x :+: S ") - "
sDash :: Sentence -> Sentence -> Sentence
y `sDash` z = y +:+ S "-" +:+ z

@JacquesCarette
Copy link
Owner

I meant both those (which are almost always used as hacks, especially sParenNum and sSqBr). I also think that some of the cases of Spec perhaps shouldn't be there. But that requires more analysis & thinking. I have already removed the ones that were easy to remove.

@samm82
Copy link
Collaborator

samm82 commented Jun 22, 2018

sParenNum

Used here for a list:

a1Desc :: Sentence
a1Desc = foldlSent [S "The standard E1300-09a for",
phrase calculation, S "applies only to", foldlOptions $ map S ["monolithic",
"laminated", "insulating"], S "glass constructions" `sOf` S "rectangular",
phrase shape, S "with continuous", phrase lateral +:+. S "support along",
foldlOptions $ map S ["one", "two", "three", "four"], plural edge, S "This",
phrase practice, S "assumes that", sParenNum 1, S "the supported glass",
plural edge, S "for two, three" `sAnd` S "four-sided support",
plural condition, S "are simply supported" `sAnd` S "free to slip in",
phrase plane `semiCol` (sParenNum 2), S "glass supported on two sides acts",
S "as a simply supported", phrase beam `sAnd` (sParenNum 3), S "glass",
S "supported on one side acts as a", phrase cantilever]

sSqBrNum

Used here for a reference:

s2_4_intro :: Sentence
s2_4_intro = foldlSent
[S "The", (phrase organization), S "of this", (phrase document),
S "follows the", phrase template, S "for an", (getAcc srs), S "for",
(phrase sciCompS), S "proposed by", (sSqBrNum 1) `sAnd` (sSqBrNum 2)]

s6_1_1 = termDefnF (Just (S "All" `sOf` S "the" +:+ plural term_ +:+
S "are extracted from" +:+ (sSqBrNum 4 {-astm_LR2009-}) `sIn`
(makeRef (SRS.reference SRS.missingP [])))) [s6_1_1_bullets]

s2_4_intro :: Sentence
s2_4_intro = foldlSent [S "The", phrase organization, S "of this",
phrase document, S "follows the template for an", short srs,
S "for", phrase sciCompS, S "proposed by", (sSqBrNum 3) `sAnd`
(sSqBrNum 6), sParen (makeRef (SRS.reference SRS.missingP []))]

I'm not really sure how these usages are hacks.

@JacquesCarette
Copy link
Owner

  1. There should be 'semantic' combinators for building lists. These could then have styles applied to them, that would control how they get rendered. Right now this is hard-coded in the example.
  2. All of these should be using references, via labels. The square brackets should be, again, styles applied to the display of references.

@samm82
Copy link
Collaborator

samm82 commented Jun 22, 2018

  1. So should we define a new function for building a list and could we use sParenNum to achieve that?
  2. @elwazana says that the change for sSqBrNum will be made once Label is fully implemented. Is that what you are referring to?

@JacquesCarette
Copy link
Owner

  1. Yes and yes. [sParenNum used internally in printing is fine. But it should not be exported]
  2. Yes.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82 samm82 removed the question label Jun 27, 2018
@samm82 samm82 changed the title Removing Sentence constructors? Removing Sentence constructors Jun 27, 2018
@samm82
Copy link
Collaborator

samm82 commented Jun 27, 2018

As far as sSqBrNum, it just seems like the manifestation of smiths/caseStudies#31, which can easily be fixed. @smiths @JacquesCarette

@smiths
Copy link
Collaborator

smiths commented Jun 27, 2018

@samm82 I agree. There might be other cases where we want square brackets around a sentence, but when that sentence is citation information, the format of the citation should be automatic. We definitely should remove all hard-coded citation numbers in the Drasil code. These aren't maintainable.

@JacquesCarette

This comment has been minimized.

@samm82

This comment has been minimized.

@smiths

This comment has been minimized.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82 samm82 mentioned this issue Jun 28, 2018
@samm82

This comment has been minimized.

@szymczdm

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82
Copy link
Collaborator

samm82 commented Jul 26, 2018

So to reiterate the original issue, sParenNum has been removed (thanks to the new list function(s)), and sSqBrNum will/should probably be removed after Label is implemented. Are there any other functions that can be (relatively easily) removed, or should we leave it to focus on more crucial work by marking it with the "waiting on label" label to revisit later?

@samm82

This comment has been minimized.

@JacquesCarette

This comment has been minimized.

@samm82
Copy link
Collaborator

samm82 commented May 1, 2019

It seems as if Spec.hs has been deleted and the only helper function of this sort is sParen (in Sentence.hs), so I'm closing this issue.

@samm82 samm82 closed this as completed May 1, 2019
@smiths
Copy link
Collaborator

smiths commented May 1, 2019

Nice to see you jumping right back in @samm82! I can tell that @JacquesCarette and I better get thinking of additional tasks to keep you busy. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants