{-# LANGUAGE DeriveDataTypeable #-}

-- | Fixity
module GHC.Types.Fixity
   ( Fixity (..)
   , FixityDirection (..)
   , LexicalFixity (..)
   , maxPrecedence
   , minPrecedence
   , defaultFixity
   , negateFixity
   , funTyFixity
   , compareFixity
   )
where

import GHC.Prelude

import GHC.Types.SourceText

import GHC.Utils.Outputable
import GHC.Utils.Binary

import Data.Data hiding (Fixity, Prefix, Infix)

data Fixity = Fixity SourceText Int FixityDirection
  -- Note [Pragma source text]
  deriving Typeable Fixity
Fixity -> DataType
Fixity -> Constr
(forall b. Data b => b -> b) -> Fixity -> Fixity
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Fixity -> u
forall u. (forall d. Data d => d -> u) -> Fixity -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Fixity -> m Fixity
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fixity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Fixity -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Fixity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Fixity -> [u]
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fixity -> r
gmapT :: (forall b. Data b => b -> b) -> Fixity -> Fixity
$cgmapT :: (forall b. Data b => b -> b) -> Fixity -> Fixity
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Fixity)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Fixity)
dataTypeOf :: Fixity -> DataType
$cdataTypeOf :: Fixity -> DataType
toConstr :: Fixity -> Constr
$ctoConstr :: Fixity -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Fixity
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Fixity -> c Fixity
Data

instance Outputable Fixity where
    ppr :: Fixity -> SDoc
ppr (Fixity SourceText
_ Int
prec FixityDirection
dir) = [SDoc] -> SDoc
hcat [forall a. Outputable a => a -> SDoc
ppr FixityDirection
dir, SDoc
space, Int -> SDoc
int Int
prec]

instance Eq Fixity where -- Used to determine if two fixities conflict
  (Fixity SourceText
_ Int
p1 FixityDirection
dir1) == :: Fixity -> Fixity -> Bool
== (Fixity SourceText
_ Int
p2 FixityDirection
dir2) = Int
p1forall a. Eq a => a -> a -> Bool
==Int
p2 Bool -> Bool -> Bool
&& FixityDirection
dir1 forall a. Eq a => a -> a -> Bool
== FixityDirection
dir2

instance Binary Fixity where
    put_ :: BinHandle -> Fixity -> IO ()
put_ BinHandle
bh (Fixity SourceText
src Int
aa FixityDirection
ab) = do
            forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh SourceText
src
            forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh Int
aa
            forall a. Binary a => BinHandle -> a -> IO ()
put_ BinHandle
bh FixityDirection
ab
    get :: BinHandle -> IO Fixity
get BinHandle
bh = do
          SourceText
src <- forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
          Int
aa <- forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
          FixityDirection
ab <- forall a. Binary a => BinHandle -> IO a
get BinHandle
bh
          forall (m :: * -> *) a. Monad m => a -> m a
return (SourceText -> Int -> FixityDirection -> Fixity
Fixity SourceText
src Int
aa FixityDirection
ab)

------------------------
data FixityDirection
   = InfixL
   | InfixR
   | InfixN
   deriving (FixityDirection -> FixityDirection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FixityDirection -> FixityDirection -> Bool
$c/= :: FixityDirection -> FixityDirection -> Bool
== :: FixityDirection -> FixityDirection -> Bool
$c== :: FixityDirection -> FixityDirection -> Bool
Eq, Typeable FixityDirection
FixityDirection -> DataType
FixityDirection -> Constr
(forall b. Data b => b -> b) -> FixityDirection -> FixityDirection
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> FixityDirection -> u
forall u. (forall d. Data d => d -> u) -> FixityDirection -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityDirection
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityDirection -> c FixityDirection
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FixityDirection)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityDirection)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FixityDirection -> m FixityDirection
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> FixityDirection -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> FixityDirection -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> FixityDirection -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FixityDirection -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FixityDirection -> r
gmapT :: (forall b. Data b => b -> b) -> FixityDirection -> FixityDirection
$cgmapT :: (forall b. Data b => b -> b) -> FixityDirection -> FixityDirection
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityDirection)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FixityDirection)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FixityDirection)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FixityDirection)
dataTypeOf :: FixityDirection -> DataType
$cdataTypeOf :: FixityDirection -> DataType
toConstr :: FixityDirection -> Constr
$ctoConstr :: FixityDirection -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityDirection
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FixityDirection
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityDirection -> c FixityDirection
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FixityDirection -> c FixityDirection
Data)

instance Outputable FixityDirection where
    ppr :: FixityDirection -> SDoc
ppr FixityDirection
InfixL = String -> SDoc
text String
"infixl"
    ppr FixityDirection
InfixR = String -> SDoc
text String
"infixr"
    ppr FixityDirection
InfixN = String -> SDoc
text String
"infix"

instance Binary FixityDirection where
    put_ :: BinHandle -> FixityDirection -> IO ()
put_ BinHandle
bh FixityDirection
InfixL =
            BinHandle -> Word8 -> IO ()
putByte BinHandle
bh Word8
0
    put_ BinHandle
bh FixityDirection
InfixR =
            BinHandle -> Word8 -> IO ()
putByte BinHandle
bh Word8
1
    put_ BinHandle
bh FixityDirection
InfixN =
            BinHandle -> Word8 -> IO ()
putByte BinHandle
bh Word8
2
    get :: BinHandle -> IO FixityDirection
get BinHandle
bh = do
            Word8
h <- BinHandle -> IO Word8
getByte BinHandle
bh
            case Word8
h of
              Word8
0 -> forall (m :: * -> *) a. Monad m => a -> m a
return FixityDirection
InfixL
              Word8
1 -> forall (m :: * -> *) a. Monad m => a -> m a
return FixityDirection
InfixR
              Word8
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return FixityDirection
InfixN

------------------------
maxPrecedence, minPrecedence :: Int
maxPrecedence :: Int
maxPrecedence = Int
9
minPrecedence :: Int
minPrecedence = Int
0

defaultFixity :: Fixity
defaultFixity :: Fixity
defaultFixity = SourceText -> Int -> FixityDirection -> Fixity
Fixity SourceText
NoSourceText Int
maxPrecedence FixityDirection
InfixL

negateFixity, funTyFixity :: Fixity
-- Wired-in fixities
negateFixity :: Fixity
negateFixity = SourceText -> Int -> FixityDirection -> Fixity
Fixity SourceText
NoSourceText Int
6 FixityDirection
InfixL  -- Fixity of unary negate
funTyFixity :: Fixity
funTyFixity  = SourceText -> Int -> FixityDirection -> Fixity
Fixity SourceText
NoSourceText (-Int
1) FixityDirection
InfixR  -- Fixity of '->', see #15235

{-
Consider

\begin{verbatim}
        a `op1` b `op2` c
\end{verbatim}
@(compareFixity op1 op2)@ tells which way to arrange application, or
whether there's an error.
-}

compareFixity :: Fixity -> Fixity
              -> (Bool,         -- Error please
                  Bool)         -- Associate to the right: a op1 (b op2 c)
compareFixity :: Fixity -> Fixity -> (Bool, Bool)
compareFixity (Fixity SourceText
_ Int
prec1 FixityDirection
dir1) (Fixity SourceText
_ Int
prec2 FixityDirection
dir2)
  = case Int
prec1 forall a. Ord a => a -> a -> Ordering
`compare` Int
prec2 of
        Ordering
GT -> (Bool, Bool)
left
        Ordering
LT -> (Bool, Bool)
right
        Ordering
EQ -> case (FixityDirection
dir1, FixityDirection
dir2) of
                        (FixityDirection
InfixR, FixityDirection
InfixR) -> (Bool, Bool)
right
                        (FixityDirection
InfixL, FixityDirection
InfixL) -> (Bool, Bool)
left
                        (FixityDirection, FixityDirection)
_                -> (Bool, Bool)
error_please
  where
    right :: (Bool, Bool)
right        = (Bool
False, Bool
True)
    left :: (Bool, Bool)
left         = (Bool
False, Bool
False)
    error_please :: (Bool, Bool)
error_please = (Bool
True,  Bool
False)

-- |Captures the fixity of declarations as they are parsed. This is not
-- necessarily the same as the fixity declaration, as the normal fixity may be
-- overridden using parens or backticks.
data LexicalFixity = Prefix | Infix deriving (Typeable LexicalFixity
LexicalFixity -> DataType
LexicalFixity -> Constr
(forall b. Data b => b -> b) -> LexicalFixity -> LexicalFixity
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> LexicalFixity -> u
forall u. (forall d. Data d => d -> u) -> LexicalFixity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LexicalFixity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LexicalFixity -> c LexicalFixity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LexicalFixity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LexicalFixity)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LexicalFixity -> m LexicalFixity
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LexicalFixity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LexicalFixity -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> LexicalFixity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LexicalFixity -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LexicalFixity -> r
gmapT :: (forall b. Data b => b -> b) -> LexicalFixity -> LexicalFixity
$cgmapT :: (forall b. Data b => b -> b) -> LexicalFixity -> LexicalFixity
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LexicalFixity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LexicalFixity)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LexicalFixity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LexicalFixity)
dataTypeOf :: LexicalFixity -> DataType
$cdataTypeOf :: LexicalFixity -> DataType
toConstr :: LexicalFixity -> Constr
$ctoConstr :: LexicalFixity -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LexicalFixity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LexicalFixity
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LexicalFixity -> c LexicalFixity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LexicalFixity -> c LexicalFixity
Data,LexicalFixity -> LexicalFixity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LexicalFixity -> LexicalFixity -> Bool
$c/= :: LexicalFixity -> LexicalFixity -> Bool
== :: LexicalFixity -> LexicalFixity -> Bool
$c== :: LexicalFixity -> LexicalFixity -> Bool
Eq)

instance Outputable LexicalFixity where
  ppr :: LexicalFixity -> SDoc
ppr LexicalFixity
Prefix = String -> SDoc
text String
"Prefix"
  ppr LexicalFixity
Infix  = String -> SDoc
text String
"Infix"