{-# LANGUAGE UndecidableInstances #-}
-- | A set of functions for matching on Nix expression trees and extracting the
-- values of sub-trees.
module Nix.Match
  ( match
  , findMatches
  , Matchable(..)
  , GMatchable(..)
  , WithHoles(..)
  , addHoles
  , addHolesLoc
  , isOptionalPath
  ) where

import           Control.Category               ( (>>>) )
import           Control.Monad                  ( void )
import           Data.Data
import           Data.Fix
import           Data.Foldable
import           Data.List.NonEmpty             ( NonEmpty )
import           Data.Maybe
import           Data.Monoid             hiding ( All )
import           Data.Text                      ( Text )
import qualified Data.Text                     as T
import           GHC.Base                       ( NonEmpty((:|)) )
import           GHC.Generics
import           Nix

-- | Like 'Fix' but each layer could instead be a 'Hole'
data WithHoles t v
  = Hole !v
  | Term !(t (WithHoles t v))

deriving instance (Typeable t, Data (t (WithHoles t v)), Data v) => Data (WithHoles t v)

-- | Match a tree with holes against a tree without holes, returning the values
-- of the holes if it matches.
--
-- 'NExprF' and 'NExprLocF' are both instances of 'Matchable'. 'NExprLocF' does
-- not require the annotations to match. Please see the 'Matchable' instance
-- documentation for 'NExprF' for more details.
--
-- >>> import Nix.TH
-- >>> match (addHoles [nix|{foo = x: ^foo; bar = ^bar;}|]) [nix|{foo = x: "hello"; bar = "world"; baz = "!";}|]
-- Just [("bar",Fix (NStr (DoubleQuoted [Plain "world"]))),("foo",Fix (NStr (DoubleQuoted [Plain "hello"])))]
match :: Matchable t => WithHoles t v -> Fix t -> Maybe [(v, Fix t)]
match :: WithHoles t v -> Fix t -> Maybe [(v, Fix t)]
match = (Endo [(v, Fix t)] -> [(v, Fix t)])
-> Maybe (Endo [(v, Fix t)]) -> Maybe [(v, Fix t)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Endo [(v, Fix t)] -> [(v, Fix t)] -> [(v, Fix t)]
forall a. Endo a -> a -> a
`appEndo` []) (Maybe (Endo [(v, Fix t)]) -> Maybe [(v, Fix t)])
-> (WithHoles t v -> Fix t -> Maybe (Endo [(v, Fix t)]))
-> WithHoles t v
-> Fix t
-> Maybe [(v, Fix t)]
forall b c a1 a2. (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
.: WithHoles t v -> Fix t -> Maybe (Endo [(v, Fix t)])
forall a. WithHoles t a -> Fix t -> Maybe (Endo [(a, Fix t)])
go
 where
  go :: WithHoles t a -> Fix t -> Maybe (Endo [(a, Fix t)])
go = \case
    Hole v :: a
v -> \t :: Fix t
t -> Endo [(a, Fix t)] -> Maybe (Endo [(a, Fix t)])
forall a. a -> Maybe a
Just (([(a, Fix t)] -> [(a, Fix t)]) -> Endo [(a, Fix t)]
forall a. (a -> a) -> Endo a
Endo ((a
v, Fix t
t) (a, Fix t) -> [(a, Fix t)] -> [(a, Fix t)]
forall a. a -> [a] -> [a]
:))
    Term s :: t (WithHoles t a)
s -> \(Fix t :: t (Fix t)
t) -> do
      t (WithHoles t a, Fix t)
m <- t (WithHoles t a) -> t (Fix t) -> Maybe (t (WithHoles t a, Fix t))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft t (WithHoles t a)
s t (Fix t)
t
      ([Endo [(a, Fix t)]] -> Endo [(a, Fix t)])
-> Maybe [Endo [(a, Fix t)]] -> Maybe (Endo [(a, Fix t)])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Endo [(a, Fix t)]] -> Endo [(a, Fix t)]
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold (Maybe [Endo [(a, Fix t)]] -> Maybe (Endo [(a, Fix t)]))
-> (t (WithHoles t a, Fix t) -> Maybe [Endo [(a, Fix t)]])
-> t (WithHoles t a, Fix t)
-> Maybe (Endo [(a, Fix t)])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((WithHoles t a, Fix t) -> Maybe (Endo [(a, Fix t)]))
-> [(WithHoles t a, Fix t)] -> Maybe [Endo [(a, Fix t)]]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((WithHoles t a -> Fix t -> Maybe (Endo [(a, Fix t)]))
-> (WithHoles t a, Fix t) -> Maybe (Endo [(a, Fix t)])
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry WithHoles t a -> Fix t -> Maybe (Endo [(a, Fix t)])
go) ([(WithHoles t a, Fix t)] -> Maybe [Endo [(a, Fix t)]])
-> (t (WithHoles t a, Fix t) -> [(WithHoles t a, Fix t)])
-> t (WithHoles t a, Fix t)
-> Maybe [Endo [(a, Fix t)]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t (WithHoles t a, Fix t) -> [(WithHoles t a, Fix t)]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (t (WithHoles t a, Fix t) -> Maybe (Endo [(a, Fix t)]))
-> t (WithHoles t a, Fix t) -> Maybe (Endo [(a, Fix t)])
forall a b. (a -> b) -> a -> b
$ t (WithHoles t a, Fix t)
m

-- | Find all the needles in a haystack, returning the matched expression as
-- well as their filled holes. Results are returned productively in preorder.
--
-- >>> import Nix.TH
-- >>> import Control.Arrow
-- >>> pretty = prettyNix *** (fmap @[] (fmap @((,) Text) prettyNix))
-- >>> pretty <$> findMatches (addHoles [nix|{x=^x;}|]) [nix|{x=1;a={x=2;};}|]
-- [({ x = 1; a = { x = 2; }; },[("x",1)]),({ x = 2; },[("x",2)])]
findMatches
  :: Matchable t
  => WithHoles t v
  -- ^ Needle
  -> Fix t
  -- ^ Haystack
  -> [(Fix t, [(v, Fix t)])]
findMatches :: WithHoles t v -> Fix t -> [(Fix t, [(v, Fix t)])]
findMatches needle :: WithHoles t v
needle haystack :: Fix t
haystack =
  [ (Fix t
s, [(v, Fix t)]
r) | Fix t
s <- Fix t -> [Fix t]
forall (f :: * -> *). Foldable f => Fix f -> [Fix f]
fixUniverse Fix t
haystack, Just r :: [(v, Fix t)]
r <- Maybe [(v, Fix t)] -> [Maybe [(v, Fix t)]]
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe [(v, Fix t)] -> [Maybe [(v, Fix t)]])
-> Maybe [(v, Fix t)] -> [Maybe [(v, Fix t)]]
forall a b. (a -> b) -> a -> b
$ WithHoles t v -> Fix t -> Maybe [(v, Fix t)]
forall (t :: * -> *) v.
Matchable t =>
WithHoles t v -> Fix t -> Maybe [(v, Fix t)]
match WithHoles t v
needle Fix t
s ]

-- | Get every @f@ in a @Fix f@ in preorder.
fixUniverse :: Foldable f => Fix f -> [Fix f]
fixUniverse :: Fix f -> [Fix f]
fixUniverse e :: Fix f
e = Fix f
e Fix f -> [Fix f] -> [Fix f]
forall a. a -> [a] -> [a]
: (Fix f -> [Fix f]
forall (f :: * -> *). Foldable f => Fix f -> [Fix f]
fixUniverse (Fix f -> [Fix f]) -> [Fix f] -> [Fix f]
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< f (Fix f) -> [Fix f]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Fix f -> f (Fix f)
forall (f :: * -> *). Fix f -> f (Fix f)
unFix Fix f
e))

-- | Make syntactic holes into 'Hole's
addHoles :: NExpr -> WithHoles NExprF Text
addHoles :: NExpr -> WithHoles NExprF Text
addHoles = NExpr -> NExprF NExpr
forall (f :: * -> *). Fix f -> f (Fix f)
unFix (NExpr -> NExprF NExpr)
-> (NExprF NExpr -> WithHoles NExprF Text)
-> NExpr
-> WithHoles NExprF Text
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> \case
  NSynHole n :: Text
n -> Text -> WithHoles NExprF Text
forall (t :: * -> *) v. v -> WithHoles t v
Hole Text
n
  e :: NExprF NExpr
e          -> NExprF (WithHoles NExprF Text) -> WithHoles NExprF Text
forall (t :: * -> *) v. t (WithHoles t v) -> WithHoles t v
Term (NExprF (WithHoles NExprF Text) -> WithHoles NExprF Text)
-> (NExprF NExpr -> NExprF (WithHoles NExprF Text))
-> NExprF NExpr
-> WithHoles NExprF Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NExpr -> WithHoles NExprF Text)
-> NExprF NExpr -> NExprF (WithHoles NExprF Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NExpr -> WithHoles NExprF Text
addHoles (NExprF NExpr -> WithHoles NExprF Text)
-> NExprF NExpr -> WithHoles NExprF Text
forall a b. (a -> b) -> a -> b
$ NExprF NExpr
e

-- | Make syntactic holes into 'Hole's
addHolesLoc :: NExprLoc -> WithHoles NExprLocF Text
addHolesLoc :: NExprLoc -> WithHoles NExprLocF Text
addHolesLoc = NExprLoc -> NExprLocF NExprLoc
forall (f :: * -> *). Fix f -> f (Fix f)
unFix (NExprLoc -> NExprLocF NExprLoc)
-> (NExprLocF NExprLoc -> WithHoles NExprLocF Text)
-> NExprLoc
-> WithHoles NExprLocF Text
forall k (cat :: k -> k -> *) (a :: k) (b :: k) (c :: k).
Category cat =>
cat a b -> cat b c -> cat a c
>>> \case
  Compose (Ann _ (NSynHole n :: Text
n)) -> Text -> WithHoles NExprLocF Text
forall (t :: * -> *) v. v -> WithHoles t v
Hole Text
n
  e :: NExprLocF NExprLoc
e                            -> NExprLocF (WithHoles NExprLocF Text) -> WithHoles NExprLocF Text
forall (t :: * -> *) v. t (WithHoles t v) -> WithHoles t v
Term (NExprLocF (WithHoles NExprLocF Text) -> WithHoles NExprLocF Text)
-> (NExprLocF NExprLoc -> NExprLocF (WithHoles NExprLocF Text))
-> NExprLocF NExprLoc
-> WithHoles NExprLocF Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NExprLoc -> WithHoles NExprLocF Text)
-> NExprLocF NExprLoc -> NExprLocF (WithHoles NExprLocF Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NExprLoc -> WithHoles NExprLocF Text
addHolesLoc (NExprLocF NExprLoc -> WithHoles NExprLocF Text)
-> NExprLocF NExprLoc -> WithHoles NExprLocF Text
forall a b. (a -> b) -> a -> b
$ NExprLocF NExprLoc
e

----------------------------------------------------------------
-- Matchable
----------------------------------------------------------------

-- | Instances for this class can be derived for any type with a 'Generic1'
-- instance.
class Traversable t => Matchable t where
  -- | Match one level of structure, returning the matched structure with sub
  -- structures to match. Needle is the first argument, matchee is the second.
  --
  -- Unlike the @Unifiable@ class in the "unification-fd" package, this doesn't
  -- have to be a commutative operation, the needle will always be the first
  -- parameter and instances are free to treat if differently if appropriate.
  zipMatchLeft :: t a -> t b -> Maybe (t (a,b))
  default zipMatchLeft
    :: (Generic1 t, GMatchable (Rep1 t))
    => t a
    -> t b
    -> Maybe (t (a, b))
  zipMatchLeft l :: t a
l r :: t b
r = Rep1 t (a, b) -> t (a, b)
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (Rep1 t (a, b) -> t (a, b))
-> Maybe (Rep1 t (a, b)) -> Maybe (t (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rep1 t a -> Rep1 t b -> Maybe (Rep1 t (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft (t a -> Rep1 t a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 t a
l) (t b -> Rep1 t b
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 t b
r)

-- | Match a composition of 'Matchable' things
zipMatchLeft2
  :: (Matchable f, Matchable t) => t (f a) -> t (f b) -> Maybe (t (f (a, b)))
zipMatchLeft2 :: t (f a) -> t (f b) -> Maybe (t (f (a, b)))
zipMatchLeft2 a :: t (f a)
a b :: t (f b)
b = t (f a) -> t (f b) -> Maybe (t (f a, f b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft t (f a)
a t (f b)
b Maybe (t (f a, f b))
-> (t (f a, f b) -> Maybe (t (f (a, b)))) -> Maybe (t (f (a, b)))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ((f a, f b) -> Maybe (f (a, b)))
-> t (f a, f b) -> Maybe (t (f (a, b)))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((f a -> f b -> Maybe (f (a, b))) -> (f a, f b) -> Maybe (f (a, b))
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry f a -> f b -> Maybe (f (a, b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft)

----------------------------------------------------------------
-- Matchable instance for NExprF and NExprLocF
----------------------------------------------------------------

-- | There are a few special cases when matching expressions to make writing
-- matchers nicer:
--
-- - For attrsets and let bindings, the matching is done on the needle's keys
--   only. i.e. the matchee may have extra keys which are ignored.
--
-- - For attrsets and let bindings, bindings which have a LHS beginning with
--   @_@ are treated as optional. If they are not present then any holes on
--   their RHS will not be filled.
--
-- - Attrsets match ignoring recursiveness
--
-- - If a function in the needle has @_@ as its parameter, it matches
--   everything, so @_@ acts as a wildcard pattern.
instance Matchable NExprF where

  zipMatchLeft :: NExprF a -> NExprF b -> Maybe (NExprF (a, b))
zipMatchLeft (NSet _ bs1 :: [Binding a]
bs1) (NSet _ bs2 :: [Binding b]
bs2) = do
    (bs1' :: [Binding a]
bs1', bs2' :: [Binding b]
bs2') <- [(Binding a, Binding b)] -> ([Binding a], [Binding b])
forall a b. [(a, b)] -> ([a], [b])
unzip ([(Binding a, Binding b)] -> ([Binding a], [Binding b]))
-> Maybe [(Binding a, Binding b)]
-> Maybe ([Binding a], [Binding b])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Binding a] -> [Binding b] -> Maybe [(Binding a, Binding b)]
forall q r.
[Binding q] -> [Binding r] -> Maybe [(Binding q, Binding r)]
reduceBindings [Binding a]
bs1 [Binding b]
bs2
    D1
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  (a, b)
-> NExprF (a, b)
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (D1
   ('MetaData
      "NExprF"
      "Nix.Expr.Types"
      "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
      'False)
   ((((C1
         ('MetaCons "NConstant" 'PrefixI 'False)
         (S1
            ('MetaSel
               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
            (Rec0 NAtom))
       :+: C1
             ('MetaCons "NStr" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec1 NString)))
      :+: (C1
             ('MetaCons "NSym" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 Text))
           :+: C1
                 ('MetaCons "NList" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec1 []))))
     :+: ((C1
             ('MetaCons "NSet" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NRecordType)
              :*: S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding))
           :+: C1
                 ('MetaCons "NLiteralPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath)))
          :+: (C1
                 ('MetaCons "NEnvPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath))
               :+: C1
                     ('MetaCons "NUnary" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec0 NUnaryOp)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1))))
    :+: (((C1
             ('MetaCons "NBinary" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NBinaryOp)
              :*: (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     Par1
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1))
           :+: C1
                 ('MetaCons "NSelect" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (NonEmpty :.: Rec1 NKeyName)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Maybe))))
          :+: (C1
                 ('MetaCons "NHasAttr" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName))
               :+: C1
                     ('MetaCons "NAbs" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec1 Params)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)))
         :+: ((C1
                 ('MetaCons "NLet" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding)
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1)
               :+: C1
                     ('MetaCons "NIf" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: (C1
                     ('MetaCons "NWith" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)
                   :+: (C1
                          ('MetaCons "NAssert" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: C1
                              ('MetaCons "NSynHole" 'PrefixI 'False)
                              (S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 (Rec0 Text)))))))
   (a, b)
 -> NExprF (a, b))
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
-> Maybe (NExprF (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> M1
  D
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  a
-> M1
     D
     ('MetaData
        "NExprF"
        "Nix.Expr.Types"
        "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
        'False)
     ((((C1
           ('MetaCons "NConstant" 'PrefixI 'False)
           (S1
              ('MetaSel
                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
              (Rec0 NAtom))
         :+: C1
               ('MetaCons "NStr" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec1 NString)))
        :+: (C1
               ('MetaCons "NSym" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 Text))
             :+: C1
                   ('MetaCons "NList" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec1 []))))
       :+: ((C1
               ('MetaCons "NSet" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NRecordType)
                :*: S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding))
             :+: C1
                   ('MetaCons "NLiteralPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath)))
            :+: (C1
                   ('MetaCons "NEnvPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath))
                 :+: C1
                       ('MetaCons "NUnary" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec0 NUnaryOp)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))))
      :+: (((C1
               ('MetaCons "NBinary" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NBinaryOp)
                :*: (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))
             :+: C1
                   ('MetaCons "NSelect" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: (S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           (NonEmpty :.: Rec1 NKeyName)
                         :*: S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               (Rec1 Maybe))))
            :+: (C1
                   ('MetaCons "NHasAttr" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (NonEmpty :.: Rec1 NKeyName))
                 :+: C1
                       ('MetaCons "NAbs" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec1 Params)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)))
           :+: ((C1
                   ('MetaCons "NLet" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding)
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1)
                 :+: C1
                       ('MetaCons "NIf" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)))
                :+: (C1
                       ('MetaCons "NWith" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)
                     :+: (C1
                            ('MetaCons "NAssert" 'PrefixI 'False)
                            (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)
                          :+: C1
                                ('MetaCons "NSynHole" 'PrefixI 'False)
                                (S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   (Rec0 Text)))))))
     b
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft (NExprF a -> Rep1 NExprF a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 (NRecordType -> [Binding a] -> NExprF a
forall r. NRecordType -> [Binding r] -> NExprF r
NSet NRecordType
NNonRecursive [Binding a]
bs1'))
                          (NExprF b -> Rep1 NExprF b
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 (NRecordType -> [Binding b] -> NExprF b
forall r. NRecordType -> [Binding r] -> NExprF r
NSet NRecordType
NNonRecursive [Binding b]
bs2'))

  zipMatchLeft (NLet bs1 :: [Binding a]
bs1 e1 :: a
e1) (NLet bs2 :: [Binding b]
bs2 e2 :: b
e2) = do
    (bs1' :: [Binding a]
bs1', bs2' :: [Binding b]
bs2') <- [(Binding a, Binding b)] -> ([Binding a], [Binding b])
forall a b. [(a, b)] -> ([a], [b])
unzip ([(Binding a, Binding b)] -> ([Binding a], [Binding b]))
-> Maybe [(Binding a, Binding b)]
-> Maybe ([Binding a], [Binding b])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Binding a] -> [Binding b] -> Maybe [(Binding a, Binding b)]
forall q r.
[Binding q] -> [Binding r] -> Maybe [(Binding q, Binding r)]
reduceBindings [Binding a]
bs1 [Binding b]
bs2
    D1
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  (a, b)
-> NExprF (a, b)
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (D1
   ('MetaData
      "NExprF"
      "Nix.Expr.Types"
      "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
      'False)
   ((((C1
         ('MetaCons "NConstant" 'PrefixI 'False)
         (S1
            ('MetaSel
               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
            (Rec0 NAtom))
       :+: C1
             ('MetaCons "NStr" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec1 NString)))
      :+: (C1
             ('MetaCons "NSym" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 Text))
           :+: C1
                 ('MetaCons "NList" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec1 []))))
     :+: ((C1
             ('MetaCons "NSet" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NRecordType)
              :*: S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding))
           :+: C1
                 ('MetaCons "NLiteralPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath)))
          :+: (C1
                 ('MetaCons "NEnvPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath))
               :+: C1
                     ('MetaCons "NUnary" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec0 NUnaryOp)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1))))
    :+: (((C1
             ('MetaCons "NBinary" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NBinaryOp)
              :*: (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     Par1
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1))
           :+: C1
                 ('MetaCons "NSelect" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (NonEmpty :.: Rec1 NKeyName)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Maybe))))
          :+: (C1
                 ('MetaCons "NHasAttr" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName))
               :+: C1
                     ('MetaCons "NAbs" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec1 Params)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)))
         :+: ((C1
                 ('MetaCons "NLet" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding)
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1)
               :+: C1
                     ('MetaCons "NIf" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: (C1
                     ('MetaCons "NWith" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)
                   :+: (C1
                          ('MetaCons "NAssert" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: C1
                              ('MetaCons "NSynHole" 'PrefixI 'False)
                              (S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 (Rec0 Text)))))))
   (a, b)
 -> NExprF (a, b))
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
-> Maybe (NExprF (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> M1
  D
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  a
-> M1
     D
     ('MetaData
        "NExprF"
        "Nix.Expr.Types"
        "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
        'False)
     ((((C1
           ('MetaCons "NConstant" 'PrefixI 'False)
           (S1
              ('MetaSel
                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
              (Rec0 NAtom))
         :+: C1
               ('MetaCons "NStr" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec1 NString)))
        :+: (C1
               ('MetaCons "NSym" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 Text))
             :+: C1
                   ('MetaCons "NList" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec1 []))))
       :+: ((C1
               ('MetaCons "NSet" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NRecordType)
                :*: S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding))
             :+: C1
                   ('MetaCons "NLiteralPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath)))
            :+: (C1
                   ('MetaCons "NEnvPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath))
                 :+: C1
                       ('MetaCons "NUnary" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec0 NUnaryOp)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))))
      :+: (((C1
               ('MetaCons "NBinary" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NBinaryOp)
                :*: (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))
             :+: C1
                   ('MetaCons "NSelect" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: (S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           (NonEmpty :.: Rec1 NKeyName)
                         :*: S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               (Rec1 Maybe))))
            :+: (C1
                   ('MetaCons "NHasAttr" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (NonEmpty :.: Rec1 NKeyName))
                 :+: C1
                       ('MetaCons "NAbs" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec1 Params)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)))
           :+: ((C1
                   ('MetaCons "NLet" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding)
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1)
                 :+: C1
                       ('MetaCons "NIf" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)))
                :+: (C1
                       ('MetaCons "NWith" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)
                     :+: (C1
                            ('MetaCons "NAssert" 'PrefixI 'False)
                            (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)
                          :+: C1
                                ('MetaCons "NSynHole" 'PrefixI 'False)
                                (S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   (Rec0 Text)))))))
     b
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft (NExprF a -> Rep1 NExprF a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 ([Binding a] -> a -> NExprF a
forall r. [Binding r] -> r -> NExprF r
NLet [Binding a]
bs1' a
e1)) (NExprF b -> Rep1 NExprF b
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 ([Binding b] -> b -> NExprF b
forall r. [Binding r] -> r -> NExprF r
NLet [Binding b]
bs2' b
e2))

  zipMatchLeft (NAbs (Param "_") e1 :: a
e1) (NAbs _ e2 :: b
e2) = do
    NExprF (a, b) -> Maybe (NExprF (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NExprF (a, b) -> Maybe (NExprF (a, b)))
-> NExprF (a, b) -> Maybe (NExprF (a, b))
forall a b. (a -> b) -> a -> b
$ Params (a, b) -> (a, b) -> NExprF (a, b)
forall r. Params r -> r -> NExprF r
NAbs (Text -> Params (a, b)
forall r. Text -> Params r
Param "_") (a
e1, b
e2)

  zipMatchLeft l :: NExprF a
l r :: NExprF b
r = D1
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  (a, b)
-> NExprF (a, b)
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (D1
   ('MetaData
      "NExprF"
      "Nix.Expr.Types"
      "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
      'False)
   ((((C1
         ('MetaCons "NConstant" 'PrefixI 'False)
         (S1
            ('MetaSel
               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
            (Rec0 NAtom))
       :+: C1
             ('MetaCons "NStr" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec1 NString)))
      :+: (C1
             ('MetaCons "NSym" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 Text))
           :+: C1
                 ('MetaCons "NList" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec1 []))))
     :+: ((C1
             ('MetaCons "NSet" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NRecordType)
              :*: S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding))
           :+: C1
                 ('MetaCons "NLiteralPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath)))
          :+: (C1
                 ('MetaCons "NEnvPath" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    (Rec0 FilePath))
               :+: C1
                     ('MetaCons "NUnary" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec0 NUnaryOp)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1))))
    :+: (((C1
             ('MetaCons "NBinary" 'PrefixI 'False)
             (S1
                ('MetaSel
                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                (Rec0 NBinaryOp)
              :*: (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     Par1
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1))
           :+: C1
                 ('MetaCons "NSelect" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (NonEmpty :.: Rec1 NKeyName)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Maybe))))
          :+: (C1
                 ('MetaCons "NHasAttr" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName))
               :+: C1
                     ('MetaCons "NAbs" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (Rec1 Params)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)))
         :+: ((C1
                 ('MetaCons "NLet" 'PrefixI 'False)
                 (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    ([] :.: Rec1 Binding)
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1)
               :+: C1
                     ('MetaCons "NIf" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: (C1
                     ('MetaCons "NWith" 'PrefixI 'False)
                     (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1)
                   :+: (C1
                          ('MetaCons "NAssert" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: C1
                              ('MetaCons "NSynHole" 'PrefixI 'False)
                              (S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 (Rec0 Text)))))))
   (a, b)
 -> NExprF (a, b))
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
-> Maybe (NExprF (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> M1
  D
  ('MetaData
     "NExprF"
     "Nix.Expr.Types"
     "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
     'False)
  ((((C1
        ('MetaCons "NConstant" 'PrefixI 'False)
        (S1
           ('MetaSel
              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
           (Rec0 NAtom))
      :+: C1
            ('MetaCons "NStr" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec1 NString)))
     :+: (C1
            ('MetaCons "NSym" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 Text))
          :+: C1
                ('MetaCons "NList" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec1 []))))
    :+: ((C1
            ('MetaCons "NSet" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NRecordType)
             :*: S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding))
          :+: C1
                ('MetaCons "NLiteralPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath)))
         :+: (C1
                ('MetaCons "NEnvPath" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   (Rec0 FilePath))
              :+: C1
                    ('MetaCons "NUnary" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec0 NUnaryOp)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))))
   :+: (((C1
            ('MetaCons "NBinary" 'PrefixI 'False)
            (S1
               ('MetaSel
                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
               (Rec0 NBinaryOp)
             :*: (S1
                    ('MetaSel
                       'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                    Par1
                  :*: S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        Par1))
          :+: C1
                ('MetaCons "NSelect" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: (S1
                        ('MetaSel
                           'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                        (NonEmpty :.: Rec1 NKeyName)
                      :*: S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            (Rec1 Maybe))))
         :+: (C1
                ('MetaCons "NHasAttr" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   Par1
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (NonEmpty :.: Rec1 NKeyName))
              :+: C1
                    ('MetaCons "NAbs" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       (Rec1 Params)
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)))
        :+: ((C1
                ('MetaCons "NLet" 'PrefixI 'False)
                (S1
                   ('MetaSel
                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                   ([] :.: Rec1 Binding)
                 :*: S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1)
              :+: C1
                    ('MetaCons "NIf" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)))
             :+: (C1
                    ('MetaCons "NWith" 'PrefixI 'False)
                    (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1)
                  :+: (C1
                         ('MetaCons "NAssert" 'PrefixI 'False)
                         (S1
                            ('MetaSel
                               'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                            Par1
                          :*: S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                Par1)
                       :+: C1
                             ('MetaCons "NSynHole" 'PrefixI 'False)
                             (S1
                                ('MetaSel
                                   'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                (Rec0 Text)))))))
  a
-> M1
     D
     ('MetaData
        "NExprF"
        "Nix.Expr.Types"
        "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
        'False)
     ((((C1
           ('MetaCons "NConstant" 'PrefixI 'False)
           (S1
              ('MetaSel
                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
              (Rec0 NAtom))
         :+: C1
               ('MetaCons "NStr" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec1 NString)))
        :+: (C1
               ('MetaCons "NSym" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 Text))
             :+: C1
                   ('MetaCons "NList" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec1 []))))
       :+: ((C1
               ('MetaCons "NSet" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NRecordType)
                :*: S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding))
             :+: C1
                   ('MetaCons "NLiteralPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath)))
            :+: (C1
                   ('MetaCons "NEnvPath" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      (Rec0 FilePath))
                 :+: C1
                       ('MetaCons "NUnary" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec0 NUnaryOp)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))))
      :+: (((C1
               ('MetaCons "NBinary" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                  (Rec0 NBinaryOp)
                :*: (S1
                       ('MetaSel
                          'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                       Par1
                     :*: S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           Par1))
             :+: C1
                   ('MetaCons "NSelect" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: (S1
                           ('MetaSel
                              'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                           (NonEmpty :.: Rec1 NKeyName)
                         :*: S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               (Rec1 Maybe))))
            :+: (C1
                   ('MetaCons "NHasAttr" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      Par1
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (NonEmpty :.: Rec1 NKeyName))
                 :+: C1
                       ('MetaCons "NAbs" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          (Rec1 Params)
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)))
           :+: ((C1
                   ('MetaCons "NLet" 'PrefixI 'False)
                   (S1
                      ('MetaSel
                         'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                      ([] :.: Rec1 Binding)
                    :*: S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1)
                 :+: C1
                       ('MetaCons "NIf" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)))
                :+: (C1
                       ('MetaCons "NWith" 'PrefixI 'False)
                       (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1)
                     :+: (C1
                            ('MetaCons "NAssert" 'PrefixI 'False)
                            (S1
                               ('MetaSel
                                  'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                               Par1
                             :*: S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   Par1)
                          :+: C1
                                ('MetaCons "NSynHole" 'PrefixI 'False)
                                (S1
                                   ('MetaSel
                                      'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                   (Rec0 Text)))))))
     b
-> Maybe
     (D1
        ('MetaData
           "NExprF"
           "Nix.Expr.Types"
           "hnix-0.11.0-HCVhUmIJlUZ32fis3dm6v2"
           'False)
        ((((C1
              ('MetaCons "NConstant" 'PrefixI 'False)
              (S1
                 ('MetaSel
                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                 (Rec0 NAtom))
            :+: C1
                  ('MetaCons "NStr" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec1 NString)))
           :+: (C1
                  ('MetaCons "NSym" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 Text))
                :+: C1
                      ('MetaCons "NList" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec1 []))))
          :+: ((C1
                  ('MetaCons "NSet" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NRecordType)
                   :*: S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding))
                :+: C1
                      ('MetaCons "NLiteralPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath)))
               :+: (C1
                      ('MetaCons "NEnvPath" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         (Rec0 FilePath))
                    :+: C1
                          ('MetaCons "NUnary" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec0 NUnaryOp)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1))))
         :+: (((C1
                  ('MetaCons "NBinary" 'PrefixI 'False)
                  (S1
                     ('MetaSel
                        'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                     (Rec0 NBinaryOp)
                   :*: (S1
                          ('MetaSel
                             'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                          Par1
                        :*: S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              Par1))
                :+: C1
                      ('MetaCons "NSelect" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: (S1
                              ('MetaSel
                                 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                              (NonEmpty :.: Rec1 NKeyName)
                            :*: S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  (Rec1 Maybe))))
               :+: (C1
                      ('MetaCons "NHasAttr" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         Par1
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (NonEmpty :.: Rec1 NKeyName))
                    :+: C1
                          ('MetaCons "NAbs" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             (Rec1 Params)
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)))
              :+: ((C1
                      ('MetaCons "NLet" 'PrefixI 'False)
                      (S1
                         ('MetaSel
                            'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                         ([] :.: Rec1 Binding)
                       :*: S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1)
                    :+: C1
                          ('MetaCons "NIf" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)))
                   :+: (C1
                          ('MetaCons "NWith" 'PrefixI 'False)
                          (S1
                             ('MetaSel
                                'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                             Par1
                           :*: S1
                                 ('MetaSel
                                    'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                 Par1)
                        :+: (C1
                               ('MetaCons "NAssert" 'PrefixI 'False)
                               (S1
                                  ('MetaSel
                                     'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict)
                                  Par1
                                :*: S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      Par1)
                             :+: C1
                                   ('MetaCons "NSynHole" 'PrefixI 'False)
                                   (S1
                                      ('MetaSel
                                         'Nothing
                                         'NoSourceUnpackedness
                                         'SourceStrict
                                         'DecidedStrict)
                                      (Rec0 Text)))))))
        (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft (NExprF a -> Rep1 NExprF a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 NExprF a
l) (NExprF b -> Rep1 NExprF b
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1 NExprF b
r)

-- | Bindings are compared on top level structure only.
--
-- Doesn't filter bindings in the needle, as they must all be present
--
-- Bindings are returned according to their order in the needle.
--
-- Any optional (name begins with @_@) bindings may be removed from the needle.
--
-- Left hand sides are matched purely on the top level structure, this means
-- that "${a}" and "${b}" appear the same to this function, and it may not
-- match them up correctly.
reduceBindings :: [Binding q] -> [Binding r] -> Maybe [(Binding q, Binding r)]
reduceBindings :: [Binding q] -> [Binding r] -> Maybe [(Binding q, Binding r)]
reduceBindings needle :: [Binding q]
needle matchee :: [Binding r]
matchee =
  let
    -- A binding is optional if the lhs starts with a '_', return the same
    -- binding but without the '_'
      isOptional :: Binding r -> Maybe (Binding r)
isOptional = \case
        NamedVar p :: NAttrPath r
p e :: r
e l :: SourcePos
l | Just p' :: NAttrPath r
p' <- NAttrPath r -> Maybe (NAttrPath r)
forall r. NAttrPath r -> Maybe (NAttrPath r)
isOptionalPath NAttrPath r
p -> Binding r -> Maybe (Binding r)
forall a. a -> Maybe a
Just (NAttrPath r -> r -> SourcePos -> Binding r
forall r. NAttrPath r -> r -> SourcePos -> Binding r
NamedVar NAttrPath r
p' r
e SourcePos
l)
        _ -> Maybe (Binding r)
forall a. Maybe a
Nothing

      -- Get a representation of the left hand side which has an Eq instance
      -- This will represent some things the samelike "${a}" and "${b}"
      getLHS :: Binding a
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
getLHS = \case
        NamedVar p :: NAttrPath a
p _  _ -> NonEmpty (NKeyName ())
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
forall a b. a -> Either a b
Left ((NKeyName a -> NKeyName ())
-> NAttrPath a -> NonEmpty (NKeyName ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NKeyName a -> NKeyName ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void NAttrPath a
p)
        Inherit  r :: Maybe a
r ps :: [NKeyName a]
ps _ -> (Maybe (), [NKeyName ()])
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
forall a b. b -> Either a b
Right (Maybe a -> Maybe ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void Maybe a
r, (NKeyName a -> NKeyName ()) -> [NKeyName a] -> [NKeyName ()]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NKeyName a -> NKeyName ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void [NKeyName a]
ps)
  in  [Maybe (Binding q, Binding r)] -> Maybe [(Binding q, Binding r)]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence
        [ (Binding q
n', ) (Binding r -> (Binding q, Binding r))
-> Maybe (Binding r) -> Maybe (Binding q, Binding r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Binding r)
m
        | -- For each binding in the needle
          Binding q
n <- [Binding q]
needle
        , let opt :: Maybe (Binding q)
opt = Binding q -> Maybe (Binding q)
forall r. Binding r -> Maybe (Binding r)
isOptional Binding q
n
              -- | Use the optional demangled version if present
              n' :: Binding q
n'  = Binding q -> Maybe (Binding q) -> Binding q
forall a. a -> Maybe a -> a
fromMaybe Binding q
n Maybe (Binding q)
opt
              lhs :: Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
lhs = Binding q
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
forall a.
Binding a
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
getLHS Binding q
n'
              -- Find the first matching binding in the matchee
              m :: Maybe (Binding r)
m   = (Binding r -> Bool) -> [Binding r] -> Maybe (Binding r)
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find ((Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
lhs Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
-> Bool
forall a. Eq a => a -> a -> Bool
==) (Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()]) -> Bool)
-> (Binding r
    -> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()]))
-> Binding r
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Binding r
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
forall a.
Binding a
-> Either (NonEmpty (NKeyName ())) (Maybe (), [NKeyName ()])
getLHS) [Binding r]
matchee
        , -- Skip this element if it is not present in the matchee and is optional in the needle
          Maybe (Binding q) -> Bool
forall a. Maybe a -> Bool
isNothing Maybe (Binding q)
opt Bool -> Bool -> Bool
|| Maybe (Binding r) -> Bool
forall a. Maybe a -> Bool
isJust Maybe (Binding r)
m
        ]

-- | Basically: does the path begin with an underscore, if so return it removed
-- without the underscore.
isOptionalPath :: NAttrPath r -> Maybe (NAttrPath r)
isOptionalPath :: NAttrPath r -> Maybe (NAttrPath r)
isOptionalPath = \case
  StaticKey n :: Text
n :| [] | Just ('_', t :: Text
t) <- Text -> Maybe (Char, Text)
T.uncons Text
n -> NAttrPath r -> Maybe (NAttrPath r)
forall a. a -> Maybe a
Just (Text -> NKeyName r
forall r. Text -> NKeyName r
StaticKey Text
t NKeyName r -> [NKeyName r] -> NAttrPath r
forall a. a -> [a] -> NonEmpty a
:| [])
  DynamicKey (Plain (DoubleQuoted [Plain n :: Text
n])) :| rs :: [NKeyName r]
rs
    | Just ('_', t :: Text
t) <- Text -> Maybe (Char, Text)
T.uncons Text
n -> NAttrPath r -> Maybe (NAttrPath r)
forall a. a -> Maybe a
Just
      (Antiquoted (NString r) r -> NKeyName r
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey (NString r -> Antiquoted (NString r) r
forall v r. v -> Antiquoted v r
Plain ([Antiquoted Text r] -> NString r
forall r. [Antiquoted Text r] -> NString r
DoubleQuoted [Text -> Antiquoted Text r
forall v r. v -> Antiquoted v r
Plain Text
t])) NKeyName r -> [NKeyName r] -> NAttrPath r
forall a. a -> [a] -> NonEmpty a
:| [NKeyName r]
rs)
  _ -> Maybe (NAttrPath r)
forall a. Maybe a
Nothing

--
-- hnix types
--

instance Matchable NString where

instance Matchable (Antiquoted Text) where

-- | The matched pair uses the source location of the first argument
instance Matchable Binding where
  zipMatchLeft :: Binding a -> Binding b -> Maybe (Binding (a, b))
zipMatchLeft (NamedVar p1 :: NAttrPath a
p1 v1 :: a
v1 _) (NamedVar p2 :: NAttrPath b
p2 v2 :: b
v2 l :: SourcePos
l) = do
    NonEmpty (NKeyName (a, b))
p <- NAttrPath a -> NAttrPath b -> Maybe (NonEmpty (NKeyName (a, b)))
forall (f :: * -> *) (t :: * -> *) a b.
(Matchable f, Matchable t) =>
t (f a) -> t (f b) -> Maybe (t (f (a, b)))
zipMatchLeft2 NAttrPath a
p1 NAttrPath b
p2
    Binding (a, b) -> Maybe (Binding (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NonEmpty (NKeyName (a, b)) -> (a, b) -> SourcePos -> Binding (a, b)
forall r. NAttrPath r -> r -> SourcePos -> Binding r
NamedVar NonEmpty (NKeyName (a, b))
p (a
v1, b
v2) SourcePos
l)

  zipMatchLeft (Inherit x1 :: Maybe a
x1 ys1 :: [NKeyName a]
ys1 l :: SourcePos
l) (Inherit x2 :: Maybe b
x2 ys2 :: [NKeyName b]
ys2 _) = do
    Maybe (a, b)
x  <- Maybe a -> Maybe b -> Maybe (Maybe (a, b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft Maybe a
x1 Maybe b
x2
    [NKeyName (a, b)]
ys <- [NKeyName a] -> [NKeyName b] -> Maybe [NKeyName (a, b)]
forall (f :: * -> *) (t :: * -> *) a b.
(Matchable f, Matchable t) =>
t (f a) -> t (f b) -> Maybe (t (f (a, b)))
zipMatchLeft2 [NKeyName a]
ys1 [NKeyName b]
ys2
    Binding (a, b) -> Maybe (Binding (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe (a, b) -> [NKeyName (a, b)] -> SourcePos -> Binding (a, b)
forall r. Maybe r -> [NKeyName r] -> SourcePos -> Binding r
Inherit Maybe (a, b)
x [NKeyName (a, b)]
ys SourcePos
l)

  zipMatchLeft _ _ = Maybe (Binding (a, b))
forall a. Maybe a
Nothing

-- | No Generic1 instance
instance Matchable NKeyName where
  zipMatchLeft :: NKeyName a -> NKeyName b -> Maybe (NKeyName (a, b))
zipMatchLeft (StaticKey k1 :: Text
k1) (StaticKey k2 :: Text
k2) | Text
k1 Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
k2 = NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall a. a -> Maybe a
Just (Text -> NKeyName (a, b)
forall r. Text -> NKeyName r
StaticKey Text
k1)
  zipMatchLeft (DynamicKey EscapedNewline) (DynamicKey EscapedNewline) =
    NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall a. a -> Maybe a
Just (Antiquoted (NString (a, b)) (a, b) -> NKeyName (a, b)
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey Antiquoted (NString (a, b)) (a, b)
forall v r. Antiquoted v r
EscapedNewline)
  zipMatchLeft (DynamicKey (Plain k1 :: NString a
k1)) (DynamicKey (Plain k2 :: NString b
k2)) = do
    NString (a, b)
k <- NString a -> NString b -> Maybe (NString (a, b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft NString a
k1 NString b
k2
    NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NKeyName (a, b) -> Maybe (NKeyName (a, b)))
-> NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall a b. (a -> b) -> a -> b
$ Antiquoted (NString (a, b)) (a, b) -> NKeyName (a, b)
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey (NString (a, b) -> Antiquoted (NString (a, b)) (a, b)
forall v r. v -> Antiquoted v r
Plain NString (a, b)
k)
  zipMatchLeft (DynamicKey (Antiquoted k1 :: a
k1)) (DynamicKey (Antiquoted k2 :: b
k2)) =
    NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (NKeyName (a, b) -> Maybe (NKeyName (a, b)))
-> NKeyName (a, b) -> Maybe (NKeyName (a, b))
forall a b. (a -> b) -> a -> b
$ Antiquoted (NString (a, b)) (a, b) -> NKeyName (a, b)
forall r. Antiquoted (NString r) r -> NKeyName r
DynamicKey ((a, b) -> Antiquoted (NString (a, b)) (a, b)
forall v r. r -> Antiquoted v r
Antiquoted (a
k1, b
k2))
  zipMatchLeft _ _ = Maybe (NKeyName (a, b))
forall a. Maybe a
Nothing

instance Matchable Params where

-- | Doesn't require the annotations to match, returns the second annotation.
instance Matchable (Ann ann) where
  zipMatchLeft :: Ann ann a -> Ann ann b -> Maybe (Ann ann (a, b))
zipMatchLeft (Ann _ a1 :: a
a1) (Ann ann2 :: ann
ann2 a2 :: b
a2) = Ann ann (a, b) -> Maybe (Ann ann (a, b))
forall a. a -> Maybe a
Just (Ann ann (a, b) -> Maybe (Ann ann (a, b)))
-> Ann ann (a, b) -> Maybe (Ann ann (a, b))
forall a b. (a -> b) -> a -> b
$ ann -> (a, b) -> Ann ann (a, b)
forall ann a. ann -> a -> Ann ann a
Ann ann
ann2 (a
a1, b
a2)

--
-- base types
--

instance Matchable [] where

instance Matchable NonEmpty where

instance Matchable Maybe where

instance Eq a => Matchable ((,) a) where

instance (Matchable f, Matchable g)=> Matchable (Compose f g) where


----------------------------------------------------------------
-- Generic Instance for Matchable
----------------------------------------------------------------

-- | A class used in the @default@ definition for 'zipMatchLeft'
class (Traversable t, Generic1 t) => GMatchable t where
  gZipMatchLeft :: t a -> t b -> Maybe (t (a,b))

instance GMatchable t => GMatchable (M1 m i t) where
  gZipMatchLeft :: M1 m i t a -> M1 m i t b -> Maybe (M1 m i t (a, b))
gZipMatchLeft (M1 l :: t a
l) (M1 r :: t b
r) = t (a, b) -> M1 m i t (a, b)
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (t (a, b) -> M1 m i t (a, b))
-> Maybe (t (a, b)) -> Maybe (M1 m i t (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> t a -> t b -> Maybe (t (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft t a
l t b
r

instance GMatchable U1 where
  gZipMatchLeft :: U1 a -> U1 b -> Maybe (U1 (a, b))
gZipMatchLeft _ _ = U1 (a, b) -> Maybe (U1 (a, b))
forall a. a -> Maybe a
Just U1 (a, b)
forall k (p :: k). U1 p
U1

instance Eq c => GMatchable (K1 m c) where
  gZipMatchLeft :: K1 m c a -> K1 m c b -> Maybe (K1 m c (a, b))
gZipMatchLeft (K1 l :: c
l) (K1 r :: c
r) | c
l c -> c -> Bool
forall a. Eq a => a -> a -> Bool
== c
r    = K1 m c (a, b) -> Maybe (K1 m c (a, b))
forall a. a -> Maybe a
Just (c -> K1 m c (a, b)
forall k i c (p :: k). c -> K1 i c p
K1 c
l)
                              | Bool
otherwise = Maybe (K1 m c (a, b))
forall a. Maybe a
Nothing

instance GMatchable Par1 where
  gZipMatchLeft :: Par1 a -> Par1 b -> Maybe (Par1 (a, b))
gZipMatchLeft (Par1 l :: a
l) (Par1 r :: b
r) = Par1 (a, b) -> Maybe (Par1 (a, b))
forall a. a -> Maybe a
Just (Par1 (a, b) -> Maybe (Par1 (a, b)))
-> ((a, b) -> Par1 (a, b)) -> (a, b) -> Maybe (Par1 (a, b))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a, b) -> Par1 (a, b)
forall p. p -> Par1 p
Par1 ((a, b) -> Maybe (Par1 (a, b))) -> (a, b) -> Maybe (Par1 (a, b))
forall a b. (a -> b) -> a -> b
$ (a
l, b
r)

instance Matchable x => GMatchable (Rec1 x) where
  gZipMatchLeft :: Rec1 x a -> Rec1 x b -> Maybe (Rec1 x (a, b))
gZipMatchLeft (Rec1 l :: x a
l) (Rec1 r :: x b
r) = x (a, b) -> Rec1 x (a, b)
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (x (a, b) -> Rec1 x (a, b))
-> Maybe (x (a, b)) -> Maybe (Rec1 x (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> x a -> x b -> Maybe (x (a, b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft x a
l x b
r

instance (GMatchable l, GMatchable r) => GMatchable (l :+: r) where
  gZipMatchLeft :: (:+:) l r a -> (:+:) l r b -> Maybe ((:+:) l r (a, b))
gZipMatchLeft (L1 l :: l a
l) (L1 r :: l b
r) = l (a, b) -> (:+:) l r (a, b)
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (l (a, b) -> (:+:) l r (a, b))
-> Maybe (l (a, b)) -> Maybe ((:+:) l r (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> l a -> l b -> Maybe (l (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft l a
l l b
r
  gZipMatchLeft (R1 l :: r a
l) (R1 r :: r b
r) = r (a, b) -> (:+:) l r (a, b)
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (r (a, b) -> (:+:) l r (a, b))
-> Maybe (r (a, b)) -> Maybe ((:+:) l r (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> r a -> r b -> Maybe (r (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft r a
l r b
r
  gZipMatchLeft _      _      = Maybe ((:+:) l r (a, b))
forall a. Maybe a
Nothing

instance (GMatchable l, GMatchable r) => GMatchable (l :*: r) where
  gZipMatchLeft :: (:*:) l r a -> (:*:) l r b -> Maybe ((:*:) l r (a, b))
gZipMatchLeft (l1 :: l a
l1 :*: l2 :: r a
l2) (r1 :: l b
r1 :*: r2 :: r b
r2) =
    l (a, b) -> r (a, b) -> (:*:) l r (a, b)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
(:*:) (l (a, b) -> r (a, b) -> (:*:) l r (a, b))
-> Maybe (l (a, b)) -> Maybe (r (a, b) -> (:*:) l r (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> l a -> l b -> Maybe (l (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft l a
l1 l b
r1 Maybe (r (a, b) -> (:*:) l r (a, b))
-> Maybe (r (a, b)) -> Maybe ((:*:) l r (a, b))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> r a -> r b -> Maybe (r (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft r a
l2 r b
r2

instance (Matchable a, GMatchable b) => GMatchable (a :.: b) where
  gZipMatchLeft :: (:.:) a b a -> (:.:) a b b -> Maybe ((:.:) a b (a, b))
gZipMatchLeft (Comp1 l :: a (b a)
l) (Comp1 r :: a (b b)
r) = do
    a (b (a, b))
x <- a (b a) -> a (b b) -> Maybe (a (b a, b b))
forall (t :: * -> *) a b.
Matchable t =>
t a -> t b -> Maybe (t (a, b))
zipMatchLeft a (b a)
l a (b b)
r Maybe (a (b a, b b))
-> (a (b a, b b) -> Maybe (a (b (a, b)))) -> Maybe (a (b (a, b)))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ((b a, b b) -> Maybe (b (a, b)))
-> a (b a, b b) -> Maybe (a (b (a, b)))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse ((b a -> b b -> Maybe (b (a, b))) -> (b a, b b) -> Maybe (b (a, b))
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry b a -> b b -> Maybe (b (a, b))
forall (t :: * -> *) a b.
GMatchable t =>
t a -> t b -> Maybe (t (a, b))
gZipMatchLeft)
    (:.:) a b (a, b) -> Maybe ((:.:) a b (a, b))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a (b (a, b)) -> (:.:) a b (a, b)
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 a (b (a, b))
x)


----------------------------------------------------------------
-- Utils
----------------------------------------------------------------

(.:) :: (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
.: :: (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
(.:) = ((a2 -> b) -> a2 -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) (((a2 -> b) -> a2 -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c)
-> ((b -> c) -> (a2 -> b) -> a2 -> c)
-> (b -> c)
-> (a1 -> a2 -> b)
-> a1
-> a2
-> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (b -> c) -> (a2 -> b) -> a2 -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
(.)