Mercurial > hg > Papers > 2015 > atton-thesis
view src/delta_example.hs @ 41:8fc2ac1f901f
Add delta definition in agda
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 13 Feb 2015 11:48:40 +0900 |
parents | 324111203070 |
children |
line wrap: on
line source
module Example.Delta where import Data.Numbers.Primes import Delta generator :: Int -> Delta [Int] generator x = let intList = [1..x] in return intList numberFilter :: [Int] -> Delta [Int] numberFilter xs = let primeList = filter isPrime xs evenList = filter even xs in Delta evenList (Mono primeList) count :: [Int] -> Delta Int count xs = let primeCount = length xs in return primeCount numberCount :: Int -> Delta Int numberCount x = generator x >>= numberFilter >>= count