diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2013-12-02 22:56:10 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2013-12-02 22:56:10 +0100 |
commit | 2b722cf3bdd267c999f25c4f1c2ebb4cc4d27cb4 (patch) | |
tree | 95a2fa4d0aac52f4a82e234276ce7ede15a8e8ff /foo.hs | |
parent | 40860a46fa0a22cc376b015e36744c8573f92654 (diff) | |
download | haskell-2b722cf3bdd267c999f25c4f1c2ebb4cc4d27cb4.tar.gz haskell-2b722cf3bdd267c999f25c4f1c2ebb4cc4d27cb4.tar.bz2 haskell-2b722cf3bdd267c999f25c4f1c2ebb4cc4d27cb4.zip |
add other haskell files
Diffstat (limited to 'foo.hs')
-rw-r--r-- | foo.hs | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +foo :: [(Int, Int)] +foo = [(8, 14), (4,2), (3,4)] + +findmin :: (Int, Int) -> (Int, Int) -> (Int, Int) +findmin (a,b) (c,d) + | a < c = (a,b) + | otherwise = (c,d) + +minf :: [(Int, Int)] -> (Int, Int) +minf (x:xs) = foldr findmin x xs + +minf2 :: [(Int, Int)] -> Int +minf2 xs = b + where (a,b) = minf xs + + + +data Bar = Bar Int Int deriving (Eq,Show) + +instance Ord Bar where + (Bar _ s1) `compare` (Bar _ s2) = s1 `compare` s2 |