diff options
Diffstat (limited to 'testsuite/tests/deSugar/should_run/mc06.hs')
-rw-r--r-- | testsuite/tests/deSugar/should_run/mc06.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_run/mc06.hs b/testsuite/tests/deSugar/should_run/mc06.hs new file mode 100644 index 0000000000..20fe041283 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/mc06.hs @@ -0,0 +1,18 @@ +-- Test grouping with both a using and a by clause + +{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-} + +module Main where + +import Data.List(groupBy) +import GHC.Exts(the) + +groupRuns :: Eq b => (a -> b) -> [a] -> [[a]] +groupRuns f = groupBy (\x y -> f x == f y) + +main = putStrLn (show output) + where + output = [ (the x, product y) + | x <- ([1, 1, 1, 2, 2, 1, 3]) + , y <- [4..6] + , then group by x using groupRuns ] |