{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}

-- | The Nix expression type and supporting types.
--
-- For a brief introduction of the Nix expression language, see
-- <https://nixos.org/nix/manual/#ch-expression-language>.
module Nix.Expr.Types where

#ifdef MIN_VERSION_serialise
import           Codec.Serialise                ( Serialise )
import qualified Codec.Serialise               as Ser
#endif
import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Data.Aeson
import           Data.Aeson.TH
import           Data.Binary                    ( Binary )
import qualified Data.Binary                   as Bin
import           Data.Data
import           Data.Eq.Deriving
import           Data.Fix
import           Data.Functor.Classes
import           Data.Hashable
import           Data.Hashable.Lifted
import           Data.List                      ( inits
                                                , tails
                                                )
import           Data.List.NonEmpty             ( NonEmpty(..) )
import qualified Data.List.NonEmpty            as NE
import           Data.Maybe                     ( fromMaybe )
import           Data.Ord.Deriving
import           Data.Text                      ( Text
                                                , pack
                                                , unpack
                                                )
import           Data.Traversable
import           GHC.Exts
import           GHC.Generics
import           Language.Haskell.TH.Syntax
import           Lens.Family2
import           Lens.Family2.TH
import           Nix.Atoms
import           Nix.Utils
import           Text.Megaparsec.Pos
import           Text.Read.Deriving
import           Text.Show.Deriving
import           Type.Reflection                ( eqTypeRep )
import qualified Type.Reflection               as Reflection

type VarName = Text

hashAt :: VarName -> Lens' (AttrSet v) (Maybe v)
hashAt :: VarName -> Lens' (AttrSet v) (Maybe v)
hashAt = ((Maybe v -> f (Maybe v)) -> VarName -> AttrSet v -> f (AttrSet v))
-> VarName
-> (Maybe v -> f (Maybe v))
-> AttrSet v
-> f (AttrSet v)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Maybe v -> f (Maybe v)) -> VarName -> AttrSet v -> f (AttrSet v)
forall k (f :: * -> *) v.
(Eq k, Hashable k, Functor f) =>
(Maybe v -> f (Maybe v)) -> k -> HashMap k v -> f (HashMap k v)
alterF

-- unfortunate orphans
instance Hashable1 NonEmpty

-- | The main nix expression type. This is polymorphic so that it can be made
-- a functor, which allows us to traverse expressions and map functions over
-- them. The actual 'NExpr' type is a fixed point of this functor, defined
-- below.
data NExprF r
  = NConstant !NAtom
  -- ^ Constants: ints, floats, bools, URIs, and null.
  | NStr !(NString r)
  -- ^ A string, with interpolated expressions.
  | NSym !VarName
  -- ^ A variable. For example, in the expression @f a@, @f@ is represented
  -- as @NSym "f"@ and @a@ as @NSym "a"@.
  --
  -- > NSym "x"                                    ~  x
  | NList ![r]
  -- ^ A list literal.
  --
  -- > NList [x,y]                                 ~  [ x y ]
  | NSet !NRecordType ![Binding r]
  -- ^ An attribute set literal
  --
  -- > NSet NRecursive    [NamedVar x y _]         ~  rec { x = y; }
  -- > NSet NNonRecursive [Inherit Nothing [x] _]  ~  { inherit x; }
  | NLiteralPath !FilePath
  -- ^ A path expression, which is evaluated to a store path. The path here
  -- can be relative, in which case it's evaluated relative to the file in
  -- which it appears.
  --
  -- > NLiteralPath "/x"                           ~  /x
  -- > NLiteralPath "x/y"                          ~  x/y
  | NEnvPath !FilePath
  -- ^ A path which refers to something in the Nix search path (the NIX_PATH
  -- environment variable. For example, @<nixpkgs/pkgs>@.
  --
  -- > NEnvPath "x"                                ~  <x>
  | NUnary !NUnaryOp !r
  -- ^ Application of a unary operator to an expression.
  --
  -- > NUnary NNeg x                               ~  - x
  -- > NUnary NNot x                               ~  ! x
  | NBinary !NBinaryOp !r !r
  -- ^ Application of a binary operator to two expressions.
  --
  -- > NBinary NPlus x y                           ~  x + y
  -- > NBinary NApp  f x                           ~  f x
  | NSelect !r !(NAttrPath r) !(Maybe r)
  -- ^ Dot-reference into an attribute set, optionally providing an
  -- alternative if the key doesn't exist.
  --
  -- > NSelect s (x :| []) Nothing                 ~  s.x
  -- > NSelect s (x :| []) (Just y)                ~  s.x or y
  | NHasAttr !r !(NAttrPath r)
  -- ^ Ask if a set contains a given attribute path.
  --
  -- > NHasAttr s (x :| [])                        ~  s ? x
  | NAbs !(Params r) !r
  -- ^ A function literal (lambda abstraction).
  --
  -- > NAbs (Param "x") y                          ~  x: y
  | NLet ![Binding r] !r
  -- ^ Evaluate the second argument after introducing the bindings.
  --
  -- > NLet []                    x                ~  let in x
  -- > NLet [NamedVar x y _]      z                ~  let x = y; in z
  -- > NLet [Inherit Nothing x _] y                ~  let inherit x; in y
  | NIf !r !r !r
  -- ^ If-then-else statement.
  --
  -- > NIf x y z                                   ~  if x then y else z
  | NWith !r !r
  -- ^ Evaluate an attribute set, bring its bindings into scope, and
  -- evaluate the second argument.
  --
  -- > NWith x y                                   ~  with x; y
  | NAssert !r !r
  -- ^ Assert that the first returns @true@ before evaluating the second.
  --
  -- > NAssert x y                                 ~  assert x; y
  | NSynHole !VarName
  -- ^ Syntactic hole.
  --
  -- See <https://github.com/haskell-nix/hnix/issues/197> for context.
  --
  -- > NSynHole "x"                                ~  ^x
  deriving (Eq (NExprF r)
Eq (NExprF r) =>
(NExprF r -> NExprF r -> Ordering)
-> (NExprF r -> NExprF r -> Bool)
-> (NExprF r -> NExprF r -> Bool)
-> (NExprF r -> NExprF r -> Bool)
-> (NExprF r -> NExprF r -> Bool)
-> (NExprF r -> NExprF r -> NExprF r)
-> (NExprF r -> NExprF r -> NExprF r)
-> Ord (NExprF r)
NExprF r -> NExprF r -> Bool
NExprF r -> NExprF r -> Ordering
NExprF r -> NExprF r -> NExprF r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (NExprF r)
forall r. Ord r => NExprF r -> NExprF r -> Bool
forall r. Ord r => NExprF r -> NExprF r -> Ordering
forall r. Ord r => NExprF r -> NExprF r -> NExprF r
min :: NExprF r -> NExprF r -> NExprF r
$cmin :: forall r. Ord r => NExprF r -> NExprF r -> NExprF r
max :: NExprF r -> NExprF r -> NExprF r
$cmax :: forall r. Ord r => NExprF r -> NExprF r -> NExprF r
>= :: NExprF r -> NExprF r -> Bool
$c>= :: forall r. Ord r => NExprF r -> NExprF r -> Bool
> :: NExprF r -> NExprF r -> Bool
$c> :: forall r. Ord r => NExprF r -> NExprF r -> Bool
<= :: NExprF r -> NExprF r -> Bool
$c<= :: forall r. Ord r => NExprF r -> NExprF r -> Bool
< :: NExprF r -> NExprF r -> Bool
$c< :: forall r. Ord r => NExprF r -> NExprF r -> Bool
compare :: NExprF r -> NExprF r -> Ordering
$ccompare :: forall r. Ord r => NExprF r -> NExprF r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (NExprF r)
Ord, NExprF r -> NExprF r -> Bool
(NExprF r -> NExprF r -> Bool)
-> (NExprF r -> NExprF r -> Bool) -> Eq (NExprF r)
forall r. Eq r => NExprF r -> NExprF r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NExprF r -> NExprF r -> Bool
$c/= :: forall r. Eq r => NExprF r -> NExprF r -> Bool
== :: NExprF r -> NExprF r -> Bool
$c== :: forall r. Eq r => NExprF r -> NExprF r -> Bool
Eq, (forall x. NExprF r -> Rep (NExprF r) x)
-> (forall x. Rep (NExprF r) x -> NExprF r) -> Generic (NExprF r)
forall x. Rep (NExprF r) x -> NExprF r
forall x. NExprF r -> Rep (NExprF r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (NExprF r) x -> NExprF r
forall r x. NExprF r -> Rep (NExprF r) x
$cto :: forall r x. Rep (NExprF r) x -> NExprF r
$cfrom :: forall r x. NExprF r -> Rep (NExprF r) x
Generic, (forall a. NExprF a -> Rep1 NExprF a)
-> (forall a. Rep1 NExprF a -> NExprF a) -> Generic1 NExprF
forall a. Rep1 NExprF a -> NExprF a
forall a. NExprF a -> Rep1 NExprF a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 NExprF a -> NExprF a
$cfrom1 :: forall a. NExprF a -> Rep1 NExprF a
Generic1, Typeable, Typeable (NExprF r)
DataType
Constr
Typeable (NExprF r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NExprF r -> c (NExprF r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (NExprF r))
-> (NExprF r -> Constr)
-> (NExprF r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (NExprF r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (NExprF r)))
-> ((forall b. Data b => b -> b) -> NExprF r -> NExprF r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NExprF r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NExprF r -> r)
-> (forall u. (forall d. Data d => d -> u) -> NExprF r -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> NExprF r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r))
-> Data (NExprF r)
NExprF r -> DataType
NExprF r -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (NExprF r))
(forall b. Data b => b -> b) -> NExprF r -> NExprF r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NExprF r -> c (NExprF r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NExprF r)
forall r. Data r => Typeable (NExprF r)
forall r. Data r => NExprF r -> DataType
forall r. Data r => NExprF r -> Constr
forall r.
Data r =>
(forall b. Data b => b -> b) -> NExprF r -> NExprF r
forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NExprF r -> u
forall r u.
Data r =>
(forall d. Data d => d -> u) -> NExprF r -> [u]
forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NExprF r)
forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NExprF r -> c (NExprF r)
forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NExprF r))
forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NExprF r))
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) -> NExprF r -> u
forall u. (forall d. Data d => d -> u) -> NExprF r -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NExprF r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NExprF r -> c (NExprF r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (NExprF r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NExprF r))
$cNSynHole :: Constr
$cNAssert :: Constr
$cNWith :: Constr
$cNIf :: Constr
$cNLet :: Constr
$cNAbs :: Constr
$cNHasAttr :: Constr
$cNSelect :: Constr
$cNBinary :: Constr
$cNUnary :: Constr
$cNEnvPath :: Constr
$cNLiteralPath :: Constr
$cNSet :: Constr
$cNList :: Constr
$cNSym :: Constr
$cNStr :: Constr
$cNConstant :: Constr
$tNExprF :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
$cgmapMo :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
gmapMp :: (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
$cgmapMp :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
gmapM :: (forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
$cgmapM :: forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NExprF r -> m (NExprF r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> NExprF r -> u
$cgmapQi :: forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NExprF r -> u
gmapQ :: (forall d. Data d => d -> u) -> NExprF r -> [u]
$cgmapQ :: forall r u.
Data r =>
(forall d. Data d => d -> u) -> NExprF r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
$cgmapQr :: forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
$cgmapQl :: forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NExprF r -> r
gmapT :: (forall b. Data b => b -> b) -> NExprF r -> NExprF r
$cgmapT :: forall r.
Data r =>
(forall b. Data b => b -> b) -> NExprF r -> NExprF r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NExprF r))
$cdataCast2 :: forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NExprF r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (NExprF r))
$cdataCast1 :: forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NExprF r))
dataTypeOf :: NExprF r -> DataType
$cdataTypeOf :: forall r. Data r => NExprF r -> DataType
toConstr :: NExprF r -> Constr
$ctoConstr :: forall r. Data r => NExprF r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NExprF r)
$cgunfold :: forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NExprF r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NExprF r -> c (NExprF r)
$cgfoldl :: forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NExprF r -> c (NExprF r)
$cp1Data :: forall r. Data r => Typeable (NExprF r)
Data, a -> NExprF b -> NExprF a
(a -> b) -> NExprF a -> NExprF b
(forall a b. (a -> b) -> NExprF a -> NExprF b)
-> (forall a b. a -> NExprF b -> NExprF a) -> Functor NExprF
forall a b. a -> NExprF b -> NExprF a
forall a b. (a -> b) -> NExprF a -> NExprF b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> NExprF b -> NExprF a
$c<$ :: forall a b. a -> NExprF b -> NExprF a
fmap :: (a -> b) -> NExprF a -> NExprF b
$cfmap :: forall a b. (a -> b) -> NExprF a -> NExprF b
Functor,
            NExprF a -> Bool
(a -> m) -> NExprF a -> m
(a -> b -> b) -> b -> NExprF a -> b
(forall m. Monoid m => NExprF m -> m)
-> (forall m a. Monoid m => (a -> m) -> NExprF a -> m)
-> (forall m a. Monoid m => (a -> m) -> NExprF a -> m)
-> (forall a b. (a -> b -> b) -> b -> NExprF a -> b)
-> (forall a b. (a -> b -> b) -> b -> NExprF a -> b)
-> (forall b a. (b -> a -> b) -> b -> NExprF a -> b)
-> (forall b a. (b -> a -> b) -> b -> NExprF a -> b)
-> (forall a. (a -> a -> a) -> NExprF a -> a)
-> (forall a. (a -> a -> a) -> NExprF a -> a)
-> (forall a. NExprF a -> [a])
-> (forall a. NExprF a -> Bool)
-> (forall a. NExprF a -> Int)
-> (forall a. Eq a => a -> NExprF a -> Bool)
-> (forall a. Ord a => NExprF a -> a)
-> (forall a. Ord a => NExprF a -> a)
-> (forall a. Num a => NExprF a -> a)
-> (forall a. Num a => NExprF a -> a)
-> Foldable NExprF
forall a. Eq a => a -> NExprF a -> Bool
forall a. Num a => NExprF a -> a
forall a. Ord a => NExprF a -> a
forall m. Monoid m => NExprF m -> m
forall a. NExprF a -> Bool
forall a. NExprF a -> Int
forall a. NExprF a -> [a]
forall a. (a -> a -> a) -> NExprF a -> a
forall m a. Monoid m => (a -> m) -> NExprF a -> m
forall b a. (b -> a -> b) -> b -> NExprF a -> b
forall a b. (a -> b -> b) -> b -> NExprF a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: NExprF a -> a
$cproduct :: forall a. Num a => NExprF a -> a
sum :: NExprF a -> a
$csum :: forall a. Num a => NExprF a -> a
minimum :: NExprF a -> a
$cminimum :: forall a. Ord a => NExprF a -> a
maximum :: NExprF a -> a
$cmaximum :: forall a. Ord a => NExprF a -> a
elem :: a -> NExprF a -> Bool
$celem :: forall a. Eq a => a -> NExprF a -> Bool
length :: NExprF a -> Int
$clength :: forall a. NExprF a -> Int
null :: NExprF a -> Bool
$cnull :: forall a. NExprF a -> Bool
toList :: NExprF a -> [a]
$ctoList :: forall a. NExprF a -> [a]
foldl1 :: (a -> a -> a) -> NExprF a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> NExprF a -> a
foldr1 :: (a -> a -> a) -> NExprF a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> NExprF a -> a
foldl' :: (b -> a -> b) -> b -> NExprF a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> NExprF a -> b
foldl :: (b -> a -> b) -> b -> NExprF a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> NExprF a -> b
foldr' :: (a -> b -> b) -> b -> NExprF a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> NExprF a -> b
foldr :: (a -> b -> b) -> b -> NExprF a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> NExprF a -> b
foldMap' :: (a -> m) -> NExprF a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> NExprF a -> m
foldMap :: (a -> m) -> NExprF a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> NExprF a -> m
fold :: NExprF m -> m
$cfold :: forall m. Monoid m => NExprF m -> m
Foldable, Functor NExprF
Foldable NExprF
(Functor NExprF, Foldable NExprF) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> NExprF a -> f (NExprF b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    NExprF (f a) -> f (NExprF a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NExprF a -> m (NExprF b))
-> (forall (m :: * -> *) a.
    Monad m =>
    NExprF (m a) -> m (NExprF a))
-> Traversable NExprF
(a -> f b) -> NExprF a -> f (NExprF b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => NExprF (m a) -> m (NExprF a)
forall (f :: * -> *) a.
Applicative f =>
NExprF (f a) -> f (NExprF a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> NExprF a -> m (NExprF b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NExprF a -> f (NExprF b)
sequence :: NExprF (m a) -> m (NExprF a)
$csequence :: forall (m :: * -> *) a. Monad m => NExprF (m a) -> m (NExprF a)
mapM :: (a -> m b) -> NExprF a -> m (NExprF b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> NExprF a -> m (NExprF b)
sequenceA :: NExprF (f a) -> f (NExprF a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
NExprF (f a) -> f (NExprF a)
traverse :: (a -> f b) -> NExprF a -> f (NExprF b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NExprF a -> f (NExprF b)
$cp2Traversable :: Foldable NExprF
$cp1Traversable :: Functor NExprF
Traversable, Int -> NExprF r -> ShowS
[NExprF r] -> ShowS
NExprF r -> String
(Int -> NExprF r -> ShowS)
-> (NExprF r -> String) -> ([NExprF r] -> ShowS) -> Show (NExprF r)
forall r. Show r => Int -> NExprF r -> ShowS
forall r. Show r => [NExprF r] -> ShowS
forall r. Show r => NExprF r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NExprF r] -> ShowS
$cshowList :: forall r. Show r => [NExprF r] -> ShowS
show :: NExprF r -> String
$cshow :: forall r. Show r => NExprF r -> String
showsPrec :: Int -> NExprF r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> NExprF r -> ShowS
Show, NExprF r -> ()
(NExprF r -> ()) -> NFData (NExprF r)
forall r. NFData r => NExprF r -> ()
forall a. (a -> ()) -> NFData a
rnf :: NExprF r -> ()
$crnf :: forall r. NFData r => NExprF r -> ()
NFData, Int -> NExprF r -> Int
NExprF r -> Int
(Int -> NExprF r -> Int)
-> (NExprF r -> Int) -> Hashable (NExprF r)
forall r. Hashable r => Int -> NExprF r -> Int
forall r. Hashable r => NExprF r -> Int
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NExprF r -> Int
$chash :: forall r. Hashable r => NExprF r -> Int
hashWithSalt :: Int -> NExprF r -> Int
$chashWithSalt :: forall r. Hashable r => Int -> NExprF r -> Int
Hashable)

instance Hashable1 NExprF

instance NFData1 NExprF

#ifdef MIN_VERSION_serialise
instance Serialise r => Serialise (NExprF r)
#endif

-- | We make an `IsString` for expressions, where the string is interpreted
-- as an identifier. This is the most common use-case...
instance IsString NExpr where
  fromString :: String -> NExpr
fromString = NExprF NExpr -> NExpr
forall (f :: * -> *). f (Fix f) -> Fix f
Fix (NExprF NExpr -> NExpr)
-> (String -> NExprF NExpr) -> String -> NExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. VarName -> NExprF NExpr
forall r. VarName -> NExprF r
NSym (VarName -> NExprF NExpr)
-> (String -> VarName) -> String -> NExprF NExpr
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> VarName
forall a. IsString a => String -> a
fromString

instance Lift (Fix NExprF) where
  lift :: NExpr -> Q Exp
lift = (forall b. Data b => b -> Maybe (Q Exp)) -> NExpr -> Q Exp
forall a.
Data a =>
(forall b. Data b => b -> Maybe (Q Exp)) -> a -> Q Exp
dataToExpQ ((forall b. Data b => b -> Maybe (Q Exp)) -> NExpr -> Q Exp)
-> (forall b. Data b => b -> Maybe (Q Exp)) -> NExpr -> Q Exp
forall a b. (a -> b) -> a -> b
$ \b :: b
b ->
    case b -> TypeRep b
forall a. Typeable a => a -> TypeRep a
Reflection.typeOf b
b TypeRep b -> TypeRep VarName -> Maybe (b :~~: VarName)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
`eqTypeRep` Typeable VarName => TypeRep VarName
forall k (a :: k). Typeable a => TypeRep a
Reflection.typeRep @Text of
      Just HRefl -> Q Exp -> Maybe (Q Exp)
forall a. a -> Maybe a
Just [| pack $(liftString $ unpack b) |]
      Nothing    -> Maybe (Q Exp)
forall a. Maybe a
Nothing

-- | The monomorphic expression type is a fixed point of the polymorphic one.
type NExpr = Fix NExprF

#ifdef MIN_VERSION_serialise
instance Serialise NExpr
#endif

-- | A single line of the bindings section of a let expression or of a set.
data Binding r
  = NamedVar !(NAttrPath r) !r !SourcePos
  -- ^ An explicit naming.
  --
  -- > NamedVar (StaticKey "x" :| [StaticKey "y"]) z SourcePos{}  ~  x.y = z;
  | Inherit !(Maybe r) ![NKeyName r] !SourcePos
  -- ^ Using a name already in scope, such as @inherit x;@ which is shorthand
  --   for @x = x;@ or @inherit (x) y;@ which means @y = x.y;@. The
  --   @unsafeGetAttrPos@ for every name so inherited is the position of the
  --   first name, whether that be the first argument to this constructor, or
  --   the first member of the list in the second argument.
  --
  -- > Inherit Nothing  [StaticKey "x"] SourcePos{}               ~  inherit x;
  -- > Inherit (Just x) []              SourcePos{}               ~  inherit (x);
  deriving ((forall x. Binding r -> Rep (Binding r) x)
-> (forall x. Rep (Binding r) x -> Binding r)
-> Generic (Binding r)
forall x. Rep (Binding r) x -> Binding r
forall x. Binding r -> Rep (Binding r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (Binding r) x -> Binding r
forall r x. Binding r -> Rep (Binding r) x
$cto :: forall r x. Rep (Binding r) x -> Binding r
$cfrom :: forall r x. Binding r -> Rep (Binding r) x
Generic, (forall a. Binding a -> Rep1 Binding a)
-> (forall a. Rep1 Binding a -> Binding a) -> Generic1 Binding
forall a. Rep1 Binding a -> Binding a
forall a. Binding a -> Rep1 Binding a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Binding a -> Binding a
$cfrom1 :: forall a. Binding a -> Rep1 Binding a
Generic1, Typeable, Typeable (Binding r)
DataType
Constr
Typeable (Binding r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Binding r -> c (Binding r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Binding r))
-> (Binding r -> Constr)
-> (Binding r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Binding r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Binding r)))
-> ((forall b. Data b => b -> b) -> Binding r -> Binding r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Binding r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Binding r -> r)
-> (forall u. (forall d. Data d => d -> u) -> Binding r -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Binding r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Binding r -> m (Binding r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Binding r -> m (Binding r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Binding r -> m (Binding r))
-> Data (Binding r)
Binding r -> DataType
Binding r -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Binding r))
(forall b. Data b => b -> b) -> Binding r -> Binding r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binding r -> c (Binding r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binding r)
forall r. Data r => Typeable (Binding r)
forall r. Data r => Binding r -> DataType
forall r. Data r => Binding r -> Constr
forall r.
Data r =>
(forall b. Data b => b -> b) -> Binding r -> Binding r
forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> Binding r -> u
forall r u.
Data r =>
(forall d. Data d => d -> u) -> Binding r -> [u]
forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binding r)
forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binding r -> c (Binding r)
forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Binding r))
forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Binding r))
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) -> Binding r -> u
forall u. (forall d. Data d => d -> u) -> Binding r -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binding r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binding r -> c (Binding r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Binding r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Binding r))
$cInherit :: Constr
$cNamedVar :: Constr
$tBinding :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
$cgmapMo :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
gmapMp :: (forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
$cgmapMp :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
gmapM :: (forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
$cgmapM :: forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> Binding r -> m (Binding r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Binding r -> u
$cgmapQi :: forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> Binding r -> u
gmapQ :: (forall d. Data d => d -> u) -> Binding r -> [u]
$cgmapQ :: forall r u.
Data r =>
(forall d. Data d => d -> u) -> Binding r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
$cgmapQr :: forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
$cgmapQl :: forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Binding r -> r
gmapT :: (forall b. Data b => b -> b) -> Binding r -> Binding r
$cgmapT :: forall r.
Data r =>
(forall b. Data b => b -> b) -> Binding r -> Binding r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Binding r))
$cdataCast2 :: forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Binding r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Binding r))
$cdataCast1 :: forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Binding r))
dataTypeOf :: Binding r -> DataType
$cdataTypeOf :: forall r. Data r => Binding r -> DataType
toConstr :: Binding r -> Constr
$ctoConstr :: forall r. Data r => Binding r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binding r)
$cgunfold :: forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Binding r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binding r -> c (Binding r)
$cgfoldl :: forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Binding r -> c (Binding r)
$cp1Data :: forall r. Data r => Typeable (Binding r)
Data, Eq (Binding r)
Eq (Binding r) =>
(Binding r -> Binding r -> Ordering)
-> (Binding r -> Binding r -> Bool)
-> (Binding r -> Binding r -> Bool)
-> (Binding r -> Binding r -> Bool)
-> (Binding r -> Binding r -> Bool)
-> (Binding r -> Binding r -> Binding r)
-> (Binding r -> Binding r -> Binding r)
-> Ord (Binding r)
Binding r -> Binding r -> Bool
Binding r -> Binding r -> Ordering
Binding r -> Binding r -> Binding r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (Binding r)
forall r. Ord r => Binding r -> Binding r -> Bool
forall r. Ord r => Binding r -> Binding r -> Ordering
forall r. Ord r => Binding r -> Binding r -> Binding r
min :: Binding r -> Binding r -> Binding r
$cmin :: forall r. Ord r => Binding r -> Binding r -> Binding r
max :: Binding r -> Binding r -> Binding r
$cmax :: forall r. Ord r => Binding r -> Binding r -> Binding r
>= :: Binding r -> Binding r -> Bool
$c>= :: forall r. Ord r => Binding r -> Binding r -> Bool
> :: Binding r -> Binding r -> Bool
$c> :: forall r. Ord r => Binding r -> Binding r -> Bool
<= :: Binding r -> Binding r -> Bool
$c<= :: forall r. Ord r => Binding r -> Binding r -> Bool
< :: Binding r -> Binding r -> Bool
$c< :: forall r. Ord r => Binding r -> Binding r -> Bool
compare :: Binding r -> Binding r -> Ordering
$ccompare :: forall r. Ord r => Binding r -> Binding r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (Binding r)
Ord, Binding r -> Binding r -> Bool
(Binding r -> Binding r -> Bool)
-> (Binding r -> Binding r -> Bool) -> Eq (Binding r)
forall r. Eq r => Binding r -> Binding r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Binding r -> Binding r -> Bool
$c/= :: forall r. Eq r => Binding r -> Binding r -> Bool
== :: Binding r -> Binding r -> Bool
$c== :: forall r. Eq r => Binding r -> Binding r -> Bool
Eq, a -> Binding b -> Binding a
(a -> b) -> Binding a -> Binding b
(forall a b. (a -> b) -> Binding a -> Binding b)
-> (forall a b. a -> Binding b -> Binding a) -> Functor Binding
forall a b. a -> Binding b -> Binding a
forall a b. (a -> b) -> Binding a -> Binding b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Binding b -> Binding a
$c<$ :: forall a b. a -> Binding b -> Binding a
fmap :: (a -> b) -> Binding a -> Binding b
$cfmap :: forall a b. (a -> b) -> Binding a -> Binding b
Functor,
            Binding a -> Bool
(a -> m) -> Binding a -> m
(a -> b -> b) -> b -> Binding a -> b
(forall m. Monoid m => Binding m -> m)
-> (forall m a. Monoid m => (a -> m) -> Binding a -> m)
-> (forall m a. Monoid m => (a -> m) -> Binding a -> m)
-> (forall a b. (a -> b -> b) -> b -> Binding a -> b)
-> (forall a b. (a -> b -> b) -> b -> Binding a -> b)
-> (forall b a. (b -> a -> b) -> b -> Binding a -> b)
-> (forall b a. (b -> a -> b) -> b -> Binding a -> b)
-> (forall a. (a -> a -> a) -> Binding a -> a)
-> (forall a. (a -> a -> a) -> Binding a -> a)
-> (forall a. Binding a -> [a])
-> (forall a. Binding a -> Bool)
-> (forall a. Binding a -> Int)
-> (forall a. Eq a => a -> Binding a -> Bool)
-> (forall a. Ord a => Binding a -> a)
-> (forall a. Ord a => Binding a -> a)
-> (forall a. Num a => Binding a -> a)
-> (forall a. Num a => Binding a -> a)
-> Foldable Binding
forall a. Eq a => a -> Binding a -> Bool
forall a. Num a => Binding a -> a
forall a. Ord a => Binding a -> a
forall m. Monoid m => Binding m -> m
forall a. Binding a -> Bool
forall a. Binding a -> Int
forall a. Binding a -> [a]
forall a. (a -> a -> a) -> Binding a -> a
forall m a. Monoid m => (a -> m) -> Binding a -> m
forall b a. (b -> a -> b) -> b -> Binding a -> b
forall a b. (a -> b -> b) -> b -> Binding a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Binding a -> a
$cproduct :: forall a. Num a => Binding a -> a
sum :: Binding a -> a
$csum :: forall a. Num a => Binding a -> a
minimum :: Binding a -> a
$cminimum :: forall a. Ord a => Binding a -> a
maximum :: Binding a -> a
$cmaximum :: forall a. Ord a => Binding a -> a
elem :: a -> Binding a -> Bool
$celem :: forall a. Eq a => a -> Binding a -> Bool
length :: Binding a -> Int
$clength :: forall a. Binding a -> Int
null :: Binding a -> Bool
$cnull :: forall a. Binding a -> Bool
toList :: Binding a -> [a]
$ctoList :: forall a. Binding a -> [a]
foldl1 :: (a -> a -> a) -> Binding a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Binding a -> a
foldr1 :: (a -> a -> a) -> Binding a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Binding a -> a
foldl' :: (b -> a -> b) -> b -> Binding a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Binding a -> b
foldl :: (b -> a -> b) -> b -> Binding a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Binding a -> b
foldr' :: (a -> b -> b) -> b -> Binding a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Binding a -> b
foldr :: (a -> b -> b) -> b -> Binding a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Binding a -> b
foldMap' :: (a -> m) -> Binding a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Binding a -> m
foldMap :: (a -> m) -> Binding a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Binding a -> m
fold :: Binding m -> m
$cfold :: forall m. Monoid m => Binding m -> m
Foldable, Functor Binding
Foldable Binding
(Functor Binding, Foldable Binding) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Binding a -> f (Binding b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Binding (f a) -> f (Binding a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Binding a -> m (Binding b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Binding (m a) -> m (Binding a))
-> Traversable Binding
(a -> f b) -> Binding a -> f (Binding b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Binding (m a) -> m (Binding a)
forall (f :: * -> *) a.
Applicative f =>
Binding (f a) -> f (Binding a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binding a -> m (Binding b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binding a -> f (Binding b)
sequence :: Binding (m a) -> m (Binding a)
$csequence :: forall (m :: * -> *) a. Monad m => Binding (m a) -> m (Binding a)
mapM :: (a -> m b) -> Binding a -> m (Binding b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Binding a -> m (Binding b)
sequenceA :: Binding (f a) -> f (Binding a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Binding (f a) -> f (Binding a)
traverse :: (a -> f b) -> Binding a -> f (Binding b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Binding a -> f (Binding b)
$cp2Traversable :: Foldable Binding
$cp1Traversable :: Functor Binding
Traversable, Int -> Binding r -> ShowS
[Binding r] -> ShowS
Binding r -> String
(Int -> Binding r -> ShowS)
-> (Binding r -> String)
-> ([Binding r] -> ShowS)
-> Show (Binding r)
forall r. Show r => Int -> Binding r -> ShowS
forall r. Show r => [Binding r] -> ShowS
forall r. Show r => Binding r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Binding r] -> ShowS
$cshowList :: forall r. Show r => [Binding r] -> ShowS
show :: Binding r -> String
$cshow :: forall r. Show r => Binding r -> String
showsPrec :: Int -> Binding r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> Binding r -> ShowS
Show, Binding r -> ()
(Binding r -> ()) -> NFData (Binding r)
forall r. NFData r => Binding r -> ()
forall a. (a -> ()) -> NFData a
rnf :: Binding r -> ()
$crnf :: forall r. NFData r => Binding r -> ()
NFData, Int -> Binding r -> Int
Binding r -> Int
(Int -> Binding r -> Int)
-> (Binding r -> Int) -> Hashable (Binding r)
forall r. Hashable r => Int -> Binding r -> Int
forall r. Hashable r => Binding r -> Int
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Binding r -> Int
$chash :: forall r. Hashable r => Binding r -> Int
hashWithSalt :: Int -> Binding r -> Int
$chashWithSalt :: forall r. Hashable r => Int -> Binding r -> Int
Hashable)

instance Hashable1 Binding

instance NFData1 Binding

#ifdef MIN_VERSION_serialise
instance Serialise r => Serialise (Binding r)
#endif

-- | @Params@ represents all the ways the formal parameters to a
-- function can be represented.
data Params r
  = Param !VarName
  -- ^ For functions with a single named argument, such as @x: x + 1@.
  --
  -- > Param "x"                                  ~  x
  | ParamSet !(ParamSet r) !Bool !(Maybe VarName)
  -- ^ Explicit parameters (argument must be a set). Might specify a name to
  -- bind to the set in the function body. The bool indicates whether it is
  -- variadic or not.
  --
  -- > ParamSet [("x",Nothing)] False Nothing     ~  { x }
  -- > ParamSet [("x",Just y)]  True  (Just "s")  ~  s@{ x ? y, ... }
  deriving (Eq (Params r)
Eq (Params r) =>
(Params r -> Params r -> Ordering)
-> (Params r -> Params r -> Bool)
-> (Params r -> Params r -> Bool)
-> (Params r -> Params r -> Bool)
-> (Params r -> Params r -> Bool)
-> (Params r -> Params r -> Params r)
-> (Params r -> Params r -> Params r)
-> Ord (Params r)
Params r -> Params r -> Bool
Params r -> Params r -> Ordering
Params r -> Params r -> Params r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (Params r)
forall r. Ord r => Params r -> Params r -> Bool
forall r. Ord r => Params r -> Params r -> Ordering
forall r. Ord r => Params r -> Params r -> Params r
min :: Params r -> Params r -> Params r
$cmin :: forall r. Ord r => Params r -> Params r -> Params r
max :: Params r -> Params r -> Params r
$cmax :: forall r. Ord r => Params r -> Params r -> Params r
>= :: Params r -> Params r -> Bool
$c>= :: forall r. Ord r => Params r -> Params r -> Bool
> :: Params r -> Params r -> Bool
$c> :: forall r. Ord r => Params r -> Params r -> Bool
<= :: Params r -> Params r -> Bool
$c<= :: forall r. Ord r => Params r -> Params r -> Bool
< :: Params r -> Params r -> Bool
$c< :: forall r. Ord r => Params r -> Params r -> Bool
compare :: Params r -> Params r -> Ordering
$ccompare :: forall r. Ord r => Params r -> Params r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (Params r)
Ord, Params r -> Params r -> Bool
(Params r -> Params r -> Bool)
-> (Params r -> Params r -> Bool) -> Eq (Params r)
forall r. Eq r => Params r -> Params r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Params r -> Params r -> Bool
$c/= :: forall r. Eq r => Params r -> Params r -> Bool
== :: Params r -> Params r -> Bool
$c== :: forall r. Eq r => Params r -> Params r -> Bool
Eq, (forall x. Params r -> Rep (Params r) x)
-> (forall x. Rep (Params r) x -> Params r) -> Generic (Params r)
forall x. Rep (Params r) x -> Params r
forall x. Params r -> Rep (Params r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (Params r) x -> Params r
forall r x. Params r -> Rep (Params r) x
$cto :: forall r x. Rep (Params r) x -> Params r
$cfrom :: forall r x. Params r -> Rep (Params r) x
Generic, (forall a. Params a -> Rep1 Params a)
-> (forall a. Rep1 Params a -> Params a) -> Generic1 Params
forall a. Rep1 Params a -> Params a
forall a. Params a -> Rep1 Params a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 Params a -> Params a
$cfrom1 :: forall a. Params a -> Rep1 Params a
Generic1, Typeable, Typeable (Params r)
DataType
Constr
Typeable (Params r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Params r -> c (Params r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Params r))
-> (Params r -> Constr)
-> (Params r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Params r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Params r)))
-> ((forall b. Data b => b -> b) -> Params r -> Params r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Params r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Params r -> r)
-> (forall u. (forall d. Data d => d -> u) -> Params r -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Params r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Params r -> m (Params r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Params r -> m (Params r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Params r -> m (Params r))
-> Data (Params r)
Params r -> DataType
Params r -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Params r))
(forall b. Data b => b -> b) -> Params r -> Params r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Params r -> c (Params r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Params r)
forall r. Data r => Typeable (Params r)
forall r. Data r => Params r -> DataType
forall r. Data r => Params r -> Constr
forall r.
Data r =>
(forall b. Data b => b -> b) -> Params r -> Params r
forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> Params r -> u
forall r u.
Data r =>
(forall d. Data d => d -> u) -> Params r -> [u]
forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Params r)
forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Params r -> c (Params r)
forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Params r))
forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Params r))
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) -> Params r -> u
forall u. (forall d. Data d => d -> u) -> Params r -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Params r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Params r -> c (Params r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Params r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Params r))
$cParamSet :: Constr
$cParam :: Constr
$tParams :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Params r -> m (Params r)
$cgmapMo :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
gmapMp :: (forall d. Data d => d -> m d) -> Params r -> m (Params r)
$cgmapMp :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
gmapM :: (forall d. Data d => d -> m d) -> Params r -> m (Params r)
$cgmapM :: forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> Params r -> m (Params r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Params r -> u
$cgmapQi :: forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> Params r -> u
gmapQ :: (forall d. Data d => d -> u) -> Params r -> [u]
$cgmapQ :: forall r u.
Data r =>
(forall d. Data d => d -> u) -> Params r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
$cgmapQr :: forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
$cgmapQl :: forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Params r -> r
gmapT :: (forall b. Data b => b -> b) -> Params r -> Params r
$cgmapT :: forall r.
Data r =>
(forall b. Data b => b -> b) -> Params r -> Params r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Params r))
$cdataCast2 :: forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Params r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Params r))
$cdataCast1 :: forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Params r))
dataTypeOf :: Params r -> DataType
$cdataTypeOf :: forall r. Data r => Params r -> DataType
toConstr :: Params r -> Constr
$ctoConstr :: forall r. Data r => Params r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Params r)
$cgunfold :: forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Params r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Params r -> c (Params r)
$cgfoldl :: forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Params r -> c (Params r)
$cp1Data :: forall r. Data r => Typeable (Params r)
Data, a -> Params b -> Params a
(a -> b) -> Params a -> Params b
(forall a b. (a -> b) -> Params a -> Params b)
-> (forall a b. a -> Params b -> Params a) -> Functor Params
forall a b. a -> Params b -> Params a
forall a b. (a -> b) -> Params a -> Params b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Params b -> Params a
$c<$ :: forall a b. a -> Params b -> Params a
fmap :: (a -> b) -> Params a -> Params b
$cfmap :: forall a b. (a -> b) -> Params a -> Params b
Functor, Int -> Params r -> ShowS
[Params r] -> ShowS
Params r -> String
(Int -> Params r -> ShowS)
-> (Params r -> String) -> ([Params r] -> ShowS) -> Show (Params r)
forall r. Show r => Int -> Params r -> ShowS
forall r. Show r => [Params r] -> ShowS
forall r. Show r => Params r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Params r] -> ShowS
$cshowList :: forall r. Show r => [Params r] -> ShowS
show :: Params r -> String
$cshow :: forall r. Show r => Params r -> String
showsPrec :: Int -> Params r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> Params r -> ShowS
Show,
            Params a -> Bool
(a -> m) -> Params a -> m
(a -> b -> b) -> b -> Params a -> b
(forall m. Monoid m => Params m -> m)
-> (forall m a. Monoid m => (a -> m) -> Params a -> m)
-> (forall m a. Monoid m => (a -> m) -> Params a -> m)
-> (forall a b. (a -> b -> b) -> b -> Params a -> b)
-> (forall a b. (a -> b -> b) -> b -> Params a -> b)
-> (forall b a. (b -> a -> b) -> b -> Params a -> b)
-> (forall b a. (b -> a -> b) -> b -> Params a -> b)
-> (forall a. (a -> a -> a) -> Params a -> a)
-> (forall a. (a -> a -> a) -> Params a -> a)
-> (forall a. Params a -> [a])
-> (forall a. Params a -> Bool)
-> (forall a. Params a -> Int)
-> (forall a. Eq a => a -> Params a -> Bool)
-> (forall a. Ord a => Params a -> a)
-> (forall a. Ord a => Params a -> a)
-> (forall a. Num a => Params a -> a)
-> (forall a. Num a => Params a -> a)
-> Foldable Params
forall a. Eq a => a -> Params a -> Bool
forall a. Num a => Params a -> a
forall a. Ord a => Params a -> a
forall m. Monoid m => Params m -> m
forall a. Params a -> Bool
forall a. Params a -> Int
forall a. Params a -> [a]
forall a. (a -> a -> a) -> Params a -> a
forall m a. Monoid m => (a -> m) -> Params a -> m
forall b a. (b -> a -> b) -> b -> Params a -> b
forall a b. (a -> b -> b) -> b -> Params a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Params a -> a
$cproduct :: forall a. Num a => Params a -> a
sum :: Params a -> a
$csum :: forall a. Num a => Params a -> a
minimum :: Params a -> a
$cminimum :: forall a. Ord a => Params a -> a
maximum :: Params a -> a
$cmaximum :: forall a. Ord a => Params a -> a
elem :: a -> Params a -> Bool
$celem :: forall a. Eq a => a -> Params a -> Bool
length :: Params a -> Int
$clength :: forall a. Params a -> Int
null :: Params a -> Bool
$cnull :: forall a. Params a -> Bool
toList :: Params a -> [a]
$ctoList :: forall a. Params a -> [a]
foldl1 :: (a -> a -> a) -> Params a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Params a -> a
foldr1 :: (a -> a -> a) -> Params a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Params a -> a
foldl' :: (b -> a -> b) -> b -> Params a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Params a -> b
foldl :: (b -> a -> b) -> b -> Params a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Params a -> b
foldr' :: (a -> b -> b) -> b -> Params a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Params a -> b
foldr :: (a -> b -> b) -> b -> Params a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Params a -> b
foldMap' :: (a -> m) -> Params a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Params a -> m
foldMap :: (a -> m) -> Params a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Params a -> m
fold :: Params m -> m
$cfold :: forall m. Monoid m => Params m -> m
Foldable, Functor Params
Foldable Params
(Functor Params, Foldable Params) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Params a -> f (Params b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Params (f a) -> f (Params a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Params a -> m (Params b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Params (m a) -> m (Params a))
-> Traversable Params
(a -> f b) -> Params a -> f (Params b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Params (m a) -> m (Params a)
forall (f :: * -> *) a.
Applicative f =>
Params (f a) -> f (Params a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Params a -> m (Params b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Params a -> f (Params b)
sequence :: Params (m a) -> m (Params a)
$csequence :: forall (m :: * -> *) a. Monad m => Params (m a) -> m (Params a)
mapM :: (a -> m b) -> Params a -> m (Params b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Params a -> m (Params b)
sequenceA :: Params (f a) -> f (Params a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Params (f a) -> f (Params a)
traverse :: (a -> f b) -> Params a -> f (Params b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Params a -> f (Params b)
$cp2Traversable :: Foldable Params
$cp1Traversable :: Functor Params
Traversable, Params r -> ()
(Params r -> ()) -> NFData (Params r)
forall r. NFData r => Params r -> ()
forall a. (a -> ()) -> NFData a
rnf :: Params r -> ()
$crnf :: forall r. NFData r => Params r -> ()
NFData, Int -> Params r -> Int
Params r -> Int
(Int -> Params r -> Int)
-> (Params r -> Int) -> Hashable (Params r)
forall r. Hashable r => Int -> Params r -> Int
forall r. Hashable r => Params r -> Int
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Params r -> Int
$chash :: forall r. Hashable r => Params r -> Int
hashWithSalt :: Int -> Params r -> Int
$chashWithSalt :: forall r. Hashable r => Int -> Params r -> Int
Hashable)

instance Hashable1 Params

instance NFData1 Params

#ifdef MIN_VERSION_serialise
instance Serialise r => Serialise (Params r)
#endif

-- This uses an association list because nix XML serialization preserves the
-- order of the param set.
type ParamSet r = [(VarName, Maybe r)]

instance IsString (Params r) where
  fromString :: String -> Params r
fromString = VarName -> Params r
forall r. VarName -> Params r
Param (VarName -> Params r) -> (String -> VarName) -> String -> Params r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> VarName
forall a. IsString a => String -> a
fromString

-- | 'Antiquoted' represents an expression that is either
-- antiquoted (surrounded by ${...}) or plain (not antiquoted).
data Antiquoted (v :: *) (r :: *)
  = Plain !v
  | EscapedNewline
  -- ^ 'EscapedNewline' corresponds to the special newline form
  --
  -- > ''\n
  --
  -- in an indented string. It is equivalent to a single newline character:
  --
  -- > ''''\n''  ≡  "\n"
  | Antiquoted !r
  deriving (Eq (Antiquoted v r)
Eq (Antiquoted v r) =>
(Antiquoted v r -> Antiquoted v r -> Ordering)
-> (Antiquoted v r -> Antiquoted v r -> Bool)
-> (Antiquoted v r -> Antiquoted v r -> Bool)
-> (Antiquoted v r -> Antiquoted v r -> Bool)
-> (Antiquoted v r -> Antiquoted v r -> Bool)
-> (Antiquoted v r -> Antiquoted v r -> Antiquoted v r)
-> (Antiquoted v r -> Antiquoted v r -> Antiquoted v r)
-> Ord (Antiquoted v r)
Antiquoted v r -> Antiquoted v r -> Bool
Antiquoted v r -> Antiquoted v r -> Ordering
Antiquoted v r -> Antiquoted v r -> Antiquoted v r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall v r. (Ord v, Ord r) => Eq (Antiquoted v r)
forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Bool
forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Ordering
forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Antiquoted v r
min :: Antiquoted v r -> Antiquoted v r -> Antiquoted v r
$cmin :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Antiquoted v r
max :: Antiquoted v r -> Antiquoted v r -> Antiquoted v r
$cmax :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Antiquoted v r
>= :: Antiquoted v r -> Antiquoted v r -> Bool
$c>= :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Bool
> :: Antiquoted v r -> Antiquoted v r -> Bool
$c> :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Bool
<= :: Antiquoted v r -> Antiquoted v r -> Bool
$c<= :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Bool
< :: Antiquoted v r -> Antiquoted v r -> Bool
$c< :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Bool
compare :: Antiquoted v r -> Antiquoted v r -> Ordering
$ccompare :: forall v r.
(Ord v, Ord r) =>
Antiquoted v r -> Antiquoted v r -> Ordering
$cp1Ord :: forall v r. (Ord v, Ord r) => Eq (Antiquoted v r)
Ord, Antiquoted v r -> Antiquoted v r -> Bool
(Antiquoted v r -> Antiquoted v r -> Bool)
-> (Antiquoted v r -> Antiquoted v r -> Bool)
-> Eq (Antiquoted v r)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall v r.
(Eq v, Eq r) =>
Antiquoted v r -> Antiquoted v r -> Bool
/= :: Antiquoted v r -> Antiquoted v r -> Bool
$c/= :: forall v r.
(Eq v, Eq r) =>
Antiquoted v r -> Antiquoted v r -> Bool
== :: Antiquoted v r -> Antiquoted v r -> Bool
$c== :: forall v r.
(Eq v, Eq r) =>
Antiquoted v r -> Antiquoted v r -> Bool
Eq, (forall x. Antiquoted v r -> Rep (Antiquoted v r) x)
-> (forall x. Rep (Antiquoted v r) x -> Antiquoted v r)
-> Generic (Antiquoted v r)
forall x. Rep (Antiquoted v r) x -> Antiquoted v r
forall x. Antiquoted v r -> Rep (Antiquoted v r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall v r x. Rep (Antiquoted v r) x -> Antiquoted v r
forall v r x. Antiquoted v r -> Rep (Antiquoted v r) x
$cto :: forall v r x. Rep (Antiquoted v r) x -> Antiquoted v r
$cfrom :: forall v r x. Antiquoted v r -> Rep (Antiquoted v r) x
Generic, (forall a. Antiquoted v a -> Rep1 (Antiquoted v) a)
-> (forall a. Rep1 (Antiquoted v) a -> Antiquoted v a)
-> Generic1 (Antiquoted v)
forall a. Rep1 (Antiquoted v) a -> Antiquoted v a
forall a. Antiquoted v a -> Rep1 (Antiquoted v) a
forall v a. Rep1 (Antiquoted v) a -> Antiquoted v a
forall v a. Antiquoted v a -> Rep1 (Antiquoted v) a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall v a. Rep1 (Antiquoted v) a -> Antiquoted v a
$cfrom1 :: forall v a. Antiquoted v a -> Rep1 (Antiquoted v) a
Generic1, Typeable, Typeable (Antiquoted v r)
DataType
Constr
Typeable (Antiquoted v r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Antiquoted v r))
-> (Antiquoted v r -> Constr)
-> (Antiquoted v r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Antiquoted v r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Antiquoted v r)))
-> ((forall b. Data b => b -> b)
    -> Antiquoted v r -> Antiquoted v r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> Antiquoted v r -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Antiquoted v r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> Antiquoted v r -> m (Antiquoted v r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> Antiquoted v r -> m (Antiquoted v r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> Antiquoted v r -> m (Antiquoted v r))
-> Data (Antiquoted v r)
Antiquoted v r -> DataType
Antiquoted v r -> Constr
(forall b. Data b => b -> b) -> Antiquoted v r -> Antiquoted v r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Antiquoted v r)
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Antiquoted v r))
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) -> Antiquoted v r -> u
forall u. (forall d. Data d => d -> u) -> Antiquoted v r -> [u]
forall v r. (Data v, Data r) => Typeable (Antiquoted v r)
forall v r. (Data v, Data r) => Antiquoted v r -> DataType
forall v r. (Data v, Data r) => Antiquoted v r -> Constr
forall v r.
(Data v, Data r) =>
(forall b. Data b => b -> b) -> Antiquoted v r -> Antiquoted v r
forall v r u.
(Data v, Data r) =>
Int -> (forall d. Data d => d -> u) -> Antiquoted v r -> u
forall v r u.
(Data v, Data r) =>
(forall d. Data d => d -> u) -> Antiquoted v r -> [u]
forall v r r r'.
(Data v, Data r) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
forall v r r r'.
(Data v, Data r) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
forall v r (m :: * -> *).
(Data v, Data r, Monad m) =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
forall v r (m :: * -> *).
(Data v, Data r, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
forall v r (c :: * -> *).
(Data v, Data r) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Antiquoted v r)
forall v r (c :: * -> *).
(Data v, Data r) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r)
forall v r (t :: * -> *) (c :: * -> *).
(Data v, Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Antiquoted v r))
forall v r (t :: * -> * -> *) (c :: * -> *).
(Data v, Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Antiquoted v r))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Antiquoted v r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Antiquoted v r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Antiquoted v r))
$cAntiquoted :: Constr
$cEscapedNewline :: Constr
$cPlain :: Constr
$tAntiquoted :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
$cgmapMo :: forall v r (m :: * -> *).
(Data v, Data r, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
gmapMp :: (forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
$cgmapMp :: forall v r (m :: * -> *).
(Data v, Data r, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
gmapM :: (forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
$cgmapM :: forall v r (m :: * -> *).
(Data v, Data r, Monad m) =>
(forall d. Data d => d -> m d)
-> Antiquoted v r -> m (Antiquoted v r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Antiquoted v r -> u
$cgmapQi :: forall v r u.
(Data v, Data r) =>
Int -> (forall d. Data d => d -> u) -> Antiquoted v r -> u
gmapQ :: (forall d. Data d => d -> u) -> Antiquoted v r -> [u]
$cgmapQ :: forall v r u.
(Data v, Data r) =>
(forall d. Data d => d -> u) -> Antiquoted v r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
$cgmapQr :: forall v r r r'.
(Data v, Data r) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
$cgmapQl :: forall v r r r'.
(Data v, Data r) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Antiquoted v r -> r
gmapT :: (forall b. Data b => b -> b) -> Antiquoted v r -> Antiquoted v r
$cgmapT :: forall v r.
(Data v, Data r) =>
(forall b. Data b => b -> b) -> Antiquoted v r -> Antiquoted v r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Antiquoted v r))
$cdataCast2 :: forall v r (t :: * -> * -> *) (c :: * -> *).
(Data v, Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Antiquoted v r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Antiquoted v r))
$cdataCast1 :: forall v r (t :: * -> *) (c :: * -> *).
(Data v, Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Antiquoted v r))
dataTypeOf :: Antiquoted v r -> DataType
$cdataTypeOf :: forall v r. (Data v, Data r) => Antiquoted v r -> DataType
toConstr :: Antiquoted v r -> Constr
$ctoConstr :: forall v r. (Data v, Data r) => Antiquoted v r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Antiquoted v r)
$cgunfold :: forall v r (c :: * -> *).
(Data v, Data r) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Antiquoted v r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r)
$cgfoldl :: forall v r (c :: * -> *).
(Data v, Data r) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Antiquoted v r -> c (Antiquoted v r)
$cp1Data :: forall v r. (Data v, Data r) => Typeable (Antiquoted v r)
Data, a -> Antiquoted v b -> Antiquoted v a
(a -> b) -> Antiquoted v a -> Antiquoted v b
(forall a b. (a -> b) -> Antiquoted v a -> Antiquoted v b)
-> (forall a b. a -> Antiquoted v b -> Antiquoted v a)
-> Functor (Antiquoted v)
forall a b. a -> Antiquoted v b -> Antiquoted v a
forall a b. (a -> b) -> Antiquoted v a -> Antiquoted v b
forall v a b. a -> Antiquoted v b -> Antiquoted v a
forall v a b. (a -> b) -> Antiquoted v a -> Antiquoted v b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Antiquoted v b -> Antiquoted v a
$c<$ :: forall v a b. a -> Antiquoted v b -> Antiquoted v a
fmap :: (a -> b) -> Antiquoted v a -> Antiquoted v b
$cfmap :: forall v a b. (a -> b) -> Antiquoted v a -> Antiquoted v b
Functor, Antiquoted v a -> Bool
(a -> m) -> Antiquoted v a -> m
(a -> b -> b) -> b -> Antiquoted v a -> b
(forall m. Monoid m => Antiquoted v m -> m)
-> (forall m a. Monoid m => (a -> m) -> Antiquoted v a -> m)
-> (forall m a. Monoid m => (a -> m) -> Antiquoted v a -> m)
-> (forall a b. (a -> b -> b) -> b -> Antiquoted v a -> b)
-> (forall a b. (a -> b -> b) -> b -> Antiquoted v a -> b)
-> (forall b a. (b -> a -> b) -> b -> Antiquoted v a -> b)
-> (forall b a. (b -> a -> b) -> b -> Antiquoted v a -> b)
-> (forall a. (a -> a -> a) -> Antiquoted v a -> a)
-> (forall a. (a -> a -> a) -> Antiquoted v a -> a)
-> (forall a. Antiquoted v a -> [a])
-> (forall a. Antiquoted v a -> Bool)
-> (forall a. Antiquoted v a -> Int)
-> (forall a. Eq a => a -> Antiquoted v a -> Bool)
-> (forall a. Ord a => Antiquoted v a -> a)
-> (forall a. Ord a => Antiquoted v a -> a)
-> (forall a. Num a => Antiquoted v a -> a)
-> (forall a. Num a => Antiquoted v a -> a)
-> Foldable (Antiquoted v)
forall a. Eq a => a -> Antiquoted v a -> Bool
forall a. Num a => Antiquoted v a -> a
forall a. Ord a => Antiquoted v a -> a
forall m. Monoid m => Antiquoted v m -> m
forall a. Antiquoted v a -> Bool
forall a. Antiquoted v a -> Int
forall a. Antiquoted v a -> [a]
forall a. (a -> a -> a) -> Antiquoted v a -> a
forall v a. Eq a => a -> Antiquoted v a -> Bool
forall v a. Num a => Antiquoted v a -> a
forall v a. Ord a => Antiquoted v a -> a
forall m a. Monoid m => (a -> m) -> Antiquoted v a -> m
forall v m. Monoid m => Antiquoted v m -> m
forall v a. Antiquoted v a -> Bool
forall v a. Antiquoted v a -> Int
forall v a. Antiquoted v a -> [a]
forall b a. (b -> a -> b) -> b -> Antiquoted v a -> b
forall a b. (a -> b -> b) -> b -> Antiquoted v a -> b
forall v a. (a -> a -> a) -> Antiquoted v a -> a
forall v m a. Monoid m => (a -> m) -> Antiquoted v a -> m
forall v b a. (b -> a -> b) -> b -> Antiquoted v a -> b
forall v a b. (a -> b -> b) -> b -> Antiquoted v a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Antiquoted v a -> a
$cproduct :: forall v a. Num a => Antiquoted v a -> a
sum :: Antiquoted v a -> a
$csum :: forall v a. Num a => Antiquoted v a -> a
minimum :: Antiquoted v a -> a
$cminimum :: forall v a. Ord a => Antiquoted v a -> a
maximum :: Antiquoted v a -> a
$cmaximum :: forall v a. Ord a => Antiquoted v a -> a
elem :: a -> Antiquoted v a -> Bool
$celem :: forall v a. Eq a => a -> Antiquoted v a -> Bool
length :: Antiquoted v a -> Int
$clength :: forall v a. Antiquoted v a -> Int
null :: Antiquoted v a -> Bool
$cnull :: forall v a. Antiquoted v a -> Bool
toList :: Antiquoted v a -> [a]
$ctoList :: forall v a. Antiquoted v a -> [a]
foldl1 :: (a -> a -> a) -> Antiquoted v a -> a
$cfoldl1 :: forall v a. (a -> a -> a) -> Antiquoted v a -> a
foldr1 :: (a -> a -> a) -> Antiquoted v a -> a
$cfoldr1 :: forall v a. (a -> a -> a) -> Antiquoted v a -> a
foldl' :: (b -> a -> b) -> b -> Antiquoted v a -> b
$cfoldl' :: forall v b a. (b -> a -> b) -> b -> Antiquoted v a -> b
foldl :: (b -> a -> b) -> b -> Antiquoted v a -> b
$cfoldl :: forall v b a. (b -> a -> b) -> b -> Antiquoted v a -> b
foldr' :: (a -> b -> b) -> b -> Antiquoted v a -> b
$cfoldr' :: forall v a b. (a -> b -> b) -> b -> Antiquoted v a -> b
foldr :: (a -> b -> b) -> b -> Antiquoted v a -> b
$cfoldr :: forall v a b. (a -> b -> b) -> b -> Antiquoted v a -> b
foldMap' :: (a -> m) -> Antiquoted v a -> m
$cfoldMap' :: forall v m a. Monoid m => (a -> m) -> Antiquoted v a -> m
foldMap :: (a -> m) -> Antiquoted v a -> m
$cfoldMap :: forall v m a. Monoid m => (a -> m) -> Antiquoted v a -> m
fold :: Antiquoted v m -> m
$cfold :: forall v m. Monoid m => Antiquoted v m -> m
Foldable,
            Functor (Antiquoted v)
Foldable (Antiquoted v)
(Functor (Antiquoted v), Foldable (Antiquoted v)) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> Antiquoted v a -> f (Antiquoted v b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Antiquoted v (f a) -> f (Antiquoted v a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Antiquoted v a -> m (Antiquoted v b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Antiquoted v (m a) -> m (Antiquoted v a))
-> Traversable (Antiquoted v)
(a -> f b) -> Antiquoted v a -> f (Antiquoted v b)
forall v. Functor (Antiquoted v)
forall v. Foldable (Antiquoted v)
forall v (m :: * -> *) a.
Monad m =>
Antiquoted v (m a) -> m (Antiquoted v a)
forall v (f :: * -> *) a.
Applicative f =>
Antiquoted v (f a) -> f (Antiquoted v a)
forall v (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Antiquoted v a -> m (Antiquoted v b)
forall v (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Antiquoted v a -> f (Antiquoted v b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Antiquoted v (m a) -> m (Antiquoted v a)
forall (f :: * -> *) a.
Applicative f =>
Antiquoted v (f a) -> f (Antiquoted v a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Antiquoted v a -> m (Antiquoted v b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Antiquoted v a -> f (Antiquoted v b)
sequence :: Antiquoted v (m a) -> m (Antiquoted v a)
$csequence :: forall v (m :: * -> *) a.
Monad m =>
Antiquoted v (m a) -> m (Antiquoted v a)
mapM :: (a -> m b) -> Antiquoted v a -> m (Antiquoted v b)
$cmapM :: forall v (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Antiquoted v a -> m (Antiquoted v b)
sequenceA :: Antiquoted v (f a) -> f (Antiquoted v a)
$csequenceA :: forall v (f :: * -> *) a.
Applicative f =>
Antiquoted v (f a) -> f (Antiquoted v a)
traverse :: (a -> f b) -> Antiquoted v a -> f (Antiquoted v b)
$ctraverse :: forall v (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Antiquoted v a -> f (Antiquoted v b)
$cp2Traversable :: forall v. Foldable (Antiquoted v)
$cp1Traversable :: forall v. Functor (Antiquoted v)
Traversable, Int -> Antiquoted v r -> ShowS
[Antiquoted v r] -> ShowS
Antiquoted v r -> String
(Int -> Antiquoted v r -> ShowS)
-> (Antiquoted v r -> String)
-> ([Antiquoted v r] -> ShowS)
-> Show (Antiquoted v r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall v r. (Show v, Show r) => Int -> Antiquoted v r -> ShowS
forall v r. (Show v, Show r) => [Antiquoted v r] -> ShowS
forall v r. (Show v, Show r) => Antiquoted v r -> String
showList :: [Antiquoted v r] -> ShowS
$cshowList :: forall v r. (Show v, Show r) => [Antiquoted v r] -> ShowS
show :: Antiquoted v r -> String
$cshow :: forall v r. (Show v, Show r) => Antiquoted v r -> String
showsPrec :: Int -> Antiquoted v r -> ShowS
$cshowsPrec :: forall v r. (Show v, Show r) => Int -> Antiquoted v r -> ShowS
Show, ReadPrec [Antiquoted v r]
ReadPrec (Antiquoted v r)
Int -> ReadS (Antiquoted v r)
ReadS [Antiquoted v r]
(Int -> ReadS (Antiquoted v r))
-> ReadS [Antiquoted v r]
-> ReadPrec (Antiquoted v r)
-> ReadPrec [Antiquoted v r]
-> Read (Antiquoted v r)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall v r. (Read v, Read r) => ReadPrec [Antiquoted v r]
forall v r. (Read v, Read r) => ReadPrec (Antiquoted v r)
forall v r. (Read v, Read r) => Int -> ReadS (Antiquoted v r)
forall v r. (Read v, Read r) => ReadS [Antiquoted v r]
readListPrec :: ReadPrec [Antiquoted v r]
$creadListPrec :: forall v r. (Read v, Read r) => ReadPrec [Antiquoted v r]
readPrec :: ReadPrec (Antiquoted v r)
$creadPrec :: forall v r. (Read v, Read r) => ReadPrec (Antiquoted v r)
readList :: ReadS [Antiquoted v r]
$creadList :: forall v r. (Read v, Read r) => ReadS [Antiquoted v r]
readsPrec :: Int -> ReadS (Antiquoted v r)
$creadsPrec :: forall v r. (Read v, Read r) => Int -> ReadS (Antiquoted v r)
Read, Antiquoted v r -> ()
(Antiquoted v r -> ()) -> NFData (Antiquoted v r)
forall a. (a -> ()) -> NFData a
forall v r. (NFData v, NFData r) => Antiquoted v r -> ()
rnf :: Antiquoted v r -> ()
$crnf :: forall v r. (NFData v, NFData r) => Antiquoted v r -> ()
NFData, Int -> Antiquoted v r -> Int
Antiquoted v r -> Int
(Int -> Antiquoted v r -> Int)
-> (Antiquoted v r -> Int) -> Hashable (Antiquoted v r)
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
forall v r.
(Hashable v, Hashable r) =>
Int -> Antiquoted v r -> Int
forall v r. (Hashable v, Hashable r) => Antiquoted v r -> Int
hash :: Antiquoted v r -> Int
$chash :: forall v r. (Hashable v, Hashable r) => Antiquoted v r -> Int
hashWithSalt :: Int -> Antiquoted v r -> Int
$chashWithSalt :: forall v r.
(Hashable v, Hashable r) =>
Int -> Antiquoted v r -> Int
Hashable)

instance Hashable v => Hashable1 (Antiquoted v)

instance Hashable2 Antiquoted where
  liftHashWithSalt2 :: (Int -> a -> Int)
-> (Int -> b -> Int) -> Int -> Antiquoted a b -> Int
liftHashWithSalt2 ha :: Int -> a -> Int
ha _ salt :: Int
salt (Plain a :: a
a) = Int -> a -> Int
ha (Int
salt Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (0 :: Int)) a
a
  liftHashWithSalt2 _ _ salt :: Int
salt EscapedNewline = Int
salt Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (1 :: Int)
  liftHashWithSalt2 _ hb :: Int -> b -> Int
hb salt :: Int
salt (Antiquoted b :: b
b) =
    Int -> b -> Int
hb (Int
salt Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (2 :: Int)) b
b

instance NFData v => NFData1 (Antiquoted v)

#ifdef MIN_VERSION_serialise
instance (Serialise v, Serialise r) => Serialise (Antiquoted v r)
#endif

-- | An 'NString' is a list of things that are either a plain string
-- or an antiquoted expression. After the antiquotes have been evaluated,
-- the final string is constructed by concatenating all the parts.
data NString r
  = DoubleQuoted ![Antiquoted Text r]
  -- ^ Strings wrapped with double-quotes (") can contain literal newline
  -- characters, but the newlines are preserved and no indentation is stripped.
  --
  -- > DoubleQuoted [Plain "x",Antiquoted y]   ~  "x${y}"
  | Indented !Int ![Antiquoted Text r]
  -- ^ Strings wrapped with two single quotes ('') can contain newlines, and
  --   their indentation will be stripped, but the amount stripped is
  --   remembered.
  --
  -- > Indented 1 [Plain "x"]                  ~  '' x''
  -- >
  -- > Indented 0 [EscapedNewline]             ~  ''''\n''
  -- >
  -- > Indented 0 [Plain "x\n ",Antiquoted y]  ~  ''
  -- >                                            x
  -- >                                             ${y}''
  deriving (NString r -> NString r -> Bool
(NString r -> NString r -> Bool)
-> (NString r -> NString r -> Bool) -> Eq (NString r)
forall r. Eq r => NString r -> NString r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NString r -> NString r -> Bool
$c/= :: forall r. Eq r => NString r -> NString r -> Bool
== :: NString r -> NString r -> Bool
$c== :: forall r. Eq r => NString r -> NString r -> Bool
Eq, Eq (NString r)
Eq (NString r) =>
(NString r -> NString r -> Ordering)
-> (NString r -> NString r -> Bool)
-> (NString r -> NString r -> Bool)
-> (NString r -> NString r -> Bool)
-> (NString r -> NString r -> Bool)
-> (NString r -> NString r -> NString r)
-> (NString r -> NString r -> NString r)
-> Ord (NString r)
NString r -> NString r -> Bool
NString r -> NString r -> Ordering
NString r -> NString r -> NString r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (NString r)
forall r. Ord r => NString r -> NString r -> Bool
forall r. Ord r => NString r -> NString r -> Ordering
forall r. Ord r => NString r -> NString r -> NString r
min :: NString r -> NString r -> NString r
$cmin :: forall r. Ord r => NString r -> NString r -> NString r
max :: NString r -> NString r -> NString r
$cmax :: forall r. Ord r => NString r -> NString r -> NString r
>= :: NString r -> NString r -> Bool
$c>= :: forall r. Ord r => NString r -> NString r -> Bool
> :: NString r -> NString r -> Bool
$c> :: forall r. Ord r => NString r -> NString r -> Bool
<= :: NString r -> NString r -> Bool
$c<= :: forall r. Ord r => NString r -> NString r -> Bool
< :: NString r -> NString r -> Bool
$c< :: forall r. Ord r => NString r -> NString r -> Bool
compare :: NString r -> NString r -> Ordering
$ccompare :: forall r. Ord r => NString r -> NString r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (NString r)
Ord, (forall x. NString r -> Rep (NString r) x)
-> (forall x. Rep (NString r) x -> NString r)
-> Generic (NString r)
forall x. Rep (NString r) x -> NString r
forall x. NString r -> Rep (NString r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (NString r) x -> NString r
forall r x. NString r -> Rep (NString r) x
$cto :: forall r x. Rep (NString r) x -> NString r
$cfrom :: forall r x. NString r -> Rep (NString r) x
Generic, (forall a. NString a -> Rep1 NString a)
-> (forall a. Rep1 NString a -> NString a) -> Generic1 NString
forall a. Rep1 NString a -> NString a
forall a. NString a -> Rep1 NString a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 NString a -> NString a
$cfrom1 :: forall a. NString a -> Rep1 NString a
Generic1, Typeable, Typeable (NString r)
DataType
Constr
Typeable (NString r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NString r -> c (NString r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (NString r))
-> (NString r -> Constr)
-> (NString r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (NString r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (NString r)))
-> ((forall b. Data b => b -> b) -> NString r -> NString r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NString r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NString r -> r)
-> (forall u. (forall d. Data d => d -> u) -> NString r -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NString r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NString r -> m (NString r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NString r -> m (NString r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NString r -> m (NString r))
-> Data (NString r)
NString r -> DataType
NString r -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (NString r))
(forall b. Data b => b -> b) -> NString r -> NString r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NString r -> c (NString r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NString r)
forall r. Data r => Typeable (NString r)
forall r. Data r => NString r -> DataType
forall r. Data r => NString r -> Constr
forall r.
Data r =>
(forall b. Data b => b -> b) -> NString r -> NString r
forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NString r -> u
forall r u.
Data r =>
(forall d. Data d => d -> u) -> NString r -> [u]
forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NString r)
forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NString r -> c (NString r)
forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NString r))
forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NString r))
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) -> NString r -> u
forall u. (forall d. Data d => d -> u) -> NString r -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NString r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NString r -> c (NString r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (NString r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NString r))
$cIndented :: Constr
$cDoubleQuoted :: Constr
$tNString :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NString r -> m (NString r)
$cgmapMo :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
gmapMp :: (forall d. Data d => d -> m d) -> NString r -> m (NString r)
$cgmapMp :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
gmapM :: (forall d. Data d => d -> m d) -> NString r -> m (NString r)
$cgmapM :: forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NString r -> m (NString r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> NString r -> u
$cgmapQi :: forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NString r -> u
gmapQ :: (forall d. Data d => d -> u) -> NString r -> [u]
$cgmapQ :: forall r u.
Data r =>
(forall d. Data d => d -> u) -> NString r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
$cgmapQr :: forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
$cgmapQl :: forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NString r -> r
gmapT :: (forall b. Data b => b -> b) -> NString r -> NString r
$cgmapT :: forall r.
Data r =>
(forall b. Data b => b -> b) -> NString r -> NString r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NString r))
$cdataCast2 :: forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NString r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (NString r))
$cdataCast1 :: forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NString r))
dataTypeOf :: NString r -> DataType
$cdataTypeOf :: forall r. Data r => NString r -> DataType
toConstr :: NString r -> Constr
$ctoConstr :: forall r. Data r => NString r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NString r)
$cgunfold :: forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NString r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NString r -> c (NString r)
$cgfoldl :: forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NString r -> c (NString r)
$cp1Data :: forall r. Data r => Typeable (NString r)
Data, a -> NString b -> NString a
(a -> b) -> NString a -> NString b
(forall a b. (a -> b) -> NString a -> NString b)
-> (forall a b. a -> NString b -> NString a) -> Functor NString
forall a b. a -> NString b -> NString a
forall a b. (a -> b) -> NString a -> NString b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> NString b -> NString a
$c<$ :: forall a b. a -> NString b -> NString a
fmap :: (a -> b) -> NString a -> NString b
$cfmap :: forall a b. (a -> b) -> NString a -> NString b
Functor, NString a -> Bool
(a -> m) -> NString a -> m
(a -> b -> b) -> b -> NString a -> b
(forall m. Monoid m => NString m -> m)
-> (forall m a. Monoid m => (a -> m) -> NString a -> m)
-> (forall m a. Monoid m => (a -> m) -> NString a -> m)
-> (forall a b. (a -> b -> b) -> b -> NString a -> b)
-> (forall a b. (a -> b -> b) -> b -> NString a -> b)
-> (forall b a. (b -> a -> b) -> b -> NString a -> b)
-> (forall b a. (b -> a -> b) -> b -> NString a -> b)
-> (forall a. (a -> a -> a) -> NString a -> a)
-> (forall a. (a -> a -> a) -> NString a -> a)
-> (forall a. NString a -> [a])
-> (forall a. NString a -> Bool)
-> (forall a. NString a -> Int)
-> (forall a. Eq a => a -> NString a -> Bool)
-> (forall a. Ord a => NString a -> a)
-> (forall a. Ord a => NString a -> a)
-> (forall a. Num a => NString a -> a)
-> (forall a. Num a => NString a -> a)
-> Foldable NString
forall a. Eq a => a -> NString a -> Bool
forall a. Num a => NString a -> a
forall a. Ord a => NString a -> a
forall m. Monoid m => NString m -> m
forall a. NString a -> Bool
forall a. NString a -> Int
forall a. NString a -> [a]
forall a. (a -> a -> a) -> NString a -> a
forall m a. Monoid m => (a -> m) -> NString a -> m
forall b a. (b -> a -> b) -> b -> NString a -> b
forall a b. (a -> b -> b) -> b -> NString a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: NString a -> a
$cproduct :: forall a. Num a => NString a -> a
sum :: NString a -> a
$csum :: forall a. Num a => NString a -> a
minimum :: NString a -> a
$cminimum :: forall a. Ord a => NString a -> a
maximum :: NString a -> a
$cmaximum :: forall a. Ord a => NString a -> a
elem :: a -> NString a -> Bool
$celem :: forall a. Eq a => a -> NString a -> Bool
length :: NString a -> Int
$clength :: forall a. NString a -> Int
null :: NString a -> Bool
$cnull :: forall a. NString a -> Bool
toList :: NString a -> [a]
$ctoList :: forall a. NString a -> [a]
foldl1 :: (a -> a -> a) -> NString a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> NString a -> a
foldr1 :: (a -> a -> a) -> NString a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> NString a -> a
foldl' :: (b -> a -> b) -> b -> NString a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> NString a -> b
foldl :: (b -> a -> b) -> b -> NString a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> NString a -> b
foldr' :: (a -> b -> b) -> b -> NString a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> NString a -> b
foldr :: (a -> b -> b) -> b -> NString a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> NString a -> b
foldMap' :: (a -> m) -> NString a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> NString a -> m
foldMap :: (a -> m) -> NString a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> NString a -> m
fold :: NString m -> m
$cfold :: forall m. Monoid m => NString m -> m
Foldable,
            Functor NString
Foldable NString
(Functor NString, Foldable NString) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> NString a -> f (NString b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    NString (f a) -> f (NString a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> NString a -> m (NString b))
-> (forall (m :: * -> *) a.
    Monad m =>
    NString (m a) -> m (NString a))
-> Traversable NString
(a -> f b) -> NString a -> f (NString b)
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
 Applicative f =>
 (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => NString (m a) -> m (NString a)
forall (f :: * -> *) a.
Applicative f =>
NString (f a) -> f (NString a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> NString a -> m (NString b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NString a -> f (NString b)
sequence :: NString (m a) -> m (NString a)
$csequence :: forall (m :: * -> *) a. Monad m => NString (m a) -> m (NString a)
mapM :: (a -> m b) -> NString a -> m (NString b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> NString a -> m (NString b)
sequenceA :: NString (f a) -> f (NString a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
NString (f a) -> f (NString a)
traverse :: (a -> f b) -> NString a -> f (NString b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NString a -> f (NString b)
$cp2Traversable :: Foldable NString
$cp1Traversable :: Functor NString
Traversable, Int -> NString r -> ShowS
[NString r] -> ShowS
NString r -> String
(Int -> NString r -> ShowS)
-> (NString r -> String)
-> ([NString r] -> ShowS)
-> Show (NString r)
forall r. Show r => Int -> NString r -> ShowS
forall r. Show r => [NString r] -> ShowS
forall r. Show r => NString r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NString r] -> ShowS
$cshowList :: forall r. Show r => [NString r] -> ShowS
show :: NString r -> String
$cshow :: forall r. Show r => NString r -> String
showsPrec :: Int -> NString r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> NString r -> ShowS
Show, ReadPrec [NString r]
ReadPrec (NString r)
Int -> ReadS (NString r)
ReadS [NString r]
(Int -> ReadS (NString r))
-> ReadS [NString r]
-> ReadPrec (NString r)
-> ReadPrec [NString r]
-> Read (NString r)
forall r. Read r => ReadPrec [NString r]
forall r. Read r => ReadPrec (NString r)
forall r. Read r => Int -> ReadS (NString r)
forall r. Read r => ReadS [NString r]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NString r]
$creadListPrec :: forall r. Read r => ReadPrec [NString r]
readPrec :: ReadPrec (NString r)
$creadPrec :: forall r. Read r => ReadPrec (NString r)
readList :: ReadS [NString r]
$creadList :: forall r. Read r => ReadS [NString r]
readsPrec :: Int -> ReadS (NString r)
$creadsPrec :: forall r. Read r => Int -> ReadS (NString r)
Read, NString r -> ()
(NString r -> ()) -> NFData (NString r)
forall r. NFData r => NString r -> ()
forall a. (a -> ()) -> NFData a
rnf :: NString r -> ()
$crnf :: forall r. NFData r => NString r -> ()
NFData, Int -> NString r -> Int
NString r -> Int
(Int -> NString r -> Int)
-> (NString r -> Int) -> Hashable (NString r)
forall r. Hashable r => Int -> NString r -> Int
forall r. Hashable r => NString r -> Int
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NString r -> Int
$chash :: forall r. Hashable r => NString r -> Int
hashWithSalt :: Int -> NString r -> Int
$chashWithSalt :: forall r. Hashable r => Int -> NString r -> Int
Hashable)

instance Hashable1 NString

instance NFData1 NString

#ifdef MIN_VERSION_serialise
instance Serialise r => Serialise (NString r)
#endif

-- | For the the 'IsString' instance, we use a plain doublequoted string.
instance IsString (NString r) where
  fromString :: String -> NString r
fromString ""     = [Antiquoted VarName r] -> NString r
forall r. [Antiquoted VarName r] -> NString r
DoubleQuoted []
  fromString string :: String
string = [Antiquoted VarName r] -> NString r
forall r. [Antiquoted VarName r] -> NString r
DoubleQuoted [VarName -> Antiquoted VarName r
forall v r. v -> Antiquoted v r
Plain (VarName -> Antiquoted VarName r)
-> VarName -> Antiquoted VarName r
forall a b. (a -> b) -> a -> b
$ String -> VarName
pack String
string]

-- | A 'KeyName' is something that can appear on the left side of an
-- equals sign. For example, @a@ is a 'KeyName' in @{ a = 3; }@, @let a = 3;
-- in ...@, @{}.a@ or @{} ? a@.
--
-- Nix supports both static keynames (just an identifier) and dynamic
-- identifiers. Dynamic identifiers can be either a string (e.g.:
-- @{ "a" = 3; }@) or an antiquotation (e.g.: @let a = "example";
-- in { ${a} = 3; }.example@).
--
-- Note: There are some places where a dynamic keyname is not allowed.
-- In particular, those include:
--
--   * The RHS of a @binding@ inside @let@: @let ${"a"} = 3; in ...@
--     produces a syntax error.
--   * The attribute names of an 'inherit': @inherit ${"a"};@ is forbidden.
--
-- Note: In Nix, a simple string without antiquotes such as @"foo"@ is
-- allowed even if the context requires a static keyname, but the
-- parser still considers it a 'DynamicKey' for simplicity.
data NKeyName r
  = DynamicKey !(Antiquoted (NString r) r)
  -- ^
  -- > DynamicKey (Plain (DoubleQuoted [Plain "x"]))     ~  "x"
  -- > DynamicKey (Antiquoted x)                         ~  ${x}
  -- > DynamicKey (Plain (DoubleQuoted [Antiquoted x]))  ~  "${x}"
  | StaticKey !VarName
  -- ^
  -- > StaticKey "x"                                     ~  x
  deriving (NKeyName r -> NKeyName r -> Bool
(NKeyName r -> NKeyName r -> Bool)
-> (NKeyName r -> NKeyName r -> Bool) -> Eq (NKeyName r)
forall r. Eq r => NKeyName r -> NKeyName r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NKeyName r -> NKeyName r -> Bool
$c/= :: forall r. Eq r => NKeyName r -> NKeyName r -> Bool
== :: NKeyName r -> NKeyName r -> Bool
$c== :: forall r. Eq r => NKeyName r -> NKeyName r -> Bool
Eq, Eq (NKeyName r)
Eq (NKeyName r) =>
(NKeyName r -> NKeyName r -> Ordering)
-> (NKeyName r -> NKeyName r -> Bool)
-> (NKeyName r -> NKeyName r -> Bool)
-> (NKeyName r -> NKeyName r -> Bool)
-> (NKeyName r -> NKeyName r -> Bool)
-> (NKeyName r -> NKeyName r -> NKeyName r)
-> (NKeyName r -> NKeyName r -> NKeyName r)
-> Ord (NKeyName r)
NKeyName r -> NKeyName r -> Bool
NKeyName r -> NKeyName r -> Ordering
NKeyName r -> NKeyName r -> NKeyName r
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (NKeyName r)
forall r. Ord r => NKeyName r -> NKeyName r -> Bool
forall r. Ord r => NKeyName r -> NKeyName r -> Ordering
forall r. Ord r => NKeyName r -> NKeyName r -> NKeyName r
min :: NKeyName r -> NKeyName r -> NKeyName r
$cmin :: forall r. Ord r => NKeyName r -> NKeyName r -> NKeyName r
max :: NKeyName r -> NKeyName r -> NKeyName r
$cmax :: forall r. Ord r => NKeyName r -> NKeyName r -> NKeyName r
>= :: NKeyName r -> NKeyName r -> Bool
$c>= :: forall r. Ord r => NKeyName r -> NKeyName r -> Bool
> :: NKeyName r -> NKeyName r -> Bool
$c> :: forall r. Ord r => NKeyName r -> NKeyName r -> Bool
<= :: NKeyName r -> NKeyName r -> Bool
$c<= :: forall r. Ord r => NKeyName r -> NKeyName r -> Bool
< :: NKeyName r -> NKeyName r -> Bool
$c< :: forall r. Ord r => NKeyName r -> NKeyName r -> Bool
compare :: NKeyName r -> NKeyName r -> Ordering
$ccompare :: forall r. Ord r => NKeyName r -> NKeyName r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (NKeyName r)
Ord, (forall x. NKeyName r -> Rep (NKeyName r) x)
-> (forall x. Rep (NKeyName r) x -> NKeyName r)
-> Generic (NKeyName r)
forall x. Rep (NKeyName r) x -> NKeyName r
forall x. NKeyName r -> Rep (NKeyName r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (NKeyName r) x -> NKeyName r
forall r x. NKeyName r -> Rep (NKeyName r) x
$cto :: forall r x. Rep (NKeyName r) x -> NKeyName r
$cfrom :: forall r x. NKeyName r -> Rep (NKeyName r) x
Generic, Typeable, Typeable (NKeyName r)
DataType
Constr
Typeable (NKeyName r) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (NKeyName r))
-> (NKeyName r -> Constr)
-> (NKeyName r -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (NKeyName r)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (NKeyName r)))
-> ((forall b. Data b => b -> b) -> NKeyName r -> NKeyName r)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NKeyName r -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NKeyName r -> r)
-> (forall u. (forall d. Data d => d -> u) -> NKeyName r -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NKeyName r -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r))
-> Data (NKeyName r)
NKeyName r -> DataType
NKeyName r -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (NKeyName r))
(forall b. Data b => b -> b) -> NKeyName r -> NKeyName r
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NKeyName r)
forall r. Data r => Typeable (NKeyName r)
forall r. Data r => NKeyName r -> DataType
forall r. Data r => NKeyName r -> Constr
forall r.
Data r =>
(forall b. Data b => b -> b) -> NKeyName r -> NKeyName r
forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NKeyName r -> u
forall r u.
Data r =>
(forall d. Data d => d -> u) -> NKeyName r -> [u]
forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NKeyName r)
forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r)
forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NKeyName r))
forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NKeyName r))
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) -> NKeyName r -> u
forall u. (forall d. Data d => d -> u) -> NKeyName r -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NKeyName r)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (NKeyName r))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NKeyName r))
$cStaticKey :: Constr
$cDynamicKey :: Constr
$tNKeyName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
$cgmapMo :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
gmapMp :: (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
$cgmapMp :: forall r (m :: * -> *).
(Data r, MonadPlus m) =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
gmapM :: (forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
$cgmapM :: forall r (m :: * -> *).
(Data r, Monad m) =>
(forall d. Data d => d -> m d) -> NKeyName r -> m (NKeyName r)
gmapQi :: Int -> (forall d. Data d => d -> u) -> NKeyName r -> u
$cgmapQi :: forall r u.
Data r =>
Int -> (forall d. Data d => d -> u) -> NKeyName r -> u
gmapQ :: (forall d. Data d => d -> u) -> NKeyName r -> [u]
$cgmapQ :: forall r u.
Data r =>
(forall d. Data d => d -> u) -> NKeyName r -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
$cgmapQr :: forall r r r'.
Data r =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
$cgmapQl :: forall r r r'.
Data r =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NKeyName r -> r
gmapT :: (forall b. Data b => b -> b) -> NKeyName r -> NKeyName r
$cgmapT :: forall r.
Data r =>
(forall b. Data b => b -> b) -> NKeyName r -> NKeyName r
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NKeyName r))
$cdataCast2 :: forall r (t :: * -> * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (NKeyName r))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (NKeyName r))
$cdataCast1 :: forall r (t :: * -> *) (c :: * -> *).
(Data r, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (NKeyName r))
dataTypeOf :: NKeyName r -> DataType
$cdataTypeOf :: forall r. Data r => NKeyName r -> DataType
toConstr :: NKeyName r -> Constr
$ctoConstr :: forall r. Data r => NKeyName r -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NKeyName r)
$cgunfold :: forall r (c :: * -> *).
Data r =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (NKeyName r)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r)
$cgfoldl :: forall r (c :: * -> *).
Data r =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NKeyName r -> c (NKeyName r)
$cp1Data :: forall r. Data r => Typeable (NKeyName r)
Data, Int -> NKeyName r -> ShowS
[NKeyName r] -> ShowS
NKeyName r -> String
(Int -> NKeyName r -> ShowS)
-> (NKeyName r -> String)
-> ([NKeyName r] -> ShowS)
-> Show (NKeyName r)
forall r. Show r => Int -> NKeyName r -> ShowS
forall r. Show r => [NKeyName r] -> ShowS
forall r. Show r => NKeyName r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NKeyName r] -> ShowS
$cshowList :: forall r. Show r => [NKeyName r] -> ShowS
show :: NKeyName r -> String
$cshow :: forall r. Show r => NKeyName r -> String
showsPrec :: Int -> NKeyName r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> NKeyName r -> ShowS
Show, ReadPrec [NKeyName r]
ReadPrec (NKeyName r)
Int -> ReadS (NKeyName r)
ReadS [NKeyName r]
(Int -> ReadS (NKeyName r))
-> ReadS [NKeyName r]
-> ReadPrec (NKeyName r)
-> ReadPrec [NKeyName r]
-> Read (NKeyName r)
forall r. Read r => ReadPrec [NKeyName r]
forall r. Read r => ReadPrec (NKeyName r)
forall r. Read r => Int -> ReadS (NKeyName r)
forall r. Read r => ReadS [NKeyName r]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NKeyName r]
$creadListPrec :: forall r. Read r => ReadPrec [NKeyName r]
readPrec :: ReadPrec (NKeyName r)
$creadPrec :: forall r. Read r => ReadPrec (NKeyName r)
readList :: ReadS [NKeyName r]
$creadList :: forall r. Read r => ReadS [NKeyName r]
readsPrec :: Int -> ReadS (NKeyName r)
$creadsPrec :: forall r. Read r => Int -> ReadS (NKeyName r)
Read, NKeyName r -> ()
(NKeyName r -> ()) -> NFData (NKeyName r)
forall r. NFData r => NKeyName r -> ()
forall a. (a -> ()) -> NFData a
rnf :: NKeyName r -> ()
$crnf :: forall r. NFData r => NKeyName r -> ()
NFData, Int -> NKeyName r -> Int
NKeyName r -> Int
(Int -> NKeyName r -> Int)
-> (NKeyName r -> Int) -> Hashable (NKeyName r)
forall r. Hashable r => Int -> NKeyName r -> Int
forall r. Hashable r => NKeyName r -> Int
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NKeyName r -> Int
$chash :: forall r. Hashable r => NKeyName r -> Int
hashWithSalt :: Int -> NKeyName r -> Int
$chashWithSalt :: forall r. Hashable r => Int -> NKeyName r -> Int
Hashable)

#ifdef MIN_VERSION_serialise
instance Serialise r => Serialise (NKeyName r)

instance Serialise Pos where
  encode :: Pos -> Encoding
encode x :: Pos
x = Int -> Encoding
forall a. Serialise a => a -> Encoding
Ser.encode (Pos -> Int
unPos Pos
x)
  decode :: Decoder s Pos
decode = Int -> Pos
mkPos (Int -> Pos) -> Decoder s Int -> Decoder s Pos
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s Int
forall a s. Serialise a => Decoder s a
Ser.decode

instance Serialise SourcePos where
  encode :: SourcePos -> Encoding
encode (SourcePos f :: String
f l :: Pos
l c :: Pos
c) = String -> Encoding
forall a. Serialise a => a -> Encoding
Ser.encode String
f Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Pos -> Encoding
forall a. Serialise a => a -> Encoding
Ser.encode Pos
l Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Pos -> Encoding
forall a. Serialise a => a -> Encoding
Ser.encode Pos
c
  decode :: Decoder s SourcePos
decode = String -> Pos -> Pos -> SourcePos
SourcePos (String -> Pos -> Pos -> SourcePos)
-> Decoder s String -> Decoder s (Pos -> Pos -> SourcePos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Decoder s String
forall a s. Serialise a => Decoder s a
Ser.decode Decoder s (Pos -> Pos -> SourcePos)
-> Decoder s Pos -> Decoder s (Pos -> SourcePos)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s Pos
forall a s. Serialise a => Decoder s a
Ser.decode Decoder s (Pos -> SourcePos)
-> Decoder s Pos -> Decoder s SourcePos
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Decoder s Pos
forall a s. Serialise a => Decoder s a
Ser.decode
#endif

instance Hashable Pos where
  hashWithSalt :: Int -> Pos -> Int
hashWithSalt salt :: Int
salt x :: Pos
x = Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
salt (Pos -> Int
unPos Pos
x)

instance Hashable SourcePos where
  hashWithSalt :: Int -> SourcePos -> Int
hashWithSalt salt :: Int
salt (SourcePos f :: String
f l :: Pos
l c :: Pos
c) =
    Int
salt Int -> String -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` String
f Int -> Pos -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Pos
l Int -> Pos -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Pos
c

instance Generic1 NKeyName where
  type Rep1 NKeyName = NKeyName
  from1 :: NKeyName a -> Rep1 NKeyName a
from1 = NKeyName a -> Rep1 NKeyName a
forall a. a -> a
id
  to1 :: Rep1 NKeyName a -> NKeyName a
to1   = Rep1 NKeyName a -> NKeyName a
forall a. a -> a
id

instance NFData1 NKeyName where
  liftRnf :: (a -> ()) -> NKeyName a -> ()
liftRnf _ (StaticKey  !VarName
_            ) = ()
  liftRnf _ (DynamicKey (Plain !NString a
_)    ) = ()
  liftRnf _ (DynamicKey EscapedNewline) = ()
  liftRnf k :: a -> ()
k (DynamicKey (Antiquoted r :: a
r)) = a -> ()
k a
r

-- | Most key names are just static text, so this instance is convenient.
instance IsString (NKeyName r) where
  fromString :: String -> NKeyName r
fromString = VarName -> NKeyName r
forall r. VarName -> NKeyName r
StaticKey (VarName -> NKeyName r)
-> (String -> VarName) -> String -> NKeyName r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> VarName
forall a. IsString a => String -> a
fromString

instance Eq1 NKeyName where
  liftEq :: (a -> b -> Bool) -> NKeyName a -> NKeyName b -> Bool
liftEq eq :: a -> b -> Bool
eq (DynamicKey a :: Antiquoted (NString a) a
a) (DynamicKey b :: Antiquoted (NString b) b
b) = (NString a -> NString b -> Bool)
-> (a -> b -> Bool)
-> Antiquoted (NString a) a
-> Antiquoted (NString b) b
-> Bool
forall (f :: * -> * -> *) a b c d.
Eq2 f =>
(a -> b -> Bool) -> (c -> d -> Bool) -> f a c -> f b d -> Bool
liftEq2 ((a -> b -> Bool) -> NString a -> NString b -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> f a -> f b -> Bool
liftEq a -> b -> Bool
eq) a -> b -> Bool
eq Antiquoted (NString a) a
a Antiquoted (NString b) b
b
  liftEq _  (StaticKey  a :: VarName
a) (StaticKey  b :: VarName
b) = VarName
a VarName -> VarName -> Bool
forall a. Eq a => a -> a -> Bool
== VarName
b
  liftEq _  _              _              = Bool
False

-- | @since UNRELEASED
instance Ord1 NKeyName where
  liftCompare :: (a -> b -> Ordering) -> NKeyName a -> NKeyName b -> Ordering
liftCompare cmp :: a -> b -> Ordering
cmp (DynamicKey a :: Antiquoted (NString a) a
a) (DynamicKey b :: Antiquoted (NString b) b
b) = (NString a -> NString b -> Ordering)
-> (a -> b -> Ordering)
-> Antiquoted (NString a) a
-> Antiquoted (NString b) b
-> Ordering
forall (f :: * -> * -> *) a b c d.
Ord2 f =>
(a -> b -> Ordering)
-> (c -> d -> Ordering) -> f a c -> f b d -> Ordering
liftCompare2 ((a -> b -> Ordering) -> NString a -> NString b -> Ordering
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> f a -> f b -> Ordering
liftCompare a -> b -> Ordering
cmp) a -> b -> Ordering
cmp Antiquoted (NString a) a
a Antiquoted (NString b) b
b
  liftCompare _   (DynamicKey _) (StaticKey _)  = Ordering
LT
  liftCompare _   (StaticKey _)  (DynamicKey _) = Ordering
GT
  liftCompare _   (StaticKey a :: VarName
a)  (StaticKey b :: VarName
b)  = VarName -> VarName -> Ordering
forall a. Ord a => a -> a -> Ordering
compare VarName
a VarName
b

instance Hashable1 NKeyName where
  liftHashWithSalt :: (Int -> a -> Int) -> Int -> NKeyName a -> Int
liftHashWithSalt h :: Int -> a -> Int
h salt :: Int
salt (DynamicKey a :: Antiquoted (NString a) a
a) =
    (Int -> NString a -> Int)
-> (Int -> a -> Int) -> Int -> Antiquoted (NString a) a -> Int
forall (t :: * -> * -> *) a b.
Hashable2 t =>
(Int -> a -> Int) -> (Int -> b -> Int) -> Int -> t a b -> Int
liftHashWithSalt2 ((Int -> a -> Int) -> Int -> NString a -> Int
forall (t :: * -> *) a.
Hashable1 t =>
(Int -> a -> Int) -> Int -> t a -> Int
liftHashWithSalt Int -> a -> Int
h) Int -> a -> Int
h (Int
salt Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (0 :: Int)) Antiquoted (NString a) a
a
  liftHashWithSalt _ salt :: Int
salt (StaticKey n :: VarName
n) =
    Int
salt Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (1 :: Int) Int -> VarName -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` VarName
n

-- Deriving this instance automatically is not possible because @r@
-- occurs not only as last argument in @Antiquoted (NString r) r@
instance Show1 NKeyName where
  liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NKeyName a -> ShowS
liftShowsPrec sp :: Int -> a -> ShowS
sp sl :: [a] -> ShowS
sl p :: Int
p = \case
    DynamicKey a :: Antiquoted (NString a) a
a -> (Int -> Antiquoted (NString a) a -> ShowS)
-> String -> Int -> Antiquoted (NString a) a -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith
      ((Int -> NString a -> ShowS)
-> ([NString a] -> ShowS)
-> (Int -> a -> ShowS)
-> ([a] -> ShowS)
-> Int
-> Antiquoted (NString a) a
-> ShowS
forall (f :: * -> * -> *) a b.
Show2 f =>
(Int -> a -> ShowS)
-> ([a] -> ShowS)
-> (Int -> b -> ShowS)
-> ([b] -> ShowS)
-> Int
-> f a b
-> ShowS
liftShowsPrec2 ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NString a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
liftShowsPrec Int -> a -> ShowS
sp [a] -> ShowS
sl) ((Int -> a -> ShowS) -> ([a] -> ShowS) -> [NString a] -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS
liftShowList Int -> a -> ShowS
sp [a] -> ShowS
sl) Int -> a -> ShowS
sp [a] -> ShowS
sl)
      "DynamicKey"
      Int
p
      Antiquoted (NString a) a
a
    StaticKey t :: VarName
t -> (Int -> VarName -> ShowS) -> String -> Int -> VarName -> ShowS
forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
showsUnaryWith Int -> VarName -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec "StaticKey" Int
p VarName
t

-- Deriving this instance automatically is not possible because @r@
-- occurs not only as last argument in @Antiquoted (NString r) r@
instance Functor NKeyName where
  fmap :: (a -> b) -> NKeyName a -> NKeyName b
fmap = (a -> b) -> NKeyName a -> NKeyName b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault

-- Deriving this instance automatically is not possible because @r@
-- occurs not only as last argument in @Antiquoted (NString r) r@
instance Foldable NKeyName where
  foldMap :: (a -> m) -> NKeyName a -> m
foldMap = (a -> m) -> NKeyName a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault

-- Deriving this instance automatically is not possible because @r@
-- occurs not only as last argument in @Antiquoted (NString r) r@
instance Traversable NKeyName where
  traverse :: (a -> f b) -> NKeyName a -> f (NKeyName b)
traverse f :: a -> f b
f = \case
    DynamicKey (Plain      str :: NString a
str) -> Antiquoted (NString b) b -> NKeyName b
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey (Antiquoted (NString b) b -> NKeyName b)
-> (NString b -> Antiquoted (NString b) b)
-> NString b
-> NKeyName b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NString b -> Antiquoted (NString b) b
forall v r. v -> Antiquoted v r
Plain (NString b -> NKeyName b) -> f (NString b) -> f (NKeyName b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> NString a -> f (NString b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse a -> f b
f NString a
str
    DynamicKey (Antiquoted e :: a
e  ) -> Antiquoted (NString b) b -> NKeyName b
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey (Antiquoted (NString b) b -> NKeyName b)
-> (b -> Antiquoted (NString b) b) -> b -> NKeyName b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Antiquoted (NString b) b
forall v r. r -> Antiquoted v r
Antiquoted (b -> NKeyName b) -> f b -> f (NKeyName b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
e
    DynamicKey EscapedNewline   -> NKeyName b -> f (NKeyName b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NKeyName b -> f (NKeyName b)) -> NKeyName b -> f (NKeyName b)
forall a b. (a -> b) -> a -> b
$ Antiquoted (NString b) b -> NKeyName b
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey Antiquoted (NString b) b
forall v r. Antiquoted v r
EscapedNewline
    StaticKey  key :: VarName
key              -> NKeyName b -> f (NKeyName b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (VarName -> NKeyName b
forall r. VarName -> NKeyName r
StaticKey VarName
key)

-- | A selector (for example in a @let@ or an attribute set) is made up
-- of strung-together key names.
--
-- > StaticKey "x" :| [DynamicKey (Antiquoted y)]  ~  x.${y}
type NAttrPath r = NonEmpty (NKeyName r)

-- | There are two unary operations: logical not and integer negation.
data NUnaryOp
  = NNeg  -- ^ @-@
  | NNot  -- ^ @!@
  deriving (NUnaryOp -> NUnaryOp -> Bool
(NUnaryOp -> NUnaryOp -> Bool)
-> (NUnaryOp -> NUnaryOp -> Bool) -> Eq NUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NUnaryOp -> NUnaryOp -> Bool
$c/= :: NUnaryOp -> NUnaryOp -> Bool
== :: NUnaryOp -> NUnaryOp -> Bool
$c== :: NUnaryOp -> NUnaryOp -> Bool
Eq, Eq NUnaryOp
Eq NUnaryOp =>
(NUnaryOp -> NUnaryOp -> Ordering)
-> (NUnaryOp -> NUnaryOp -> Bool)
-> (NUnaryOp -> NUnaryOp -> Bool)
-> (NUnaryOp -> NUnaryOp -> Bool)
-> (NUnaryOp -> NUnaryOp -> Bool)
-> (NUnaryOp -> NUnaryOp -> NUnaryOp)
-> (NUnaryOp -> NUnaryOp -> NUnaryOp)
-> Ord NUnaryOp
NUnaryOp -> NUnaryOp -> Bool
NUnaryOp -> NUnaryOp -> Ordering
NUnaryOp -> NUnaryOp -> NUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NUnaryOp -> NUnaryOp -> NUnaryOp
$cmin :: NUnaryOp -> NUnaryOp -> NUnaryOp
max :: NUnaryOp -> NUnaryOp -> NUnaryOp
$cmax :: NUnaryOp -> NUnaryOp -> NUnaryOp
>= :: NUnaryOp -> NUnaryOp -> Bool
$c>= :: NUnaryOp -> NUnaryOp -> Bool
> :: NUnaryOp -> NUnaryOp -> Bool
$c> :: NUnaryOp -> NUnaryOp -> Bool
<= :: NUnaryOp -> NUnaryOp -> Bool
$c<= :: NUnaryOp -> NUnaryOp -> Bool
< :: NUnaryOp -> NUnaryOp -> Bool
$c< :: NUnaryOp -> NUnaryOp -> Bool
compare :: NUnaryOp -> NUnaryOp -> Ordering
$ccompare :: NUnaryOp -> NUnaryOp -> Ordering
$cp1Ord :: Eq NUnaryOp
Ord, Int -> NUnaryOp
NUnaryOp -> Int
NUnaryOp -> [NUnaryOp]
NUnaryOp -> NUnaryOp
NUnaryOp -> NUnaryOp -> [NUnaryOp]
NUnaryOp -> NUnaryOp -> NUnaryOp -> [NUnaryOp]
(NUnaryOp -> NUnaryOp)
-> (NUnaryOp -> NUnaryOp)
-> (Int -> NUnaryOp)
-> (NUnaryOp -> Int)
-> (NUnaryOp -> [NUnaryOp])
-> (NUnaryOp -> NUnaryOp -> [NUnaryOp])
-> (NUnaryOp -> NUnaryOp -> [NUnaryOp])
-> (NUnaryOp -> NUnaryOp -> NUnaryOp -> [NUnaryOp])
-> Enum NUnaryOp
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: NUnaryOp -> NUnaryOp -> NUnaryOp -> [NUnaryOp]
$cenumFromThenTo :: NUnaryOp -> NUnaryOp -> NUnaryOp -> [NUnaryOp]
enumFromTo :: NUnaryOp -> NUnaryOp -> [NUnaryOp]
$cenumFromTo :: NUnaryOp -> NUnaryOp -> [NUnaryOp]
enumFromThen :: NUnaryOp -> NUnaryOp -> [NUnaryOp]
$cenumFromThen :: NUnaryOp -> NUnaryOp -> [NUnaryOp]
enumFrom :: NUnaryOp -> [NUnaryOp]
$cenumFrom :: NUnaryOp -> [NUnaryOp]
fromEnum :: NUnaryOp -> Int
$cfromEnum :: NUnaryOp -> Int
toEnum :: Int -> NUnaryOp
$ctoEnum :: Int -> NUnaryOp
pred :: NUnaryOp -> NUnaryOp
$cpred :: NUnaryOp -> NUnaryOp
succ :: NUnaryOp -> NUnaryOp
$csucc :: NUnaryOp -> NUnaryOp
Enum, NUnaryOp
NUnaryOp -> NUnaryOp -> Bounded NUnaryOp
forall a. a -> a -> Bounded a
maxBound :: NUnaryOp
$cmaxBound :: NUnaryOp
minBound :: NUnaryOp
$cminBound :: NUnaryOp
Bounded, (forall x. NUnaryOp -> Rep NUnaryOp x)
-> (forall x. Rep NUnaryOp x -> NUnaryOp) -> Generic NUnaryOp
forall x. Rep NUnaryOp x -> NUnaryOp
forall x. NUnaryOp -> Rep NUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NUnaryOp x -> NUnaryOp
$cfrom :: forall x. NUnaryOp -> Rep NUnaryOp x
Generic, Typeable, Typeable NUnaryOp
DataType
Constr
Typeable NUnaryOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NUnaryOp -> c NUnaryOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NUnaryOp)
-> (NUnaryOp -> Constr)
-> (NUnaryOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NUnaryOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NUnaryOp))
-> ((forall b. Data b => b -> b) -> NUnaryOp -> NUnaryOp)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> NUnaryOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> NUnaryOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp)
-> Data NUnaryOp
NUnaryOp -> DataType
NUnaryOp -> Constr
(forall b. Data b => b -> b) -> NUnaryOp -> NUnaryOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NUnaryOp -> c NUnaryOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NUnaryOp
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) -> NUnaryOp -> u
forall u. (forall d. Data d => d -> u) -> NUnaryOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NUnaryOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NUnaryOp -> c NUnaryOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NUnaryOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NUnaryOp)
$cNNot :: Constr
$cNNeg :: Constr
$tNUnaryOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
gmapMp :: (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
gmapM :: (forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NUnaryOp -> m NUnaryOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> NUnaryOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NUnaryOp -> u
gmapQ :: (forall d. Data d => d -> u) -> NUnaryOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NUnaryOp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NUnaryOp -> r
gmapT :: (forall b. Data b => b -> b) -> NUnaryOp -> NUnaryOp
$cgmapT :: (forall b. Data b => b -> b) -> NUnaryOp -> NUnaryOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NUnaryOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NUnaryOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NUnaryOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NUnaryOp)
dataTypeOf :: NUnaryOp -> DataType
$cdataTypeOf :: NUnaryOp -> DataType
toConstr :: NUnaryOp -> Constr
$ctoConstr :: NUnaryOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NUnaryOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NUnaryOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NUnaryOp -> c NUnaryOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NUnaryOp -> c NUnaryOp
$cp1Data :: Typeable NUnaryOp
Data, Int -> NUnaryOp -> ShowS
[NUnaryOp] -> ShowS
NUnaryOp -> String
(Int -> NUnaryOp -> ShowS)
-> (NUnaryOp -> String) -> ([NUnaryOp] -> ShowS) -> Show NUnaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NUnaryOp] -> ShowS
$cshowList :: [NUnaryOp] -> ShowS
show :: NUnaryOp -> String
$cshow :: NUnaryOp -> String
showsPrec :: Int -> NUnaryOp -> ShowS
$cshowsPrec :: Int -> NUnaryOp -> ShowS
Show, ReadPrec [NUnaryOp]
ReadPrec NUnaryOp
Int -> ReadS NUnaryOp
ReadS [NUnaryOp]
(Int -> ReadS NUnaryOp)
-> ReadS [NUnaryOp]
-> ReadPrec NUnaryOp
-> ReadPrec [NUnaryOp]
-> Read NUnaryOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NUnaryOp]
$creadListPrec :: ReadPrec [NUnaryOp]
readPrec :: ReadPrec NUnaryOp
$creadPrec :: ReadPrec NUnaryOp
readList :: ReadS [NUnaryOp]
$creadList :: ReadS [NUnaryOp]
readsPrec :: Int -> ReadS NUnaryOp
$creadsPrec :: Int -> ReadS NUnaryOp
Read,
            NUnaryOp -> ()
(NUnaryOp -> ()) -> NFData NUnaryOp
forall a. (a -> ()) -> NFData a
rnf :: NUnaryOp -> ()
$crnf :: NUnaryOp -> ()
NFData, Int -> NUnaryOp -> Int
NUnaryOp -> Int
(Int -> NUnaryOp -> Int) -> (NUnaryOp -> Int) -> Hashable NUnaryOp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NUnaryOp -> Int
$chash :: NUnaryOp -> Int
hashWithSalt :: Int -> NUnaryOp -> Int
$chashWithSalt :: Int -> NUnaryOp -> Int
Hashable)

#ifdef MIN_VERSION_serialise
instance Serialise NUnaryOp
#endif

-- | Binary operators expressible in the nix language.
data NBinaryOp
  = NEq      -- ^ Equality (@==@)
  | NNEq     -- ^ Inequality (@!=@)
  | NLt      -- ^ Less than (@<@)
  | NLte     -- ^ Less than or equal (@<=@)
  | NGt      -- ^ Greater than (@>@)
  | NGte     -- ^ Greater than or equal (@>=@)
  | NAnd     -- ^ Logical and (@&&@)
  | NOr      -- ^ Logical or (@||@)
  | NImpl    -- ^ Logical implication (@->@)
  | NUpdate  -- ^ Joining two attribute sets (@//@)
  | NPlus    -- ^ Addition (@+@)
  | NMinus   -- ^ Subtraction (@-@)
  | NMult    -- ^ Multiplication (@*@)
  | NDiv     -- ^ Division (@/@)
  | NConcat  -- ^ List concatenation (@++@)
  | NApp     -- ^ Apply a function to an argument.
             --
             -- > NBinary NApp f x  ~  f x
  deriving (NBinaryOp -> NBinaryOp -> Bool
(NBinaryOp -> NBinaryOp -> Bool)
-> (NBinaryOp -> NBinaryOp -> Bool) -> Eq NBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NBinaryOp -> NBinaryOp -> Bool
$c/= :: NBinaryOp -> NBinaryOp -> Bool
== :: NBinaryOp -> NBinaryOp -> Bool
$c== :: NBinaryOp -> NBinaryOp -> Bool
Eq, Eq NBinaryOp
Eq NBinaryOp =>
(NBinaryOp -> NBinaryOp -> Ordering)
-> (NBinaryOp -> NBinaryOp -> Bool)
-> (NBinaryOp -> NBinaryOp -> Bool)
-> (NBinaryOp -> NBinaryOp -> Bool)
-> (NBinaryOp -> NBinaryOp -> Bool)
-> (NBinaryOp -> NBinaryOp -> NBinaryOp)
-> (NBinaryOp -> NBinaryOp -> NBinaryOp)
-> Ord NBinaryOp
NBinaryOp -> NBinaryOp -> Bool
NBinaryOp -> NBinaryOp -> Ordering
NBinaryOp -> NBinaryOp -> NBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NBinaryOp -> NBinaryOp -> NBinaryOp
$cmin :: NBinaryOp -> NBinaryOp -> NBinaryOp
max :: NBinaryOp -> NBinaryOp -> NBinaryOp
$cmax :: NBinaryOp -> NBinaryOp -> NBinaryOp
>= :: NBinaryOp -> NBinaryOp -> Bool
$c>= :: NBinaryOp -> NBinaryOp -> Bool
> :: NBinaryOp -> NBinaryOp -> Bool
$c> :: NBinaryOp -> NBinaryOp -> Bool
<= :: NBinaryOp -> NBinaryOp -> Bool
$c<= :: NBinaryOp -> NBinaryOp -> Bool
< :: NBinaryOp -> NBinaryOp -> Bool
$c< :: NBinaryOp -> NBinaryOp -> Bool
compare :: NBinaryOp -> NBinaryOp -> Ordering
$ccompare :: NBinaryOp -> NBinaryOp -> Ordering
$cp1Ord :: Eq NBinaryOp
Ord, Int -> NBinaryOp
NBinaryOp -> Int
NBinaryOp -> [NBinaryOp]
NBinaryOp -> NBinaryOp
NBinaryOp -> NBinaryOp -> [NBinaryOp]
NBinaryOp -> NBinaryOp -> NBinaryOp -> [NBinaryOp]
(NBinaryOp -> NBinaryOp)
-> (NBinaryOp -> NBinaryOp)
-> (Int -> NBinaryOp)
-> (NBinaryOp -> Int)
-> (NBinaryOp -> [NBinaryOp])
-> (NBinaryOp -> NBinaryOp -> [NBinaryOp])
-> (NBinaryOp -> NBinaryOp -> [NBinaryOp])
-> (NBinaryOp -> NBinaryOp -> NBinaryOp -> [NBinaryOp])
-> Enum NBinaryOp
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: NBinaryOp -> NBinaryOp -> NBinaryOp -> [NBinaryOp]
$cenumFromThenTo :: NBinaryOp -> NBinaryOp -> NBinaryOp -> [NBinaryOp]
enumFromTo :: NBinaryOp -> NBinaryOp -> [NBinaryOp]
$cenumFromTo :: NBinaryOp -> NBinaryOp -> [NBinaryOp]
enumFromThen :: NBinaryOp -> NBinaryOp -> [NBinaryOp]
$cenumFromThen :: NBinaryOp -> NBinaryOp -> [NBinaryOp]
enumFrom :: NBinaryOp -> [NBinaryOp]
$cenumFrom :: NBinaryOp -> [NBinaryOp]
fromEnum :: NBinaryOp -> Int
$cfromEnum :: NBinaryOp -> Int
toEnum :: Int -> NBinaryOp
$ctoEnum :: Int -> NBinaryOp
pred :: NBinaryOp -> NBinaryOp
$cpred :: NBinaryOp -> NBinaryOp
succ :: NBinaryOp -> NBinaryOp
$csucc :: NBinaryOp -> NBinaryOp
Enum, NBinaryOp
NBinaryOp -> NBinaryOp -> Bounded NBinaryOp
forall a. a -> a -> Bounded a
maxBound :: NBinaryOp
$cmaxBound :: NBinaryOp
minBound :: NBinaryOp
$cminBound :: NBinaryOp
Bounded, (forall x. NBinaryOp -> Rep NBinaryOp x)
-> (forall x. Rep NBinaryOp x -> NBinaryOp) -> Generic NBinaryOp
forall x. Rep NBinaryOp x -> NBinaryOp
forall x. NBinaryOp -> Rep NBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NBinaryOp x -> NBinaryOp
$cfrom :: forall x. NBinaryOp -> Rep NBinaryOp x
Generic, Typeable, Typeable NBinaryOp
DataType
Constr
Typeable NBinaryOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NBinaryOp -> c NBinaryOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NBinaryOp)
-> (NBinaryOp -> Constr)
-> (NBinaryOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NBinaryOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NBinaryOp))
-> ((forall b. Data b => b -> b) -> NBinaryOp -> NBinaryOp)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> NBinaryOp -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NBinaryOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp)
-> Data NBinaryOp
NBinaryOp -> DataType
NBinaryOp -> Constr
(forall b. Data b => b -> b) -> NBinaryOp -> NBinaryOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NBinaryOp -> c NBinaryOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NBinaryOp
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) -> NBinaryOp -> u
forall u. (forall d. Data d => d -> u) -> NBinaryOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NBinaryOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NBinaryOp -> c NBinaryOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NBinaryOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NBinaryOp)
$cNApp :: Constr
$cNConcat :: Constr
$cNDiv :: Constr
$cNMult :: Constr
$cNMinus :: Constr
$cNPlus :: Constr
$cNUpdate :: Constr
$cNImpl :: Constr
$cNOr :: Constr
$cNAnd :: Constr
$cNGte :: Constr
$cNGt :: Constr
$cNLte :: Constr
$cNLt :: Constr
$cNNEq :: Constr
$cNEq :: Constr
$tNBinaryOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
gmapMp :: (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
gmapM :: (forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NBinaryOp -> m NBinaryOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> NBinaryOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NBinaryOp -> u
gmapQ :: (forall d. Data d => d -> u) -> NBinaryOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NBinaryOp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NBinaryOp -> r
gmapT :: (forall b. Data b => b -> b) -> NBinaryOp -> NBinaryOp
$cgmapT :: (forall b. Data b => b -> b) -> NBinaryOp -> NBinaryOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NBinaryOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NBinaryOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NBinaryOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NBinaryOp)
dataTypeOf :: NBinaryOp -> DataType
$cdataTypeOf :: NBinaryOp -> DataType
toConstr :: NBinaryOp -> Constr
$ctoConstr :: NBinaryOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NBinaryOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NBinaryOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NBinaryOp -> c NBinaryOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NBinaryOp -> c NBinaryOp
$cp1Data :: Typeable NBinaryOp
Data, Int -> NBinaryOp -> ShowS
[NBinaryOp] -> ShowS
NBinaryOp -> String
(Int -> NBinaryOp -> ShowS)
-> (NBinaryOp -> String)
-> ([NBinaryOp] -> ShowS)
-> Show NBinaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NBinaryOp] -> ShowS
$cshowList :: [NBinaryOp] -> ShowS
show :: NBinaryOp -> String
$cshow :: NBinaryOp -> String
showsPrec :: Int -> NBinaryOp -> ShowS
$cshowsPrec :: Int -> NBinaryOp -> ShowS
Show, ReadPrec [NBinaryOp]
ReadPrec NBinaryOp
Int -> ReadS NBinaryOp
ReadS [NBinaryOp]
(Int -> ReadS NBinaryOp)
-> ReadS [NBinaryOp]
-> ReadPrec NBinaryOp
-> ReadPrec [NBinaryOp]
-> Read NBinaryOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NBinaryOp]
$creadListPrec :: ReadPrec [NBinaryOp]
readPrec :: ReadPrec NBinaryOp
$creadPrec :: ReadPrec NBinaryOp
readList :: ReadS [NBinaryOp]
$creadList :: ReadS [NBinaryOp]
readsPrec :: Int -> ReadS NBinaryOp
$creadsPrec :: Int -> ReadS NBinaryOp
Read,
            NBinaryOp -> ()
(NBinaryOp -> ()) -> NFData NBinaryOp
forall a. (a -> ()) -> NFData a
rnf :: NBinaryOp -> ()
$crnf :: NBinaryOp -> ()
NFData, Int -> NBinaryOp -> Int
NBinaryOp -> Int
(Int -> NBinaryOp -> Int)
-> (NBinaryOp -> Int) -> Hashable NBinaryOp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NBinaryOp -> Int
$chash :: NBinaryOp -> Int
hashWithSalt :: Int -> NBinaryOp -> Int
$chashWithSalt :: Int -> NBinaryOp -> Int
Hashable)

#ifdef MIN_VERSION_serialise
instance Serialise NBinaryOp
#endif

-- | 'NRecordType' distinguishes between recursive and non-recursive attribute
-- sets.
data NRecordType
  = NNonRecursive  -- ^ >     { ... }
  | NRecursive     -- ^ > rec { ... }
  deriving (NRecordType -> NRecordType -> Bool
(NRecordType -> NRecordType -> Bool)
-> (NRecordType -> NRecordType -> Bool) -> Eq NRecordType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NRecordType -> NRecordType -> Bool
$c/= :: NRecordType -> NRecordType -> Bool
== :: NRecordType -> NRecordType -> Bool
$c== :: NRecordType -> NRecordType -> Bool
Eq, Eq NRecordType
Eq NRecordType =>
(NRecordType -> NRecordType -> Ordering)
-> (NRecordType -> NRecordType -> Bool)
-> (NRecordType -> NRecordType -> Bool)
-> (NRecordType -> NRecordType -> Bool)
-> (NRecordType -> NRecordType -> Bool)
-> (NRecordType -> NRecordType -> NRecordType)
-> (NRecordType -> NRecordType -> NRecordType)
-> Ord NRecordType
NRecordType -> NRecordType -> Bool
NRecordType -> NRecordType -> Ordering
NRecordType -> NRecordType -> NRecordType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NRecordType -> NRecordType -> NRecordType
$cmin :: NRecordType -> NRecordType -> NRecordType
max :: NRecordType -> NRecordType -> NRecordType
$cmax :: NRecordType -> NRecordType -> NRecordType
>= :: NRecordType -> NRecordType -> Bool
$c>= :: NRecordType -> NRecordType -> Bool
> :: NRecordType -> NRecordType -> Bool
$c> :: NRecordType -> NRecordType -> Bool
<= :: NRecordType -> NRecordType -> Bool
$c<= :: NRecordType -> NRecordType -> Bool
< :: NRecordType -> NRecordType -> Bool
$c< :: NRecordType -> NRecordType -> Bool
compare :: NRecordType -> NRecordType -> Ordering
$ccompare :: NRecordType -> NRecordType -> Ordering
$cp1Ord :: Eq NRecordType
Ord, Int -> NRecordType
NRecordType -> Int
NRecordType -> [NRecordType]
NRecordType -> NRecordType
NRecordType -> NRecordType -> [NRecordType]
NRecordType -> NRecordType -> NRecordType -> [NRecordType]
(NRecordType -> NRecordType)
-> (NRecordType -> NRecordType)
-> (Int -> NRecordType)
-> (NRecordType -> Int)
-> (NRecordType -> [NRecordType])
-> (NRecordType -> NRecordType -> [NRecordType])
-> (NRecordType -> NRecordType -> [NRecordType])
-> (NRecordType -> NRecordType -> NRecordType -> [NRecordType])
-> Enum NRecordType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: NRecordType -> NRecordType -> NRecordType -> [NRecordType]
$cenumFromThenTo :: NRecordType -> NRecordType -> NRecordType -> [NRecordType]
enumFromTo :: NRecordType -> NRecordType -> [NRecordType]
$cenumFromTo :: NRecordType -> NRecordType -> [NRecordType]
enumFromThen :: NRecordType -> NRecordType -> [NRecordType]
$cenumFromThen :: NRecordType -> NRecordType -> [NRecordType]
enumFrom :: NRecordType -> [NRecordType]
$cenumFrom :: NRecordType -> [NRecordType]
fromEnum :: NRecordType -> Int
$cfromEnum :: NRecordType -> Int
toEnum :: Int -> NRecordType
$ctoEnum :: Int -> NRecordType
pred :: NRecordType -> NRecordType
$cpred :: NRecordType -> NRecordType
succ :: NRecordType -> NRecordType
$csucc :: NRecordType -> NRecordType
Enum, NRecordType
NRecordType -> NRecordType -> Bounded NRecordType
forall a. a -> a -> Bounded a
maxBound :: NRecordType
$cmaxBound :: NRecordType
minBound :: NRecordType
$cminBound :: NRecordType
Bounded, (forall x. NRecordType -> Rep NRecordType x)
-> (forall x. Rep NRecordType x -> NRecordType)
-> Generic NRecordType
forall x. Rep NRecordType x -> NRecordType
forall x. NRecordType -> Rep NRecordType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NRecordType x -> NRecordType
$cfrom :: forall x. NRecordType -> Rep NRecordType x
Generic, Typeable, Typeable NRecordType
DataType
Constr
Typeable NRecordType =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> NRecordType -> c NRecordType)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NRecordType)
-> (NRecordType -> Constr)
-> (NRecordType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NRecordType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c NRecordType))
-> ((forall b. Data b => b -> b) -> NRecordType -> NRecordType)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NRecordType -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NRecordType -> r)
-> (forall u. (forall d. Data d => d -> u) -> NRecordType -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NRecordType -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType)
-> Data NRecordType
NRecordType -> DataType
NRecordType -> Constr
(forall b. Data b => b -> b) -> NRecordType -> NRecordType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NRecordType -> c NRecordType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NRecordType
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) -> NRecordType -> u
forall u. (forall d. Data d => d -> u) -> NRecordType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NRecordType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NRecordType -> c NRecordType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NRecordType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NRecordType)
$cNRecursive :: Constr
$cNNonRecursive :: Constr
$tNRecordType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
gmapMp :: (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
gmapM :: (forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NRecordType -> m NRecordType
gmapQi :: Int -> (forall d. Data d => d -> u) -> NRecordType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NRecordType -> u
gmapQ :: (forall d. Data d => d -> u) -> NRecordType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NRecordType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NRecordType -> r
gmapT :: (forall b. Data b => b -> b) -> NRecordType -> NRecordType
$cgmapT :: (forall b. Data b => b -> b) -> NRecordType -> NRecordType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NRecordType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NRecordType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NRecordType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NRecordType)
dataTypeOf :: NRecordType -> DataType
$cdataTypeOf :: NRecordType -> DataType
toConstr :: NRecordType -> Constr
$ctoConstr :: NRecordType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NRecordType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NRecordType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NRecordType -> c NRecordType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NRecordType -> c NRecordType
$cp1Data :: Typeable NRecordType
Data, Int -> NRecordType -> ShowS
[NRecordType] -> ShowS
NRecordType -> String
(Int -> NRecordType -> ShowS)
-> (NRecordType -> String)
-> ([NRecordType] -> ShowS)
-> Show NRecordType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NRecordType] -> ShowS
$cshowList :: [NRecordType] -> ShowS
show :: NRecordType -> String
$cshow :: NRecordType -> String
showsPrec :: Int -> NRecordType -> ShowS
$cshowsPrec :: Int -> NRecordType -> ShowS
Show, ReadPrec [NRecordType]
ReadPrec NRecordType
Int -> ReadS NRecordType
ReadS [NRecordType]
(Int -> ReadS NRecordType)
-> ReadS [NRecordType]
-> ReadPrec NRecordType
-> ReadPrec [NRecordType]
-> Read NRecordType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NRecordType]
$creadListPrec :: ReadPrec [NRecordType]
readPrec :: ReadPrec NRecordType
$creadPrec :: ReadPrec NRecordType
readList :: ReadS [NRecordType]
$creadList :: ReadS [NRecordType]
readsPrec :: Int -> ReadS NRecordType
$creadsPrec :: Int -> ReadS NRecordType
Read,
            NRecordType -> ()
(NRecordType -> ()) -> NFData NRecordType
forall a. (a -> ()) -> NFData a
rnf :: NRecordType -> ()
$crnf :: NRecordType -> ()
NFData, Int -> NRecordType -> Int
NRecordType -> Int
(Int -> NRecordType -> Int)
-> (NRecordType -> Int) -> Hashable NRecordType
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NRecordType -> Int
$chash :: NRecordType -> Int
hashWithSalt :: Int -> NRecordType -> Int
$chashWithSalt :: Int -> NRecordType -> Int
Hashable)

#ifdef MIN_VERSION_serialise
instance Serialise NRecordType
#endif

-- | Get the name out of the parameter (there might be none).
paramName :: Params r -> Maybe VarName
paramName :: Params r -> Maybe VarName
paramName (Param n :: VarName
n       ) = VarName -> Maybe VarName
forall a. a -> Maybe a
Just VarName
n
paramName (ParamSet _ _ n :: Maybe VarName
n) = Maybe VarName
n

$(deriveEq1 ''NExprF)
$(deriveEq1 ''NString)
$(deriveEq1 ''Binding)
$(deriveEq1 ''Params)
$(deriveEq1 ''Antiquoted)
$(deriveEq2 ''Antiquoted)

$(deriveOrd1 ''NExprF)
$(deriveOrd1 ''NString)
$(deriveOrd1 ''Binding)
$(deriveOrd1 ''Params)
$(deriveOrd1 ''Antiquoted)
$(deriveOrd2 ''Antiquoted)

$(deriveRead1 ''NString)
$(deriveRead1 ''Params)
$(deriveRead1 ''Antiquoted)
$(deriveRead2 ''Antiquoted)

$(deriveShow1 ''NExprF)
$(deriveShow1 ''NString)
$(deriveShow1 ''Params)
$(deriveShow1 ''Binding)
$(deriveShow1 ''Antiquoted)
$(deriveShow2 ''Antiquoted)

--x $(deriveJSON1 defaultOptions ''NExprF)
$(deriveJSON1 defaultOptions ''NString)
$(deriveJSON1 defaultOptions ''Params)
--x $(deriveJSON1 defaultOptions ''Binding)
$(deriveJSON1 defaultOptions ''Antiquoted)
$(deriveJSON2 defaultOptions ''Antiquoted)

instance (Binary v, Binary a) => Binary (Antiquoted v a)
instance Binary a => Binary (NString a)
instance Binary a => Binary (Binding a)
instance Binary Pos where
  put :: Pos -> Put
put x :: Pos
x = Int -> Put
forall t. Binary t => t -> Put
Bin.put (Pos -> Int
unPos Pos
x)
  get :: Get Pos
get = Int -> Pos
mkPos (Int -> Pos) -> Get Int -> Get Pos
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Int
forall t. Binary t => Get t
Bin.get
instance Binary SourcePos
instance Binary a => Binary (NKeyName a)
instance Binary a => Binary (Params a)
instance Binary NAtom
instance Binary NUnaryOp
instance Binary NBinaryOp
instance Binary NRecordType
instance Binary a => Binary (NExprF a)

instance (ToJSON v, ToJSON a) => ToJSON (Antiquoted v a)
instance ToJSON a => ToJSON (NString a)
instance ToJSON a => ToJSON (Binding a)
instance ToJSON Pos where
  toJSON :: Pos -> Value
toJSON x :: Pos
x = Int -> Value
forall a. ToJSON a => a -> Value
toJSON (Pos -> Int
unPos Pos
x)
instance ToJSON SourcePos
instance ToJSON a => ToJSON (NKeyName a)
instance ToJSON a => ToJSON (Params a)
instance ToJSON NAtom
instance ToJSON NUnaryOp
instance ToJSON NBinaryOp
instance ToJSON NRecordType
instance ToJSON a => ToJSON (NExprF a)

instance (FromJSON v, FromJSON a) => FromJSON (Antiquoted v a)
instance FromJSON a => FromJSON (NString a)
instance FromJSON a => FromJSON (Binding a)
instance FromJSON Pos where
  parseJSON :: Value -> Parser Pos
parseJSON = (Int -> Pos) -> Parser Int -> Parser Pos
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Pos
mkPos (Parser Int -> Parser Pos)
-> (Value -> Parser Int) -> Value -> Parser Pos
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Parser Int
forall a. FromJSON a => Value -> Parser a
parseJSON
instance FromJSON SourcePos
instance FromJSON a => FromJSON (NKeyName a)
instance FromJSON a => FromJSON (Params a)
instance FromJSON NAtom
instance FromJSON NUnaryOp
instance FromJSON NBinaryOp
instance FromJSON NRecordType
instance FromJSON a => FromJSON (NExprF a)

$(makeTraversals ''NExprF)
$(makeTraversals ''Binding)
$(makeTraversals ''Params)
$(makeTraversals ''Antiquoted)
$(makeTraversals ''NString)
$(makeTraversals ''NKeyName)
$(makeTraversals ''NUnaryOp)
$(makeTraversals ''NBinaryOp)

--x $(makeLenses ''Fix)

class NExprAnn ann g | g -> ann where
    fromNExpr :: g r -> (NExprF r, ann)
    toNExpr :: (NExprF r, ann) -> g r

ekey
  :: NExprAnn ann g
  => NonEmpty Text
  -> SourcePos
  -> Lens' (Fix g) (Maybe (Fix g))
ekey :: NonEmpty VarName -> SourcePos -> Lens' (Fix g) (Maybe (Fix g))
ekey keys :: NonEmpty VarName
keys pos :: SourcePos
pos f :: Maybe (Fix g) -> f (Maybe (Fix g))
f e :: Fix g
e@(Fix x :: g (Fix g)
x) | (NSet NNonRecursive xs :: [Binding (Fix g)]
xs, ann :: ann
ann) <- g (Fix g) -> (NExprF (Fix g), ann)
forall ann (g :: * -> *) r.
NExprAnn ann g =>
g r -> (NExprF r, ann)
fromNExpr g (Fix g)
x = case [Binding (Fix g)] -> [(Fix g, [VarName])]
go [Binding (Fix g)]
xs of
  ((v :: Fix g
v, []      ) : _) -> Fix g -> Maybe (Fix g) -> Fix g
forall a. a -> Maybe a -> a
fromMaybe Fix g
e (Maybe (Fix g) -> Fix g) -> f (Maybe (Fix g)) -> f (Fix g)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Fix g) -> f (Maybe (Fix g))
f (Fix g -> Maybe (Fix g)
forall a. a -> Maybe a
Just Fix g
v)
  ((v :: Fix g
v, r :: VarName
r : rest :: [VarName]
rest) : _) -> NonEmpty VarName
-> SourcePos -> LensLike' f (Fix g) (Maybe (Fix g))
forall ann (g :: * -> *).
NExprAnn ann g =>
NonEmpty VarName -> SourcePos -> Lens' (Fix g) (Maybe (Fix g))
ekey (VarName
r VarName -> [VarName] -> NonEmpty VarName
forall a. a -> [a] -> NonEmpty a
:| [VarName]
rest) SourcePos
pos Maybe (Fix g) -> f (Maybe (Fix g))
f Fix g
v

  _                   -> Maybe (Fix g) -> f (Maybe (Fix g))
f Maybe (Fix g)
forall a. Maybe a
Nothing f (Maybe (Fix g)) -> (Maybe (Fix g) -> Fix g) -> f (Fix g)
forall (f :: * -> *) a c. Functor f => f a -> (a -> c) -> f c
<&> \case
    Nothing -> Fix g
e
    Just v :: Fix g
v ->
      let entry :: Binding (Fix g)
entry = NAttrPath (Fix g) -> Fix g -> SourcePos -> Binding (Fix g)
forall r. NAttrPath r -> r -> SourcePos -> Binding r
NamedVar ((VarName -> NKeyName (Fix g))
-> NonEmpty VarName -> NAttrPath (Fix g)
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
NE.map VarName -> NKeyName (Fix g)
forall r. VarName -> NKeyName r
StaticKey NonEmpty VarName
keys) Fix g
v SourcePos
pos
      in  g (Fix g) -> Fix g
forall (f :: * -> *). f (Fix f) -> Fix f
Fix ((NExprF (Fix g), ann) -> g (Fix g)
forall ann (g :: * -> *) r.
NExprAnn ann g =>
(NExprF r, ann) -> g r
toNExpr (NRecordType -> [Binding (Fix g)] -> NExprF (Fix g)
forall r. NRecordType -> [Binding r] -> NExprF r
NSet NRecordType
NNonRecursive (Binding (Fix g)
entry Binding (Fix g) -> [Binding (Fix g)] -> [Binding (Fix g)]
forall a. a -> [a] -> [a]
: [Binding (Fix g)]
xs), ann
ann))
 where
  go :: [Binding (Fix g)] -> [(Fix g, [VarName])]
go xs :: [Binding (Fix g)]
xs = do
    let keys' :: [VarName]
keys' = NonEmpty VarName -> [VarName]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty VarName
keys
    (ks :: [VarName]
ks, rest :: [VarName]
rest) <- [[VarName]] -> [[VarName]] -> [([VarName], [VarName])]
forall a b. [a] -> [b] -> [(a, b)]
zip ([VarName] -> [[VarName]]
forall a. [a] -> [[a]]
inits [VarName]
keys') ([VarName] -> [[VarName]]
forall a. [a] -> [[a]]
tails [VarName]
keys')
    case [VarName]
ks of
      []     -> [(Fix g, [VarName])]
forall (f :: * -> *) a. Alternative f => f a
empty
      j :: VarName
j : js :: [VarName]
js -> do
        NamedVar ns :: NAttrPath (Fix g)
ns v :: Fix g
v _p :: SourcePos
_p <- [Binding (Fix g)]
xs
        Bool -> [()]
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (Bool -> [()]) -> Bool -> [()]
forall a b. (a -> b) -> a -> b
$ (VarName
j VarName -> [VarName] -> [VarName]
forall a. a -> [a] -> [a]
: [VarName]
js) [VarName] -> [VarName] -> Bool
forall a. Eq a => a -> a -> Bool
== (NAttrPath (Fix g) -> [NKeyName (Fix g)]
forall a. NonEmpty a -> [a]
NE.toList NAttrPath (Fix g)
ns [NKeyName (Fix g)]
-> Fold [NKeyName (Fix g)] [NKeyName (Fix g)] VarName VarName
-> [VarName]
forall s t a b. s -> Fold s t a b -> [a]
^.. (NKeyName (Fix g) -> f (NKeyName (Fix g)))
-> [NKeyName (Fix g)] -> f [NKeyName (Fix g)]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((NKeyName (Fix g) -> f (NKeyName (Fix g)))
 -> [NKeyName (Fix g)] -> f [NKeyName (Fix g)])
-> ((VarName -> f VarName)
    -> NKeyName (Fix g) -> f (NKeyName (Fix g)))
-> (VarName -> f VarName)
-> [NKeyName (Fix g)]
-> f [NKeyName (Fix g)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (VarName -> f VarName) -> NKeyName (Fix g) -> f (NKeyName (Fix g))
forall (f :: * -> *) r.
Applicative f =>
(VarName -> f VarName) -> NKeyName r -> f (NKeyName r)
_StaticKey)
        (Fix g, [VarName]) -> [(Fix g, [VarName])]
forall (m :: * -> *) a. Monad m => a -> m a
return (Fix g
v, [VarName]
rest)

ekey _ _ f :: Maybe (Fix g) -> f (Maybe (Fix g))
f e :: Fix g
e = Fix g -> Maybe (Fix g) -> Fix g
forall a. a -> Maybe a -> a
fromMaybe Fix g
e (Maybe (Fix g) -> Fix g) -> f (Maybe (Fix g)) -> f (Fix g)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Fix g) -> f (Maybe (Fix g))
f Maybe (Fix g)
forall a. Maybe a
Nothing

stripPositionInfo :: NExpr -> NExpr
stripPositionInfo :: NExpr -> NExpr
stripPositionInfo = (forall x. NExprF x -> NExprF x) -> NExpr -> NExpr
forall (g :: * -> *) (f :: * -> *).
Functor g =>
(forall x. f x -> g x) -> Fix f -> Fix g
transport forall x. NExprF x -> NExprF x
phi
 where
  phi :: NExprF r -> NExprF r
phi (NSet recur :: NRecordType
recur binds :: [Binding r]
binds) = NRecordType -> [Binding r] -> NExprF r
forall r. NRecordType -> [Binding r] -> NExprF r
NSet NRecordType
recur ((Binding r -> Binding r) -> [Binding r] -> [Binding r]
forall a b. (a -> b) -> [a] -> [b]
map Binding r -> Binding r
forall r. Binding r -> Binding r
go [Binding r]
binds)
  phi (NLet binds :: [Binding r]
binds body :: r
body) = [Binding r] -> r -> NExprF r
forall r. [Binding r] -> r -> NExprF r
NLet ((Binding r -> Binding r) -> [Binding r] -> [Binding r]
forall a b. (a -> b) -> [a] -> [b]
map Binding r -> Binding r
forall r. Binding r -> Binding r
go [Binding r]
binds) r
body
  phi x :: NExprF r
x                 = NExprF r
x

  go :: Binding r -> Binding r
go (NamedVar path :: NAttrPath r
path r :: r
r     _pos :: SourcePos
_pos) = NAttrPath r -> r -> SourcePos -> Binding r
forall r. NAttrPath r -> r -> SourcePos -> Binding r
NamedVar NAttrPath r
path r
r SourcePos
nullPos
  go (Inherit  ms :: Maybe r
ms   names :: [NKeyName r]
names _pos :: SourcePos
_pos) = Maybe r -> [NKeyName r] -> SourcePos -> Binding r
forall r. Maybe r -> [NKeyName r] -> SourcePos -> Binding r
Inherit Maybe r
ms [NKeyName r]
names SourcePos
nullPos

nullPos :: SourcePos
nullPos :: SourcePos
nullPos = String -> Pos -> Pos -> SourcePos
SourcePos "<string>" (Int -> Pos
mkPos 1) (Int -> Pos
mkPos 1)