Skip to content

Commit

Permalink
wrong showArgument line caused deriving Show error
Browse files Browse the repository at this point in the history
git-svn-id: https://svn-agbkb.informatik.uni-bremen.de/Hets/trunk@3604 cec4b9c1-7d33-0410-9eda-942365e851bb
  • Loading branch information
Christian Maeder authored and Christian Maeder committed Jan 3, 2005
1 parent 734b571 commit 5be5844
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions Haskell/test/Prelude.het
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data Int

data (->) a b

data Bool = False | True deriving (Eq, Ord, Show)
data Bool = False | True deriving (Show, Eq, Ord)

not :: Bool -> Bool
not True = False
Expand All @@ -22,7 +22,7 @@ otherwise = True
a && b = if a then True else b

data Ordering = LT | EQ | GT
deriving (Eq, Ord, Show)
deriving (Show, Eq, Ord)

lexOrder EQ o = o
lexOrder o _ = o
Expand All @@ -33,7 +33,7 @@ class Eq a where
x /= y = not (x == y)
x == y = not (x /= y)

data [a] = [] | (:) { head :: a , tail :: [a] } deriving (Eq, Ord)
data [a] = [] | (:) { head :: a , tail :: [a] } deriving (Show, Eq, Ord)
(++) :: [a] -> [a] -> [a]

[] ++ ys = ys
Expand Down Expand Up @@ -96,8 +96,6 @@ showParenArg d = showParen (10<=d)

showArgument x = showChar ' ' . showsPrec 10 x

showArgument x = showChar ' ' . showList x

class Show a where
showsPrec :: Int -> a -> ShowS
show :: a -> String
Expand Down Expand Up @@ -125,9 +123,6 @@ class (Num a) => Fractional a where
recip :: a -> a
fromRational :: Rational -> a

instance (Show a) => Show [a] where
showsPrec p = showList

instance Num Int
instance Num Integer
instance Num Rational
Expand All @@ -154,25 +149,13 @@ data () = () deriving (Eq, Ord, Show)

data (a,b)
= (,) a b
deriving (Eq, Ord)
deriving (Show, Eq, Ord)

instance (Show a, Show b) => Show (a,b) where
showsPrec p (x,y) = showChar '(' . shows x . showChar ',' .
shows y . showChar ')'
data (a,b,c)
= (,,) a b c
deriving (Eq, Ord)
}
%% deriving Show does not work for lists and tuples
%% overloaded constants require type signature!
%[
a = 'a'
deriving (Show, Eq, Ord)

b :: Int
b = 1

c :: Double
c = 1.1

s = ""
]%
data (a,b,c, d)
= (,,,) a b c d
deriving (Show, Eq, Ord)
}

0 comments on commit 5be5844

Please sign in to comment.