mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-11 06:41:04 +03:00
00514887c4
This has shown up a problem with 'case' which is hard to fix - since it works by generating a function with the appropriate type, it's hard to ensure that let bindings computational behaviour is propagated while maintaining appropriate dependencies between arguments and keeping the let so that it only evaluates once. So, I've disabled the computational behaviour of 'let' inside case blocks. I hope this isn't a big inconvenience (there are workarounds if it's ever needed, anyway).
29 lines
619 B
Idris
29 lines
619 B
Idris
import Stuff
|
|
|
|
data IsSuc : Nat -> Type where
|
|
Yes : IsSuc (S x)
|
|
|
|
pred : (x : Nat) -> IsSuc x -> Nat
|
|
pred (S x) Yes = x
|
|
|
|
test1 : Nat -> Nat
|
|
test1 x = let y = S (S x) in
|
|
case x of
|
|
res => pred y ?foo
|
|
|
|
-- Propagating let binding's computational behaviour through case is
|
|
-- not supported, sorry!
|
|
{-
|
|
data Vect : Nat -> Type -> Type where
|
|
Nil : Vect Z a
|
|
(::) : a -> Vect k a -> Vect (S k) a
|
|
|
|
test2 : Nat -> Nat -> Nat
|
|
test2 x@(S Z) y
|
|
= case y of
|
|
res =>
|
|
let fn : Vect (S Z) Nat -> Nat
|
|
fn ys = ?bar
|
|
in pred x Yes
|
|
-}
|