Commit 30e1bbc2 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-05-16 12:53:22 by simonpj]

Add newtype rep test
parent dab0c2ed
......@@ -202,6 +202,7 @@ test('tc189', normal, compile, [''])
test('tc190', only_compiler_types(['ghc']), compile, [''])
test('tc191', only_compiler_types(['ghc']), compile, [''])
test('tc192', only_compiler_types(['ghc']), compile, [''])
test('tc193', only_compiler_types(['ghc']), compile, [''])
test('LoopOfTheDay1', normal, compile, [''])
test('LoopOfTheDay2', normal, compile, [''])
......
{-# OPTIONS -fglasgow-exts #-}
{-
Bug report from Jon Mountjoy:
......@@ -33,33 +34,34 @@ data HappyAbsSyn t1 t2 t3
| HappyAbsSyn2 t2
| HappyAbsSyn3 t3
action_0 (6) = happyShift action_3 --- *****
action_0 (1) = happyGoto action_1
action_0 (2) = happyGoto action_2
-- action_0 (6) = happyShift action_3 --- *****
-- action_0 (1) = happyGoto action_1
-- action_0 (2) = happyGoto action_2
action_0 _ = happyFail
action_1 (7) = happyAccept
action_1 _ = happyFail
-- action_1 (7) = happyAccept
-- action_1 _ = happyFail
action_2 _ = happyReduce_1
-- action_2 _ = happyReduce_1
action_3 (5) = happyShift action_4
action_3 _ = happyFail
-- action_3 (5) = happyShift action_4
-- action_3 _ = happyFail
action_4 (4) = happyShift action_6
action_4 (3) = happyGoto action_5
action_4 _ = happyFail
-- action_4 (4) = happyShift action_6
-- action_4 (3) = happyGoto action_5
-- action_4 _ = happyFail
action_5 _ = happyReduce_2
-- action_5 _ = happyReduce_2
action_6 _ = happyReduce_3
-- action_6 _ = happyReduce_3
{-
happyReduce_1 = happySpecReduce_1 1 reduction where { -- ##
reduction
(HappyAbsSyn2 happy_var_1)
= HappyAbsSyn1
(\p -> let q = map (\(x,y) -> (x,y p)) happy_var_1 in (10.1))
;
;
reduction _ = notHappyAtAll }
happyReduce_2 = happySpecReduce_3 2 reduction where {
......@@ -77,6 +79,7 @@ happyReduce_3 = happySpecReduce_1 3 reduction where {
= HappyAbsSyn3
(\p -> happy_var_1);
reduction _ = notHappyAtAll }
-}
happyNewToken action sts stk [] =
action 7 7 (error "reading EOF!") (HappyState action) sts stk []
......@@ -89,8 +92,10 @@ happyNewToken action sts stk (tk:tks) =
TokenVar happy_dollar_dollar -> cont 6;
}
happyThen = \m k -> k m
happyReturn = \a tks -> a
-- happyThen = \m k -> k m
-- happyReturn = \a tks -> a
myparser :: forall t. [Token] -> t -> Double
myparser = happyParse
......@@ -106,7 +111,7 @@ data Token =
deriving Show
main = print (myparser [] [])
-- $Id: tc095.hs,v 1.1 2001/06/20 16:13:07 sewardj Exp $
-- $Id: tc095.hs,v 1.2 2005/05/16 12:53:22 simonpj Exp $
{-
The stack is in the following order throughout the parse:
......@@ -126,7 +131,7 @@ happyParse = happyNewToken action_0 [] []
-- All this HappyState stuff is simply because we can't have recursive
-- types in Haskell without an intervening data structure.
newtype HappyState b c = HappyState
data HappyState b c = HappyState
(Int -> -- token number
Int -> -- token number (yes, again)
b -> -- token semantic value
......@@ -136,6 +141,7 @@ newtype HappyState b c = HappyState
-----------------------------------------------------------------------------
-- Accepting the parse
{-
happyAccept j tk st sts [ HappyAbsSyn1 ans ] = happyReturn ans
happyAccept j tk st sts _ = notHappyAtAll
......@@ -157,7 +163,6 @@ happyShift new_state i tk st sts stk =
-- don't allow reductions when we're in error recovery, because this can
-- lead to an infinite loop.
happySpecReduce_0 i fn (-1) tk _ sts stk
= case sts of
st@(HappyState action):sts -> action (-1) (-1) tk st sts stk
......@@ -200,7 +205,7 @@ happyMonadReduce k i c fn j tk st sts stk =
happyThen (fn stk) (\r -> action i j tk st' sts' (c r : stk'))
where sts'@(st'@(HappyState action):_) = drop (k::Int) (st:sts)
stk' = drop (k::Int) stk
-}
-----------------------------------------------------------------------------
-- Moving to a new state after a reduction
......
-- A newtype representation problem crashed GHC 6.4
module ShouldCompile where
newtype Signal a = Signal Symbol
newtype Symbol = Symbol (S Symbol)
data S s = Bool Bool
liftl :: Signal a -> Symbol
liftl (Signal a) = a
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