Commit a8b0e4a2 authored by simonpj's avatar simonpj
Browse files

[project @ 1999-12-29 14:46:29 by simonpj]

Many tweaks to expected output
parent 59e8e34e
-- !!! test of datatype with many unboxed fields
--
import PrelBase
import PrelFloat
main = putStr (shows (selectee1 + selectee2) "\n")
......
ds003.hs:5: Pattern match(es) are overlapped in the definition of function `f':
f (x : (x1 : (x2 : x3))) ~(y, ys) z = ...
f x y True = ...
Haskell compiler received signal 2
ds040.hs:7: Pattern match(es) are overlapped in the definition of function `^^^^':
^^^^ _ _ = ...
NOTE: Simplifier still going after 4 iterations; bailing out.
......@@ -12,4 +12,4 @@ main = do
getEnv_except :: IOError -> IO String
getEnv_except ioe
| isDoesNotExistError ioe = return ""
| otherwise = fail ioe
| otherwise = ioError ioe
......@@ -3,9 +3,9 @@ import System (system, ExitCode(..), exitWith)
main =
system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
case ec of
ExitSuccess -> putStr "What?!?\n" >> fail (userError "dog succeeded")
ExitSuccess -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
ExitFailure _ ->
system "cat io005.hs 2>/dev/null" >>= \ ec ->
case ec of
ExitSuccess -> exitWith ExitSuccess
ExitFailure _ -> putStr "What?!?\n" >> fail (userError "cat failed")
ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")
......@@ -3,9 +3,9 @@ import System (system, ExitCode(..), exitWith)
main =
system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
case ec of
ExitSuccess -> putStr "What?!?\n" >> fail (userError "dog succeeded")
ExitSuccess -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
ExitFailure _ ->
system "cat io005.hs 2>/dev/null" >>= \ ec ->
case ec of
ExitSuccess -> exitWith ExitSuccess
ExitFailure _ -> putStr "What?!?\n" >> fail (userError "cat failed")
ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")
......@@ -12,7 +12,7 @@ main = do
removeDirectory "foo"
putStr "Okay\n"
else
fail (userError "Oops")
ioError (userError "Oops")
dot :: String -> Bool
dot "." = True
......
import IO -- 1.3
main =
accumulate (map hIsOpen [stdin, stdout, stderr]) >>= \ opens ->
sequence (map hIsOpen [stdin, stdout, stderr]) >>= \ opens ->
print opens >>
accumulate (map hIsClosed [stdin, stdout, stderr]) >>= \ closeds ->
sequence (map hIsClosed [stdin, stdout, stderr]) >>= \ closeds ->
print closeds >>
accumulate (map hIsReadable [stdin, stdout, stderr]) >>= \ readables ->
sequence (map hIsReadable [stdin, stdout, stderr]) >>= \ readables ->
print readables >>
accumulate (map hIsWritable [stdin, stdout, stderr]) >>= \ writables ->
sequence (map hIsWritable [stdin, stdout, stderr]) >>= \ writables ->
print writables >>
accumulate (map hIsBlockBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
sequence (map hIsBlockBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
print buffereds >>
accumulate (map hIsLineBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
sequence (map hIsLineBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
print buffereds >>
accumulate (map hIsNotBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
sequence (map hIsNotBuffered [stdin, stdout, stderr]) >>= \ buffereds ->
print buffereds
where
-- these didn't make it into 1.3
......
--!!! Testing RW handles
-- !!! Testing RW handles
module Main(main) where
......
--!!! Testing output on stdout
-- !!! Testing output on stdout
module Main(main) where
-- stdout is buffered, so test if its buffer
......
--!!! Testing IO.hFileSize
-- !!! Testing IO.hFileSize
module Main(main) where
import IO
......
--!!! Testing EOF (and the clearing of it)
-- !!! Testing EOF (and the clearing of it)
module Main(main) where
import IO
......
--!!! Flushing
-- !!! Flushing
module Main(main) where
import IO
......
--!!! file positions (hGetPosn and hSetPosn)
-- !!! file positions (hGetPosn and hSetPosn)
module Main(main) where
import IO
......
--!!! RW files
-- !!! RW files
module Main(main) where
import IO
......
{-# OPTIONS -H12m -syslib exts #-}
{-# OPTIONS -H12m -syslib lang #-}
module Basic where
import TypesettingTricks
......
......@@ -9,14 +9,13 @@ import Prelude
import IO (putStr)
import System hiding (getArgs)
import Monad
{- rec -}
bindwith ::
{- implicit forall -} (OrdClass a, OrdClass b) => a -> b -> b
g ::
{- implicit forall -}
(Num a, Eq b) =>
Foo a -> [b] -> (a, a, a) -> b
g x y zz = head y
g x y z = head y
f _
x
1
......@@ -24,51 +23,34 @@ f _
'c'
"dog"
~y
(zz@(Foo a b))
(z@(Foo a b))
(c Bar d)
[1, 2]
(3, 4)
((n+42))
= y
expr a b c d
= ((((((((a zp (ZC a b)) zp (a ZC b))
zp (((1 zm 'c') zm "abc") zm 1.293))
zp ((\ x y zz -> x) 42))
zp ((9 zt)))
zp ((zt 8)))
zp (case x of
Prelude.ZMZN
| null x -> 99
| otherwise -> 98
| True -> 97
where
{- rec -}
null x = False))
zp ([zz | zz <- c, isSpace zz]))
zp (let
{- rec -}
y = foo
in
(((((((y zp [1, 2, 3, 4]) zp (4, 3, 2, 1))
zp (4 :: {- implicit forall -} (Num a) => a))
zp (if 42 zeze 42.0 then 1 else 4))
zp ([1 .. ]))
zp ([2, 4 .. ]))
zp ([3 .. 5]))
zp ([4, 8 .. 999]))
= ((((...) + (...))
+ (case ... of
Prelude.[]
| ... -> ...
| ... -> ...
| ... -> ...
where
...))
+ ([z | z <- c, isSpace z]))
+ (let y = ... in ((...) + (...)) + ([..., ... .. ...]))
mat a b c d
| foof a b = d
| foof a c = d
| foof b c = d
where
{- rec -}
foof a b = a zeze b
foof a b = a == b
(~(a, b, c))
| nullity b = a
| nullity c = a
| otherwise = a
where
{- rec -}
nullity = null
recb a = reca a
reca a = recb a
......@@ -78,7 +60,7 @@ fixr x y = x
fixl x y = x
fixn x y = x
infix 6 fixn
infixl 7 zpzh
infixl 7 +#
infixr 8 fixr
type Pair a b = (a, b)
data FooData = forall. FooCon Int
......
==================== Parser ====================
module Read003 where
{- rec -}
~(a, b, c)
| nullity b = a
| nullity c = a
| otherwise = a
where
{- rec -}
nullity = null
......
==================== Parser ====================
module ShouldFail where
{- rec -}
f :: {- implicit forall -} Int -> IO Int
f x = do
(2 zp 2) <- 2
(2 + 2) <- 2
return x
......
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