{- * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. -} module Types where -- ---------------------------------------- l1 = [False, True] l2 = ['a', 'b', 'c'] l3 = ["abc", "xyz", "123"] l4 = [] -- ---------------------------------------- p1 = (False, True) p2 = (False, 'a', True) p3 = ("ja", True, 'a') -- ---------------------------------------- c1 = ('a', (False, 'b')) c2 = (['a'],['b']) c3 = [("abc", False)] -- ---------------------------------------- add :: (Int, Int) -> Int add = \ (x,y) -> x + y add' :: Int -> (Int -> Int) add' = \ x -> (\ y -> x + y) add'' :: Int -> Int -> Int add'' x y = x + y zeroto :: Int -> [Int] zeroto = \ n -> [0 .. n] mul3 :: Int -> (Int -> (Int -> Int)) mul3 = \ x -> (\ y -> (\ z -> x * y * z)) mul3' :: Int -> Int -> Int -> Int mul3' x y z = x * y * z mul2 = mul3 2 succ' = add' 1 pred' = add' (-1)