Closed Lysxia closed 7 years ago
This issue is in fact already captured in the PatBindIn2
test case, which is currently marked as pending
module PatBindIn2 where
--A definition can be lifted from a where or let into the surrounding binding group.
--Lifting a definition widens the scope of the definition.
--In this example, lift 'tup' defined in 'foo' will fail.
main :: Int
main = foo 3
foo :: Int -> Int
foo x = h + t + (snd tup)
where
h :: Int
t :: Int
tup :: (Int,Int)
tup@(h,t) = head $ zip [1..x] [3..15]
liftToTopLevel
-inga
results inA simple fix is to refuse to lift such declarations, though it might be interesting to implement something less trivial in the future.