Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-test
Commits
3f2db21c
Verified
Commit
3f2db21c
authored
Jun 30, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved gDiff for Expr
parent
3d4614d6
Pipeline
#12581
failed with stage
in 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletion
+41
-1
cleantest.icl
cleantest.icl
+41
-1
No files found.
cleantest.icl
View file @
3f2db21c
...
...
@@ -29,7 +29,47 @@ import Text.GenJSON
import
Text
.
GenParse
import
Text
.
Language
derive
gDiff
GenConsAssoc
,
Maybe
,
Expr
derive
gDiff
GenConsAssoc
,
Maybe
gDiff
{|
Expr
|}
x
y
=
case
(
x
,
y
)
of
(
ExprInt
a
,
ExprInt
b
)
->
gDiff
{|*|}
a
b
(
ExprChar
a
,
ExprChar
b
)
->
gDiff
{|*|}
a
b
(
ExprBool
a
,
ExprBool
b
)
->
gDiff
{|*|}
a
b
(
ExprReal
a
,
ExprReal
b
)
->
gDiff
{|*|}
a
b
(
ExprString
a
,
ExprString
b
)
->
gDiff
{|*|}
a
b
(
ExprTuple
a
,
ExprTuple
b
)
->
gDiff
{|*|}
a
b
(
ExprList
a
,
ExprList
b
)
->
gDiff
{|*|}
a
b
(
ExprArray
a
,
ExprArray
b
)
->
gDiff
{|*|}
a
b
(
ExprRecord
r1
xs
,
ExprRecord
r2
ys
)
|
r1
==
r2
->
[
{
status
=
parentStatus
field_diffs
,
value
=
fromMaybe
"<unnamed record>"
r1
,
children
=
field_diffs
}]
with
field_diffs
=
[
let
ds
=
gDiff
{|*|}
(
find
k
xs
)
(
find
k
ys
)
in
{
status
=
parentStatus
ds
,
value
=
k
+++
"="
,
children
=
ds
}
\\
k
<-
both
]
++
[{
status
=
OnlyLeft
,
value
=
k
+++
"="
,
children
=[{
status
=
OnlyLeft
,
value
=
toString
(
find
k
xs
),
children
=[]}]}
\\
k
<-
xonly
]
++
[{
status
=
OnlyRight
,
value
=
k
+++
"="
,
children
=[{
status
=
OnlyRight
,
value
=
toString
(
find
k
ys
),
children
=[]}]}
\\
k
<-
yonly
]
xkeys
=
[
k
\\
ExprField
k
_
<-:
xs
]
ykeys
=
[
k
\\
ExprField
k
_
<-:
ys
]
both
=
intersect
xkeys
ykeys
xonly
=
difference
xkeys
ykeys
yonly
=
difference
ykeys
xkeys
find
k
vs
=
case
[
e
\\
ExprField
f
e
<-:
vs
|
f
==
k
]
of
[
e
:_]
->
e
_
->
abort
"gDiff_Expr: internal error
\n
"
parentStatus
::
[
Diff
]
->
DiffStatus
parentStatus
diffs
=
if
(
all
(\
d
->
d
.
status
==
Common
)
field_diffs
)
Common
Changed
_
->
simple
x
y
where
simple
::
Expr
Expr
->
[
Diff
]
simple
left
right
=
[
{
status
=
OnlyLeft
,
value
=
toString
left
,
children
=[]}
,
{
status
=
OnlyRight
,
value
=
toString
right
,
children
=[]}
]
::
*
ProcessOutput
=
{
lines
::
![
String
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment