Commit c88ecf9a authored by sof's avatar sof
Browse files

[project @ 1999-01-23 18:05:12 by sof]

more h98 updates
parent 617094a8
......@@ -2,7 +2,7 @@ TOP = ../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/should_compile.mk
SRC_HC_OPTS += -dcore-lint
SRC_HC_OPTS += -noC -dcore-lint
read004_HC_OPTS = -fno-implicit-prelude
read012_HC_OPTS += -O -funfold-casms-in-hi-file -fglasgow-exts
......
_interface_ MyList 1 302
_instance_modules_
IO PrelAddr PrelArr PrelBounded PrelCCall PrelForeign PrelNum
_usages_
PrelBase 3 :: $dEval0 1 $dEval2 1 $dEvalBool0 1 $dEvalDouble0 1 $dEvalInt0 1 Eval 1;
_exports_
MyList MyList(Empty :::);
_instances_
instance _forall_ [a] => {PrelBase.Eval (MyList a)} = $dEvalMyList0;
_declarations_
1 $dEvalMyList0 _:_ _forall_ [a] => {PrelBase.Eval (MyList a)} ;;
__interface MyList 1 0 where
import PrelBase 29 :: addr2Integer 8 foldr 1 int2Integer 8 integer_0 8 integer_1 8 integer_2 8 integer_m1 8;
import PrelPack 28 :: packCString# 1 unpackAppendCString# 1 unpackCString# 1 unpackFoldrCString# 1 unpackNBytes# 9;
__instimport IO ; __instimport PrelAddr ; __instimport PrelArr ; __instimport PrelBounded ; __instimport PrelCCall ; __instimport PrelConc ; __instimport PrelForeign ; __instimport PrelIOBase ; __instimport PrelNum ; __instimport PrelNumExtra ; __instimport PrelTup ;
__export MyList MyList{Empty :::};
1 data MyList a = Empty | ::: (MyList a) (MyList a) ;
--!!! import qualified Prelude should leave (), [] etc in scope
-- !!! import qualified Prelude should leave (), [] etc in scope
module ShouldCompile where
......
--!!! tests fixity reading and printing
-- !!! tests fixity reading and printing
module Reader where
infixl 1 `f`
......
--!!! Testing layout rule
-- !!! Testing layout rule
module Layout where
l1 :: IO ()
......
--!!! Empty comments terminating a file..
-- !!! Empty comments terminating a file..
main = print "Hello" --
--!!! Testing handling of troublesome constructor name (:::)
-- !!! Testing handling of troublesome constructor name (:::)
module MyList (MyList(Empty, (:::))) where
data MyList a = Empty
......
module ShouldSucceed where
{-# SPECIALISE f :: Int -> Int
#-}
{-# SPECIALISE f :: Int -> Int #-}
f n = n + 1
--!!! combining undeclared infix operators
-- !!! combining undeclared infix operators
module ShouldSucceed where
-- should default to 'infixl 9'
......
-- !!! Infix record constructor.
module ShouldSucceed where
--!!! Infix record constructor.
data Rec = (:<-:) { a :: Int, b :: Float }
--!!! do & where interaction
-- !!! do & where interaction
module ShouldSucceed where
f1 :: IO a -> IO [a]
......
......@@ -11,3 +11,4 @@ expr001.hs:10: Value not in scope: `c'
Compilation had errors
--!!! this module supposedly includes one of each Haskell construct
-- !!! this module supposedly includes one of each Haskell construct
-- HsImpExp stuff
......@@ -14,10 +14,10 @@ module OneOfEverything (
module OneOfEverything
) where
import qualified Prelude
import Prelude
import IO ( putStr )
import System hiding ( getArgs )
import Monad hiding ( filter )
import Monad
-- HsDecls stuff
......
......@@ -5,16 +5,13 @@ module OneOfEverything (
EqBranch), EqClass(..), OrdClass(orda,
ordb), module OneC, module OneOfEverything
) where
import qualified OneA
import OneB (fB)
import OneC hiding (fC)
import OneC hiding (fC)
infix 6 fixn
infixl 7 +#
infixr 8 fixr
import Prelude
import IO (putStr)
import System hiding (getArgs)
import Monad
{- rec -}
g :: _forall_ [] (Num a, Eq b) => Foo a -> [b] -> (a, a, a) -> b
bindwith :: _forall_ [] (OrdClass a, OrdClass b) => a -> b -> b
g :: (Num a, Eq b) => Foo a -> [b] -> (a, a, a) -> b
bindwith :: (OrdClass a, OrdClass b) => a -> b -> b
fixn x y = x
fixl x y = x
fixr x y = x
......@@ -30,37 +27,36 @@ recb a = reca a
{- rec -}
nullity = null
mat a b c d
| foof a b = d
| foof a c = d
| foof b c = d
where
{- rec -}
foof a b = a == b
| foof a b = d
| foof a c = d
| foof b c = d
where
{- rec -}
foof a b = a == b
expr a b c d
= ((((((((a + (: a b)) + (a : b)) + (((1 - 'c') - "abc") - 1.293))
+ ((\ x y z -> x) 42))
+ ((9 *)))
+ ((* 8)))
+ (case x of
Prelude.[]
| null x -> 99
| otherwise -> 98
| True -> 97
where
{- rec -}
null x = False))
+ ([z | z <- c, isSpace z]))
+ (let
{- rec -}
y = foo
in
(((((((y + [1, 2, 3, 4]) + (4, 3, 2, 1))
+ (4 :: _forall_ [] (Num a) => a))
+ (if 42 == 42.0 then 1 else 4))
+ ([1 .. ]))
+ ([2, 4 .. ]))
+ ([3 .. 5]))
+ ([4, 8 .. 999]))
= ((((((((a + (: a b)) + (a : b)) + (((1 - 'c') - "abc") - 1.293))
+ ((\ x y z -> x) 42))
+ ((9 *)))
+ ((* 8)))
+ (case x of
Prelude.[]
| null x -> 99
| otherwise -> 98
| True -> 97
where
{- rec -}
null x = False))
+ ([z | z <- c, isSpace z]))
+ (let
{- rec -}
y = foo
in
(((((((y + [1, 2, 3, 4]) + (4, 3, 2, 1)) + (4 :: (Num a) => a))
+ (if 42 == 42.0 then 1 else 4))
+ ([1 .. ]))
+ ([2, 4 .. ]))
+ ([3 .. 5]))
+ ([4, 8 .. 999]))
f _
x
1
......@@ -73,10 +69,10 @@ f _
[1, 2]
(3, 4)
((n+42))
= y
= y
g x y z = head y
default (Integer, Rational)
instance _forall_ [] (Eq a) => EqClass (EqTree a) where
instance (Eq a) => EqClass (EqTree a) where
[]
eqc x = 'a'
class (Ord a) => OrdClass a where {
......@@ -90,20 +86,37 @@ data (Eq a) => EqTree a = EqLeaf a | EqBranch (EqLeaf a) (EqLeaf a)
data FooDataB = FooConB Double
data FooData = FooCon Int
type Pair a b = (a, b)
infixr 8 fixr
infixl 7 +#
infix 6 fixn
read001.hs:17: Could not find valid interface file `OneA'
read001.hs:20: Warning: Unused fixity declaration for `+#'
read001.hs:5: Type constructor or class not in scope: `FooDataC'
read001.hs:5: Unknown module in export list: module `OneC'
read001.hs:40: Type constructor or class not in scope: `EqLeaf'
read001.hs:18: Could not find valid interface file `OneB'
read001.hs:40: Type constructor or class not in scope: `EqLeaf'
read001.hs:18: Module `OneB' does not export `fB'
read001.hs:80: Value not in scope: `isSpace'
read001.hs:19: Could not find valid interface file `OneC'
read001.hs:87: Value not in scope: `x'
read001.hs:19: Module `OneC' does not export `fC'
read001.hs:87: Value not in scope: `x'
read001.hs:20: Module `OneC' does not export `fC'
read001.hs:95: Value not in scope: `foo'
read001.hs:107: Data constructor not in scope: `Foo'
read001.hs:107: Data constructor not in scope: `Bar'
read001.hs:112: Type constructor or class not in scope: `Foo'
Compilation had errors
--!!! Irrefutable patterns + guards
-- !!! Irrefutable patterns + guards
module Read003 where
~(a,b,c) | nullity b = a
......
......@@ -12,18 +12,13 @@ module Read003 where
read003.hs:8:
read003.hs:4:
Occurs check: cannot construct the infinite type:
aKy = (aKy, aKB, aKE)
Expected: (aKy, [aKM], aKE)
Inferred: aKy
In a pattern binding:
~(a, b, c)
| nullity b = a
| nullity c = a
| otherwise = a
where
nullity = null
t = (t, [a], _116)
Expected type: (t, [a], _116)
Inferred type: t
In the right-hand side of a pattern binding: a
Compilation had errors
--!!! string gaps
--!!!
-- !!! string gaps
-- !!!
module Main(main) where
-----------
......
--!!! Using pattern syntax on RHS
-- !!! Using pattern syntax on RHS
module ShouldFail where
f :: Int -> Int
......
--!!! Expressions as patterns inside do stmt blocks
-- !!! Expressions as patterns inside do stmt blocks
module ShouldFail where
f :: Int -> IO Int
......
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