Created
July 29, 2018 15:56
-
-
Save stelleg/241f0671a1d7cb413c07f0d9ec9a32bb to your computer and use it in GitHub Desktop.
alpha-equivalence example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foreign.Ptr | |
import Foreign.Storable | |
import Foreign.Marshal.Array | |
{-@ type PtrLen a n = {v:Ptr a | plen v = n && 0 <= pbase v && 0 <= plen v} @-} | |
{-@ withArray :: Storable a => x:[a] -> (PtrLen a (len x) -> IO b) -> IO b @-} | |
{-@ withConstArray :: Storable a => a -> n:Nat -> (PtrLen a n -> IO b) -> IO b @-} | |
withConstArray x n = withArray (replicate n x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment