view src/delta_example.hs @ 42:4cc65012412f

Add proofs of functor-laws on delta
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Fri, 13 Feb 2015 17:13:23 +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