Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-frontend
Commits
b47dfeab
Commit
b47dfeab
authored
Apr 14, 2016
by
Kirchmayr
Browse files
Fixed position handling for Rhs in Transformations.Desugar
parent
a835181c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Transformations/Desugar.hs
View file @
b47dfeab
...
...
@@ -321,7 +321,11 @@ constrain cs e = if null cs then e else foldr1 (&) cs &> e
-- 'Success' if it is not restricted by the guard expression.
dsRhs
::
Position
->
(
Expression
->
Expression
)
->
Rhs
->
DsM
Rhs
dsRhs
p
f
rhs
=
expandRhs
prelFailed
f
rhs
>>=
dsExpr
p
>>=
return
.
simpleRhs
p
dsRhs
p
f
rhs
=
expandRhs
prelFailed
f
rhs
>>=
dsExpr
pRhs
>>=
return
.
simpleRhs
pRhs
where
pRhs
=
fromMaybe
p
(
getRhsPosition
rhs
)
expandRhs
::
Expression
->
(
Expression
->
Expression
)
->
Rhs
->
DsM
Expression
expandRhs
_
f
(
SimpleRhs
_
e
ds
)
=
return
$
Let
ds
(
f
e
)
...
...
@@ -346,6 +350,10 @@ addDecls :: [Decl] -> Rhs -> Rhs
addDecls
ds
(
SimpleRhs
p
e
ds'
)
=
SimpleRhs
p
e
(
ds
++
ds'
)
addDecls
ds
(
GuardedRhs
es
ds'
)
=
GuardedRhs
es
(
ds
++
ds'
)
getRhsPosition
::
Rhs
->
Maybe
Position
getRhsPosition
(
SimpleRhs
p
_
_
)
=
Just
p
getRhsPosition
(
GuardedRhs
_
_
)
=
Nothing
-- -----------------------------------------------------------------------------
-- Desugaring of non-linear patterns
-- -----------------------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
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