Skip to content

Commit

Permalink
fix: haskell fixture file indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronik committed Feb 1, 2025
1 parent da50eac commit b50bff8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/fixtures/haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ randomList = do
-- Define a function to calculate the median of a list of numbers
median :: [Double] -> Double
median xs = median' (sort xs)
where
median' [] = error "Empty list"
median' [_] = error "List contains single element"
median' xs
| odd len = fromIntegral $ xs !! (len `div` 2)
| otherwise = mean
where
len = length xs
mean = (sum xs) / fromIntegral len
where
median' [] = error "Empty list"
median' [_] = error "List contains single element"
median' xs
| odd len = fromIntegral $ xs !! (len `div` 2)
| otherwise = mean
where
len = length xs
mean = (sum xs) / fromIntegral len

-- Main function to run the program
main :: IO ()
main = do
printEvens [1, 3, 5, 7, 9]
print $ sumNumbers [-2, -4, 0, 10]
randomList >>= mapM_ putStrLn . map show
let xs = [-3.0, -1.0, 0.0, 1.0, 3.0]
ys = [5.5, 6.6]
print $ median xs
print $ sumNumbers ys
printEvens [1, 3, 5, 7, 9]
print $ sumNumbers [-2, -4, 0, 10]
randomList >>= mapM_ putStrLn . map show
let xs = [-3.0, -1.0, 0.0, 1.0, 3.0]
ys = [5.5, 6.6]
print $ median xs
print $ sumNumbers ys

0 comments on commit b50bff8

Please sign in to comment.