on master help sign in
Merge pull request #1490 from edwinb/master

Make sure Borrowed constructors aren't updated

commit008cdb688ac859e05f27f3398f5f7ad9fe762524 authorEdwin Brady <edwin.brady@gmail.com> dateMon 25 Aug 2014, 00:19 (12 years ago) parent12abf74be7bbd7
2 files changed+8−1
CHANGELOG+1 src/Idris/Core/CaseTree.hs+7−1
CHANGELOG+1
@@ -11,6 +11,7 @@ New in 0.9.15:
1111 solved automatically.
1212* More efficient representation of proof state, leading to faster elaboration
1313 of large expressions.
14+* EXPERIMENTAL Implementation of uniqueness types
1415
1516New in 0.9.14:
1617--------------
src/Idris/Core/CaseTree.hs+7−1
@@ -350,10 +350,16 @@ toPats reflect tc f = reverse (toPat reflect tc (getArgs f)) where
350350toPat :: Bool -> Bool -> [Term] -> [Pat]
351351toPat reflect tc = map $ toPat' []
352352 where
353− toPat' [_,_,arg](P (DCon t a uniq) nm@(UN n) _)
353+ toPat' [_,_,arg] (P (DCon t a uniq) nm@(UN n) _)
354354 | n == txt "Delay"
355355 = PCon uniq nm t [PAny, PAny, toPat' [] arg]
356356
357+ toPat' args (P (DCon t a uniq) nm@(NS (UN n) [own]) _)
358+ | n == txt "Read" && own == txt "Ownership"
359+ = PCon False nm t (map shareCons (map (toPat' []) args))
360+ where shareCons (PCon _ n i ps) = PCon False n i (map shareCons ps)
361+ shareCons p = p
362+
357363 toPat' args (P (DCon t a uniq) n _)
358364 = PCon uniq n t $ map (toPat' []) args
359365