Skip to content

Commit

Permalink
equals of record ast +
Browse files Browse the repository at this point in the history
  • Loading branch information
lue-bird committed Nov 14, 2023
1 parent 847712b commit c693666
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
6 changes: 4 additions & 2 deletions feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title>lue blog</title>
<description>lue&apos;s thoughts</description>
<link>https://lue-bird.github.io/blog/</link>
<lastBuildDate>Mon, 23 Oct 2023 13:25:05 +0000</lastBuildDate>
<lastBuildDate>Tue, 14 Nov 2023 00:29:57 +0000</lastBuildDate>
<generator>dillonkearns/elm-rss</generator>
<item>
<title>Your AST allows lists with different element types. Why?</title>
Expand Down Expand Up @@ -279,7 +279,9 @@ type EqualsExpression
= EqualsOfInt (EqualsOf Int)
| EqualsOfExpression (EqualsOf EqualsExpression)
| EqualsOfTuple { firsts : EqualsExpression, seconds : EqualsExpression }
| EqualsOfTriple { firsts : EqualsExpression, seconds : EqualsExpression, thirds : EqualsExpression }&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Wtf?&lt;/p&gt;&lt;/div&gt;&lt;/section&gt;]]&gt;</content:encoded>
| EqualsOfTriple { firsts : EqualsExpression, seconds : EqualsExpression, thirds : EqualsExpression }
-- even records!
| EqualsOfRecord (Dict String EqualsExpression)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Wtf?&lt;/p&gt;&lt;/div&gt;&lt;/section&gt;]]&gt;</content:encoded>
</item>
<item>
<title>Wrapping wrappers safely: typed-value 8.0.0</title>
Expand Down
35 changes: 34 additions & 1 deletion src/Articles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,36 @@ whatToDoWithElmReviewErrorsArticle =
Sequence
[ textOnlyParagraph """Ever wanted to add helpers but introducing them at once would start a chain reaction of refactors?
Especially when the new helper will make existing helpers irrelevant, it can feel simplest to just get the big refactor done with."""
, textOnlyParagraph """If you feel like this (just like past and sometimes current lue), here's an alternative to try:"""
, elmCode """
isNotFunction : Expression -> Bool
isNotFunction expression =
case expression of
Expression.Variable ( "Basics", "not" ) ->
True
_ ->
False
isNegateFunction : Expression -> Bool
isNegateFunction expression =
case expression of
Expression.Variable ( "Basics", "negate" ) ->
True
_ ->
False
"""
, Paragraph [ Text "and you want to add" ]
, elmCode """
isSpecificVariable specificFullyQualifiedVariableName =
case expression of
Expression.Variable fullyQualifiedVariableName ->
fullyQualifiedVariableName == specificFullyQualifiedVariableName
_ ->
False
"""
, Paragraph [ Text "If you feel like this (just like past and sometimes current lue), here's an alternative to try:" ]
, Paragraph
[ Text "Do a small, local, immediate step. "
, Italic "Commit"
Expand Down Expand Up @@ -161,6 +190,8 @@ You know, the stuff that allows you to keep less things in your mind that "you s
, textOnlyParagraph """If you think there won't be an automated error for something on the way, make it a new item in a todo list.
Aggregating errors isn't scary. They have your back."""
, textOnlyParagraph """TODO: Show step-by-step refactor of adding helper, adding @deprecated, fixing the issues one by one"""
, textOnlyParagraph """If possible I'd like if elm-review doesn't slow this exploration phase...
→ Also, elm-review rules don't really "slow down development" because they just hint at and remind you of what's left to do eventually without forcing you to do anything. (e.g. you added this helper? Do your thing but I always have your back so you don't forget that you wanted to use this helper somewhere) TODO integrate"""
]
}

Expand Down Expand Up @@ -578,6 +609,8 @@ type EqualsExpression
| EqualsOfExpression (EqualsOf EqualsExpression)
| EqualsOfTuple { firsts : EqualsExpression, seconds : EqualsExpression }
| EqualsOfTriple { firsts : EqualsExpression, seconds : EqualsExpression, thirds : EqualsExpression }
-- even records!
| EqualsOfRecord (Dict String EqualsExpression)
"""
, textOnlyParagraph """Wtf?"""
]
Expand Down

0 comments on commit c693666

Please sign in to comment.