{-# LINE 1 "GLR_Base.lhs" #-}
{-# LINE 1 "/tmp/ghc7118_0/ghc7118_0.lpp" #-}
{-# LINE 1 "<built-in>" #-}
{-# LINE 1 "<command line>" #-}
{-# LINE 1 "/tmp/ghc7118_0/ghc7118_0.lpp" #-}
{-# LINE 1 "GLR_Base.lhs" #-}









type ForestId  = (Int,Int,GSymbol)





data GLRAction = Shift Int [Reduction]
               | Reduce [Reduction]
               | Accept
               | Error 






type Reduction = (GSymbol,Int, [ForestId] -> Branch)





data Branch
 = Branch {b_sem :: GSem, b_nodes :: [ForestId]}
   deriving Show

instance Eq Branch where
       b1 == b2 = b_nodes b1 == b_nodes b2













class TreeDecode a where
       decode_b :: (ForestId -> [Branch]) -> Branch -> [Decode_Result a]

decode :: TreeDecode a => (ForestId -> [Branch]) -> ForestId -> [Decode_Result a]
decode f i@(_,_,HappyTok t) 
  = decode_b f (Branch (SemTok t) [])
decode f i
  = [ d | b <- f i, d <- decode_b f b ]








--cross_fn :: [a -> b] -> [a] -> [b]
--actual type will depend on monad in use. 
--happy_ap defined by parser generator
cross_fn fs as = [ f `happy_ap` a | f <- fs, a <- as]








class LabelDecode a where
       unpack :: GSem -> a






