{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}

-- | The contents of this module originate from module
--  [HSE.Util](https://github.com/ndmitchell/hlint/blob/master/src/HSE/Util.hs)
--  in Neil Mitchell's HLint.
module Language.Haskell.Exts.Util.Internal where

import           Language.Haskell.Exts
import           Prelude

---------------------------------------------------------------------
-- ACCESSOR/TESTER

-- is* :: Exp l -> Bool
-- is* :: Decl s -> Bool
isApp :: Exp l -> Bool
isApp :: Exp l -> Bool
isApp App{} = Bool
True; isApp Exp l
_ = Bool
False
isAnyApp :: Exp l -> Bool
isAnyApp :: Exp l -> Bool
isAnyApp Exp l
x = Exp l -> Bool
forall l. Exp l -> Bool
isApp Exp l
x Bool -> Bool -> Bool
|| Exp l -> Bool
forall l. Exp l -> Bool
isInfixApp Exp l
x
isInfixApp :: Exp l -> Bool
isInfixApp :: Exp l -> Bool
isInfixApp InfixApp{} = Bool
True; isInfixApp Exp l
_ = Bool
False

isDot :: QOp s -> Bool
isDot :: QOp s -> Bool
isDot (QVarOp s
_ (UnQual s
_ (Symbol s
_ [Char]
"."))) = Bool
True
isDot QOp s
_                                    = Bool
False
isSection :: Exp l -> Bool
isSection :: Exp l -> Bool
isSection LeftSection{}  = Bool
True
isSection RightSection{} = Bool
True
isSection Exp l
_              = Bool
False

isDotApp :: Exp s -> Bool
isDotApp :: Exp s -> Bool
isDotApp (InfixApp s
_ Exp s
_ QOp s
dot Exp s
_) | QOp s -> Bool
forall s. QOp s -> Bool
isDot QOp s
dot = Bool
True
isDotApp Exp s
_                    = Bool
False