module Cont (funkyId, funkyIds) where ------------------------------------------------------------------------------------------ {-@ funkyId :: x:Int -> {v:Int | v = x} @-} funkyId :: Int -> Int funkyId n = cont (\_ -> n) {-@ cont :: forall
Prop>. (() -> Int
) -> Int
@-} cont :: (() -> Int) -> Int cont f = f () ------------------------------------------------------------------------------------------ {-@ funkyIds :: a -> n:Int -> {v:[a] | (len v) = n} @-} funkyIds :: a -> Int -> [a] funkyIds y n = conts y (\_ -> n) {-@ conts :: forall
Prop>. a -> (() -> Int
) -> exists z:Int
. {v:[a] | z = (len v)} @-} {-@ conts :: forall
Prop>. a -> (() -> Int
) -> {v:[a] | (p (len v))} @-} conts :: a -> (() -> Int) -> [a] conts x f = clone (f ()) x {-@ clone :: n:Int -> a -> {v:[a] | (len v) = n} @-} clone :: Int -> a -> [a] clone = undefined