Commit b47dfeab authored by Kirchmayr's avatar Kirchmayr
Browse files

Fixed position handling for Rhs in Transformations.Desugar

parent a835181c
......@@ -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
-- -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment