Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- module.hs
- module MyModule where
- once :: (a -> a) -> (a -> a)
- once = \x -> x
- twice :: (a -> a) -> (a -> a)
- twice f x = f (f x)
- thrice :: (a -> a) -> (a -> a)
- thrice f x = f (f (f x))
- four_times :: (a -> a) -> (a -> a)
- four_times f = twice (twice f)
- -- ch4.hs
- module Chapter4 where
- import MyModule
- minus2 :: Num a => a -> a
- minus2 x = x-2
- minus6 = thrice minus2
- plus3 :: Num a => a -> a
- plus3 = (+3)
- same :: Num a => a -> a
- same = minus6.plus3.plus3
Advertisement