Skip to content

Commit

Permalink
Remove predicate functions from Expression
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Aug 7, 2024
1 parent 0f43132 commit b9e532a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 63 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
- Renamed `OperatorApplication` to `Operation`
- Removed the `InfixDirection` field
- `OperatorApplication String InfixDirection (Node Expression) (Node Expression)` -> `Operation String (Node Expression) (Node Expression)`
- Renamed `isOperatorApplication` to `isOperation`
- Renamed `RecordExpr` to `Record`
- Renamed `CaseExpression` to `Case`
- Renamed `LetExpression` to `Let`
Expand All @@ -51,6 +50,7 @@
- Removed `Elm.Syntax.Expression.Cases` type alias (it was `type alias Cases = List Case`)
- `Elm.Syntax.Expression.CaseBlock`'s `cases : List Case` field is split into `firstCase : Case` and `restOfCases : List Case` (takes a non-empty list of cases)
- Removed `Operator` (it was not possible to get)
- Renamed predicate functions `isLambda`, `isLet`, `isIfElse`, `isCase`, `isOperatorApplication`

- Changed `Elm.Syntax.Pattern.Pattern`:
- Removed `FloatPattern` (it was not possible to get)
Expand Down
64 changes: 2 additions & 62 deletions src/Elm/Syntax/Expression.elm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Elm.Syntax.Expression exposing
( Expression(..), Lambda, LetBlock, LetDeclaration(..), RecordSetter, CaseBlock, Case, Function, FunctionImplementation
, functionRange, isLambda, isLet, isIfElse, isCase, isOperation
, functionRange
)

{-| This syntax represents all that you can express in Elm.
Expand All @@ -14,7 +14,7 @@ Although it is a easy and simple language, you can express a lot! See the `Expre
## Functions
@docs functionRange, isLambda, isLet, isIfElse, isCase, isOperation
@docs functionRange
-}

Expand Down Expand Up @@ -166,63 +166,3 @@ type alias CaseBlock =
-}
type alias Case =
( Node Pattern, Node Expression )


{-| Check whether an expression is a lambda-expression
-}
isLambda : Expression -> Bool
isLambda e =
case e of
LambdaExpression _ ->
True

_ ->
False


{-| Check whether an expression is a let-expression
-}
isLet : Expression -> Bool
isLet e =
case e of
Let _ ->
True

_ ->
False


{-| Check whether an expression is an if-else-expression
-}
isIfElse : Expression -> Bool
isIfElse e =
case e of
If _ _ _ ->
True

_ ->
False


{-| Check whether an expression is a case-expression
-}
isCase : Expression -> Bool
isCase e =
case e of
Case _ ->
True

_ ->
False


{-| Check whether an expression is an operator application expression
-}
isOperation : Expression -> Bool
isOperation e =
case e of
Operation _ _ _ ->
True

_ ->
False

0 comments on commit b9e532a

Please sign in to comment.