summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_run/mc01.hs
blob: cf5ca1a0e98ea1c6074d058ea81cf2b8167406ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Transformation and grouping stress test

{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}

module Main where

import GHC.Exts(sortWith, the)

employees = [ ("Simon", "MS", 80)
            , ("Erik", "MS", 100)
            , ("Phil", "Ed", 40)
            , ("Gordon", "Ed", 45)
            , ("Paul", "Yale", 60) ]

main = putStrLn (show can_still_use_group_function) >> putStrLn (show output)
  where
    output = [ (the dept, map sum salary, (show x) ++ " and " ++ (show y)) 
             | (name, dept, salary) <- employees
             , then group by dept
             , x <- [1, 2, 3]
             , y <- [4, 5, 6]
             , then sortWith by sum salary
             , then take 4
             , then group using replicate 2 ]
    group = const "my group function called!"
    can_still_use_group_function = group "Mississippi"