Commit 30724a09 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Modify tests, mostly adding -XTranformListComp

parent f0f582ec
-- Transformation stress test
{-# OPTIONS_GHC -XTransformListComp #-}
module Main where
import Data.List(takeWhile)
import GHC.Exts(sortWith)
employees = [ ("Simon", "MS", 80)
, ("Erik", "MS", 100)
, ("Phil", "Ed", 40)
, ("Gordon", "Ed", 45)
, ("Paul", "Yale", 60)]
main = putStrLn (show output)
where
output = [ (dept, salary)
| then sortWith by 1
, (name, dept, salary) <- employees
, then sortWith by salary
, then filter by salary > 50
-- Transformation stress test
{-# OPTIONS_GHC -XTransformListComp #-}
module Main where
import Data.List(takeWhile)
import GHC.Exts(sortWith)
employees = [ ("Simon", "MS", 80)
, ("Erik", "MS", 100)
, ("Phil", "Ed", 40)
, ("Gordon", "Ed", 45)
, ("Paul", "Yale", 60)]
main = putStrLn (show output)
where
output = [ (dept, salary)
| then sortWith by 1
, (name, dept, salary) <- employees
, then sortWith by salary
, then filter by salary > 50
, then take 1 ]
\ No newline at end of file
-- Transformation and grouping stress test
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......
-- Transformation stress test
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......@@ -17,7 +17,7 @@ main = putStrLn (show output)
where
output = [ (dept, salary)
| then sortWith by 1
, (name, dept, salary) <- employees
, (name, dept, salary) <- employees
, then sortWith by salary
, then filter by salary > 50
, then take 1 ]
-- "Big tuple" stress test for monad comprehensions
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp -XParallelListComp #-}
module Main where
......
-- Test transform WITHOUT a by clause
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......
-- Test grouping with both a using and a by clause
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......
-- Tests transform WITH a by clause
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......
-- Tests grouping WITH a by clause but WITHOUT a using clause
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
......
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MonadComprehensions ParallelListComp #-}
module Foo where
......
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Foo where
......
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MonadComprehensions, TransformListComp #-}
-- Test performed for TransformListComp and should work for monad comp aswell:
-- GHC 7.0.1 failed because the renamer didn't attach
......
{-# OPTIONS_GHC -fwarn-unused-matches #-}
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MonadComprehensions, ParallelListComp #-}
-- Test for parallel list comp should work for monad comp aswell:
--
-- GHC 6.4 erroneously reported that the
......
{-# LANGUAGE RecordWildCards, MonadComprehensions, NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards, MonadComprehensions, TransformListComp, NamedFieldPuns #-}
module T3901 where
......
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE MonadComprehensions #-}
-- Test for parallel list comp, which should work for monad comp aswell:
{-# LANGUAGE MonadComprehensions, ParallelListComp #-}
-- Test for parallel list comp, which should work for monad comp as well:
--
-- On GHC 6.0 and earlier, this parallel list comprehension generated
-- an incorrect unused-binding warning.
......
{-# OPTIONS -fwarn-unused-binds #-}
module ShouldCompile where
-- !!! should produce warnings about unused identifers
x :: [()]
x = [ () | y <- [] ]
z = do w <- getContents; return ()
{-# OPTIONS -fwarn-unused-binds #-}
module ShouldCompile where
-- !!! should produce warnings about unused identifers
x :: [()]
x = [ () | y <- [] ]
z = do w <- getContents; return ()
......@@ -2,7 +2,7 @@
--
-- Test trying to use a function bound in the list comprehension as the transform function
{-# OPTIONS_GHC -XRank2Types -XMonadComprehensions #-}
{-# OPTIONS_GHC -XRank2Types -XMonadComprehensions -XTransformListComp #-}
module RnFail048 where
......
......@@ -2,7 +2,7 @@
--
-- Test trying to use a function bound in the list comprehension as the group function
{-# OPTIONS_GHC -XRank2Types -XMonadComprehensions #-}
{-# OPTIONS_GHC -XRank2Types -XMonadComprehensions -XTransformListComp #-}
module RnFail049 where
......
-- Checks that the types of the old binder and the binder implicitly introduced by grouping are linked
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module ShouldCompile where
......
-- Checks that the correct type is used checking the using clause of the transform
{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE MonadComprehensions, TransformListComp #-}
module ShouldFail where
......
-- Checks that the ordering constraint on the implicit groupWith is respected
{-# OPTIONS_GHC -XMonadComprehensions #-}
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module ShouldFail where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment