{-# LANGUAGE DeriveLift #-}
module Data.Aeson.JSONPath.Types.Segment
  (Segment (..)
  , QuerySegment (..)
  , SegmentType (..)
  )
  where

import Data.Aeson.JSONPath.Types.Selector (Selector (..))
import Data.Text                          (Text)
import Language.Haskell.TH.Syntax         (Lift)

import Prelude

-- |
data SegmentType
  = Child
  | Descendant
  deriving (SegmentType -> SegmentType -> Bool
(SegmentType -> SegmentType -> Bool)
-> (SegmentType -> SegmentType -> Bool) -> Eq SegmentType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SegmentType -> SegmentType -> Bool
== :: SegmentType -> SegmentType -> Bool
$c/= :: SegmentType -> SegmentType -> Bool
/= :: SegmentType -> SegmentType -> Bool
Eq, Int -> SegmentType -> ShowS
[SegmentType] -> ShowS
SegmentType -> String
(Int -> SegmentType -> ShowS)
-> (SegmentType -> String)
-> ([SegmentType] -> ShowS)
-> Show SegmentType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SegmentType -> ShowS
showsPrec :: Int -> SegmentType -> ShowS
$cshow :: SegmentType -> String
show :: SegmentType -> String
$cshowList :: [SegmentType] -> ShowS
showList :: [SegmentType] -> ShowS
Show, (forall (m :: * -> *). Quote m => SegmentType -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    SegmentType -> Code m SegmentType)
-> Lift SegmentType
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => SegmentType -> m Exp
forall (m :: * -> *). Quote m => SegmentType -> Code m SegmentType
$clift :: forall (m :: * -> *). Quote m => SegmentType -> m Exp
lift :: forall (m :: * -> *). Quote m => SegmentType -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => SegmentType -> Code m SegmentType
liftTyped :: forall (m :: * -> *). Quote m => SegmentType -> Code m SegmentType
Lift)

-- |
data QuerySegment a = QuerySegment
  { forall a. QuerySegment a -> SegmentType
segmentType :: SegmentType
  , forall a. QuerySegment a -> Segment a
segment     :: Segment a
  } deriving (QuerySegment a -> QuerySegment a -> Bool
(QuerySegment a -> QuerySegment a -> Bool)
-> (QuerySegment a -> QuerySegment a -> Bool)
-> Eq (QuerySegment a)
forall a. Eq a => QuerySegment a -> QuerySegment a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => QuerySegment a -> QuerySegment a -> Bool
== :: QuerySegment a -> QuerySegment a -> Bool
$c/= :: forall a. Eq a => QuerySegment a -> QuerySegment a -> Bool
/= :: QuerySegment a -> QuerySegment a -> Bool
Eq, Int -> QuerySegment a -> ShowS
[QuerySegment a] -> ShowS
QuerySegment a -> String
(Int -> QuerySegment a -> ShowS)
-> (QuerySegment a -> String)
-> ([QuerySegment a] -> ShowS)
-> Show (QuerySegment a)
forall a. Show a => Int -> QuerySegment a -> ShowS
forall a. Show a => [QuerySegment a] -> ShowS
forall a. Show a => QuerySegment a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> QuerySegment a -> ShowS
showsPrec :: Int -> QuerySegment a -> ShowS
$cshow :: forall a. Show a => QuerySegment a -> String
show :: QuerySegment a -> String
$cshowList :: forall a. Show a => [QuerySegment a] -> ShowS
showList :: [QuerySegment a] -> ShowS
Show, (forall (m :: * -> *). Quote m => QuerySegment a -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    QuerySegment a -> Code m (QuerySegment a))
-> Lift (QuerySegment a)
forall a (m :: * -> *).
(Lift a, Quote m) =>
QuerySegment a -> m Exp
forall a (m :: * -> *).
(Lift a, Quote m) =>
QuerySegment a -> Code m (QuerySegment a)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => QuerySegment a -> m Exp
forall (m :: * -> *).
Quote m =>
QuerySegment a -> Code m (QuerySegment a)
$clift :: forall a (m :: * -> *).
(Lift a, Quote m) =>
QuerySegment a -> m Exp
lift :: forall (m :: * -> *). Quote m => QuerySegment a -> m Exp
$cliftTyped :: forall a (m :: * -> *).
(Lift a, Quote m) =>
QuerySegment a -> Code m (QuerySegment a)
liftTyped :: forall (m :: * -> *).
Quote m =>
QuerySegment a -> Code m (QuerySegment a)
Lift)

-- |
data Segment a
  = Bracketed [Selector a]
  | Dotted Text
  | WildcardSegment
  deriving (Segment a -> Segment a -> Bool
(Segment a -> Segment a -> Bool)
-> (Segment a -> Segment a -> Bool) -> Eq (Segment a)
forall a. Eq a => Segment a -> Segment a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Segment a -> Segment a -> Bool
== :: Segment a -> Segment a -> Bool
$c/= :: forall a. Eq a => Segment a -> Segment a -> Bool
/= :: Segment a -> Segment a -> Bool
Eq, Int -> Segment a -> ShowS
[Segment a] -> ShowS
Segment a -> String
(Int -> Segment a -> ShowS)
-> (Segment a -> String)
-> ([Segment a] -> ShowS)
-> Show (Segment a)
forall a. Show a => Int -> Segment a -> ShowS
forall a. Show a => [Segment a] -> ShowS
forall a. Show a => Segment a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Segment a -> ShowS
showsPrec :: Int -> Segment a -> ShowS
$cshow :: forall a. Show a => Segment a -> String
show :: Segment a -> String
$cshowList :: forall a. Show a => [Segment a] -> ShowS
showList :: [Segment a] -> ShowS
Show, (forall (m :: * -> *). Quote m => Segment a -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    Segment a -> Code m (Segment a))
-> Lift (Segment a)
forall a (m :: * -> *). (Lift a, Quote m) => Segment a -> m Exp
forall a (m :: * -> *).
(Lift a, Quote m) =>
Segment a -> Code m (Segment a)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => Segment a -> m Exp
forall (m :: * -> *). Quote m => Segment a -> Code m (Segment a)
$clift :: forall a (m :: * -> *). (Lift a, Quote m) => Segment a -> m Exp
lift :: forall (m :: * -> *). Quote m => Segment a -> m Exp
$cliftTyped :: forall a (m :: * -> *).
(Lift a, Quote m) =>
Segment a -> Code m (Segment a)
liftTyped :: forall (m :: * -> *). Quote m => Segment a -> Code m (Segment a)
Lift)