Commit 6074c108 authored by thomie's avatar thomie

Testsuite: delete Windows line endings [skip ci] (#11631)

parent 754a2f2b
{-# LANGUAGE GADTs, StandaloneDeriving #-}
module T3012 where
data T a where
Foo :: T Int
Bar :: T Bool
deriving instance Show (T a)
{-# LANGUAGE GADTs, StandaloneDeriving #-}
module T3012 where
data T a where
Foo :: T Int
Bar :: T Bool
deriving instance Show (T a)
{-# LANGUAGE StandaloneDeriving #-}
module T6031 where
import T6031a
deriving instance Show Empty
{-# LANGUAGE StandaloneDeriving #-}
module T6031 where
import T6031a
deriving instance Show Empty
module T6031a where
data Empty
module T6031a where
data Empty
{-# OPTIONS_GHC -Wall #-}
{-# Language DeriveFunctor #-}
{-# Language PolyKinds #-}
module T8893 where
data V a = V [a] deriving Functor
data C x a = C (V (P x a)) deriving Functor
data P x a = P (x a) deriving Functor
{-# OPTIONS_GHC -Wall #-}
{-# Language DeriveFunctor #-}
{-# Language PolyKinds #-}
module T8893 where
data V a = V [a] deriving Functor
data C x a = C (V (P x a)) deriving Functor
data P x a = P (x a) deriving Functor
{-# LANGUAGE MagicHash, DeriveDataTypeable #-}
module T2700 where
import GHC.Prim
import Data.Data
import Data.Typeable
data Foo = MkFoo Int#
deriving (Typeable, Data)
{-# LANGUAGE MagicHash, DeriveDataTypeable #-}
module T2700 where
import GHC.Prim
import Data.Data
import Data.Typeable
data Foo = MkFoo Int#
deriving (Typeable, Data)
{-# LANGUAGE RankNTypes, ScopedTypeVariables, StandaloneDeriving, GADTs, GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
module Main where
import Data.Typeable
data Expr a where
Lit :: Typeable a => a -> Expr a
class A a where
mk :: a
class (Typeable a, A a) => B a where
mkExpr :: Expr a
mkExpr = Lit mk
-- dfunAE
instance B a => A (Expr a) where
mk = mkExpr
-- dfunAB
instance A Bool where
mk = True
newtype BOOL = BOOL Bool
deriving (Typeable, A)
instance B Bool
deriving instance B BOOL --dfunBB
showType :: forall a . Expr a -> String
showType (Lit _) = show (typeOf (undefined :: a))
test1 = showType (mk :: Expr BOOL) -- Prints "Bool" (wrong?)
test2 = showType (Lit mk :: Expr BOOL) -- Prints "Main.BOOL" (correct)
main = do { print test1; print test2 }
{-# LANGUAGE RankNTypes, ScopedTypeVariables, StandaloneDeriving, GADTs, GeneralizedNewtypeDeriving, DeriveDataTypeable #-}
module Main where
import Data.Typeable
data Expr a where
Lit :: Typeable a => a -> Expr a
class A a where
mk :: a
class (Typeable a, A a) => B a where
mkExpr :: Expr a
mkExpr = Lit mk
-- dfunAE
instance B a => A (Expr a) where
mk = mkExpr
-- dfunAB
instance A Bool where
mk = True
newtype BOOL = BOOL Bool
deriving (Typeable, A)
instance B Bool
deriving instance B BOOL --dfunBB
showType :: forall a . Expr a -> String
showType (Lit _) = show (typeOf (undefined :: a))
test1 = showType (mk :: Expr BOOL) -- Prints "Bool" (wrong?)
test2 = showType (Lit mk :: Expr BOOL) -- Prints "Main.BOOL" (correct)
main = do { print test1; print test2 }
module Main where
data T = (:=:) {- | (:!=:) -} deriving (Show,Read)
main
= do putStrLn ("show (:=:) = " ++ show (:=:))
putStrLn ("read (show (:=:)) :: T = " ++
show (read (show (:=:)) :: T))
module Main where
data T = (:=:) {- | (:!=:) -} deriving (Show,Read)
main
= do putStrLn ("show (:=:) = " ++ show (:=:))
putStrLn ("read (show (:=:)) :: T = " ++
show (read (show (:=:)) :: T))
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- Tests newtype deriving with
-- a non-type constructor in the representation
module Main where
newtype Wrap m a = Wrap { unWrap :: m a }
deriving (Functor, Applicative, Monad, Eq)
foo :: Int -> Wrap IO a -> Wrap IO ()
foo 0 a = return ()
foo n a = do { a; foo (n-1) a }
main = do { unWrap (foo 3 (Wrap (putChar 'x'))); putChar '\n' }
-- Tests newtype deriving with
-- a non-type constructor in the representation
module Main where
newtype Wrap m a = Wrap { unWrap :: m a }
deriving (Functor, Applicative, Monad, Eq)
foo :: Int -> Wrap IO a -> Wrap IO ()
foo 0 a = return ()
foo n a = do { a; foo (n-1) a }
main = do { unWrap (foo 3 (Wrap (putChar 'x'))); putChar '\n' }
{-# LANGUAGE ForeignFunctionInterface #-}
module Shared001 where
-- Test for building DLLs with ghc -shared, see #2745
f :: Int -> Int
f x = x+1
foreign export ccall f :: Int -> Int
{-# LANGUAGE ForeignFunctionInterface #-}
module Shared001 where
-- Test for building DLLs with ghc -shared, see #2745
f :: Int -> Int
f x = x+1
foreign export ccall f :: Int -> Int
module X (x, D1(..), D2(..))
where
data D1 = D { f :: D2 } -- deriving Show
data D2 = A | B -- deriving Show
x :: D1
x = D { f = A }
module X (x, D1(..), D2(..))
where
data D1 = D { f :: D2 } -- deriving Show
data D2 = A | B -- deriving Show
x :: D1
x = D { f = A }
module X (x, D1(..), D2(..))
where
data D1 = D { f :: D2 } -- deriving Show
data D2 = A | B -- deriving Show
x :: D1
x = D { f = B }
module X (x, D1(..), D2(..))
where
data D1 = D { f :: D2 } -- deriving Show
data D2 = A | B -- deriving Show
x :: D1
x = D { f = B }
{-# LANGUAGE ForeignFunctionInterface #-}
module T4464H where
f :: Int -> Int
f x = x + 1
foreign export ccall f :: Int -> Int
{-# LANGUAGE ForeignFunctionInterface #-}
module T4464H where
f :: Int -> Int
f x = x + 1
foreign export ccall f :: Int -> Int
module CmmTx where
data TxRes a = TxRes Bool a
instance Monad TxRes where
return = TxRes False
{- Here you can get a simplifier loop thus:
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
Reason: 'a' is inline (not pre/post unconditionally; just ordinary inlining)
Then, since ($dm>>) has arity 3, the rhs of (>>) is a PAP, so the arg is
floated out, past the big lambdas.
See Note [Unsaturated functions] in SimplUtils
------------------------------------------------------------
a_s9f{v} [lid] =
base:GHC.Base.:DMonad{v r5} [gid]
@ main:CmmTx.TxRes{tc rd}
>>={v a6E} [lid]
>>{v a6H} [lid]
return{v a6J} [lid]
fail{v a6M} [lid]
>>{v a6H} [lid] [ALWAYS LoopBreaker Nothing] :: forall a{tv a6F} [tv]
b{tv a6G} [tv].
main:CmmTx.TxRes{tc rd} a{tv a6F} [tv]
-> main:CmmTx.TxRes{tc rd} b{tv a6G} [tv]
-> main:CmmTx.TxRes{tc rd} b{tv a6G} [tv]
[Arity 2
Str: DmdType LL]
>>{v a6H} [lid] =
\ (@ a{tv a78} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d})
(@ b{tv a79} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d}) ->
base:GHC.Base.$dm>>{v r5f} [gid]
@ main:CmmTx.TxRes{tc rd} a_s9f{v} [lid] @ a{tv a78} [sk] @ b{tv a79} [sk]
-}
module CmmTx where
data TxRes a = TxRes Bool a
instance Monad TxRes where
return = TxRes False
{- Here you can get a simplifier loop thus:
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
NOTE: Simplifier still going after 4 iterations; bailing out. Size = 52
Reason: 'a' is inline (not pre/post unconditionally; just ordinary inlining)
Then, since ($dm>>) has arity 3, the rhs of (>>) is a PAP, so the arg is
floated out, past the big lambdas.
See Note [Unsaturated functions] in SimplUtils
------------------------------------------------------------
a_s9f{v} [lid] =
base:GHC.Base.:DMonad{v r5} [gid]
@ main:CmmTx.TxRes{tc rd}
>>={v a6E} [lid]
>>{v a6H} [lid]
return{v a6J} [lid]
fail{v a6M} [lid]
>>{v a6H} [lid] [ALWAYS LoopBreaker Nothing] :: forall a{tv a6F} [tv]
b{tv a6G} [tv].
main:CmmTx.TxRes{tc rd} a{tv a6F} [tv]
-> main:CmmTx.TxRes{tc rd} b{tv a6G} [tv]
-> main:CmmTx.TxRes{tc rd} b{tv a6G} [tv]
[Arity 2
Str: DmdType LL]
>>{v a6H} [lid] =
\ (@ a{tv a78} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d})
(@ b{tv a79} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d}) ->
base:GHC.Base.$dm>>{v r5f} [gid]
@ main:CmmTx.TxRes{tc rd} a_s9f{v} [lid] @ a{tv a78} [sk] @ b{tv a79} [sk]
-}
-- Check that the record selector for maskMB unfolds in the body of f
-- At one stage it didn't because the implicit unfolding looked too big
-- Trac #2581
module ShouldCompile where
import Data.Array.Base
data MBloom s a = MB {
shiftMB :: {-# UNPACK #-} !Int
, maskMB :: {-# UNPACK #-} !Int
, bitArrayMB :: {-# UNPACK #-} !(STUArray s Int Int)
}
f a b c = case maskMB (MB a b c) of
3 -> True
_ -> False
-- Check that the record selector for maskMB unfolds in the body of f
-- At one stage it didn't because the implicit unfolding looked too big
-- Trac #2581
module ShouldCompile where
import Data.Array.Base
data MBloom s a = MB {
shiftMB :: {-# UNPACK #-} !Int
, maskMB :: {-# UNPACK #-} !Int
, bitArrayMB :: {-# UNPACK #-} !(STUArray s Int Int)
}
f a b c = case maskMB (MB a b c) of
3 -> True
_ -> False
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- Tests newtype unwrapping for the IO monad itself
-- Notice the RenderM monad, which is used in the
-- type of the callback function
module ShouldCompile where
import Control.Applicative (Applicative)
import Foreign.Ptr
newtype RenderM a = RenderM (IO a) deriving (Functor, Applicative, Monad)
type RenderCallback = Int -> Int -> RenderM ()
foreign import ccall duma_onRender :: FunPtr RenderCallback -> RenderM ()
foreign import ccall "wrapper" mkRenderCallback
:: RenderCallback -> RenderM (FunPtr RenderCallback)
onRender :: RenderCallback -> RenderM ()
onRender f = mkRenderCallback f >>= duma_onRender
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- Tests newtype unwrapping for the IO monad itself
-- Notice the RenderM monad, which is used in the
-- type of the callback function
module ShouldCompile where
import Control.Applicative (Applicative)
import Foreign.Ptr
newtype RenderM a = RenderM (IO a) deriving (Functor, Applicative, Monad)
type RenderCallback = Int -> Int -> RenderM ()
foreign import ccall duma_onRender :: FunPtr RenderCallback -> RenderM ()
foreign import ccall "wrapper" mkRenderCallback
:: RenderCallback -> RenderM (FunPtr RenderCallback)
onRender :: RenderCallback -> RenderM ()
onRender f = mkRenderCallback f >>= duma_onRender
import Foreign
import Foreign.C
foreign import stdcall "test" ctest :: CInt -> IO ()
main = ctest 3
import Foreign
import Foreign.C
foreign import stdcall "test" ctest :: CInt -> IO ()
main = ctest 3
import Foreign
import Foreign.C
foreign import stdcall "test" ctest :: CInt -> IO ()
main = ctest 3
import Foreign
import Foreign.C
foreign import stdcall "test" ctest :: CInt -> IO ()
main = ctest 3
import Foreign
import Foreign.C
foreign import stdcall "&test" ptest :: FunPtr (CInt -> IO ())
foreign import stdcall "dynamic" ctest :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
main = ctest ptest 3
import Foreign
import Foreign.C
foreign import stdcall "&test" ptest :: FunPtr (CInt -> IO ())
foreign import stdcall "dynamic" ctest :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
main = ctest ptest 3
import Foreign
import Foreign.C
foreign import stdcall "&test" ptest :: FunPtr (CInt -> IO ())
foreign import stdcall "dynamic" ctest :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
main = ctest ptest 3
import Foreign
import Foreign.C
foreign import stdcall "&test" ptest :: FunPtr (CInt -> IO ())
foreign import stdcall "dynamic" ctest :: FunPtr (CInt -> IO ()) -> CInt -> IO ()
main = ctest ptest 3
-- exposed a bug in GHC 6.4 threaded RTS, fixed in Schedule.c rev. 1.232
module Main where
import Control.Concurrent
import Control.Monad
import Foreign.Ptr
import Data.IORef
main = do
ms <- replicateM 100 $ do putStrLn "."
m <- newEmptyMVar
forkOS (thread >> putMVar m ())
thread
return m
mapM takeMVar ms
thread = do var <- newIORef 0
let f = modifyIORef var (1+)
callC =<< mkFunc f
type FUNC = IO ()
foreign import ccall unsafe "wrapper"
mkFunc :: FUNC -> IO (FunPtr FUNC)
foreign import ccall safe "ffi014_cbits.h callC"
callC:: FunPtr FUNC -> IO ()
-- exposed a bug in GHC 6.4 threaded RTS, fixed in Schedule.c rev. 1.232
module Main where
import Control.Concurrent
import Control.Monad
import Foreign.Ptr
import Data.IORef
main = do
ms <- replicateM 100 $ do putStrLn "."
m <- newEmptyMVar
forkOS (thread >> putMVar m ())
thread
return m
mapM takeMVar ms
thread = do var <- newIORef 0
let f = modifyIORef var (1+)
callC =<< mkFunc f
type FUNC = IO ()
foreign import ccall unsafe "wrapper"
mkFunc :: FUNC -> IO (FunPtr FUNC)
foreign import ccall safe "ffi014_cbits.h callC"
callC:: FunPtr FUNC -> IO ()
{-# LANGUAGE GADTs #-}
module Arith where
data E a b = E (a -> b) (b -> a)
eqRefl :: E a a
eqRefl = E id id
-- just to construct unique strings
data W
data M a
-- terms
data Var a where
VarW :: Var W
VarM :: Var (M a)
-- expose s in the type level making sure it is a string
data Abs s e1 where
Abs :: (Var s) -> e1 -> Abs (Var s) e1
data App e1 e2 = App e1 e2
data Lit = Lit
data TyBase = TyBase
data TyArr t1 t2 = TyArr t1 t2
-- (x:ty) in G
data IN g p where
INOne :: IN (g,(x,ty)) (x,ty)
INShift :: IN g0 (x,ty) -> IN (g0,a) (x,ty)
data INEX g x where
INEX :: IN g (x,v) -> INEX g x
-- G1 subseteq G2
type SUP g1 g2 = forall a. IN g1 a -> IN g2 a
-- typing derivations
data DER g a ty where