    module UU.Scanner.GenTokenOrd() where

    import UU.Scanner.GenToken(GenToken(..))

    instance (Eq key, Eq tp) => Eq (GenToken key tp val) where
       Reserved x :: key
    x    _ == :: GenToken key tp val -> GenToken key tp val -> Bool
    == Reserved y :: key
    y    _ = key
    x key -> key -> Bool
    forall a. Eq a => a -> a -> Bool
    == key
    y
       ValToken tx :: tp
    tx _ _ == ValToken ty :: tp
    ty _ _ = tp
    tx tp -> tp -> Bool
    forall a. Eq a => a -> a -> Bool
    == tp
    ty
       _               == _               = Bool
    False

    instance (Ord key, Ord tp) => Ord (GenToken key tp val) where
      compare :: GenToken key tp val -> GenToken key tp val -> Ordering
    compare (Reserved x :: key
    x    _) (Reserved y :: key
    y    _) = key -> key -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare key
    x key
    y
      compare (Reserved _    _) _                 = Ordering
    LT
      compare (ValToken tx :: tp
    tx _ _) (ValToken ty :: tp
    ty _ _) = tp -> tp -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare tp
    tx tp
    ty
      compare _              _                    = Ordering
    GT