Skip to content

Commit

Permalink
Fix newName error
Browse files Browse the repository at this point in the history
  • Loading branch information
TeofilC committed Oct 31, 2024
1 parent 21a1a1a commit 89be96a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Database/Esqueleto/Record.hs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ sqlSelectColsDec RecordInfo {..} = do
in foldl' helper (VarE f1) rest

identInfo <- newName "identInfo"
[d| sqlSelectCols $(varP identInfo) $(pure $ RecP sqlName fieldPatterns) =
[d| $(varP 'sqlSelectCols) = \ $(varP identInfo) $(pure $ RecP sqlName fieldPatterns) ->
sqlSelectCols $(varE identInfo) $(pure joinedFields)
|]

Expand All @@ -425,7 +425,7 @@ sqlSelectColCountDec RecordInfo {..} = do
InfixT lhs ''(:&) ty
in foldl' helper t1 rest

[d| sqlSelectColCount _ = sqlSelectColCount (Proxy @($(pure joinedTypes))) |]
[d| $(varP 'sqlSelectColCount) = \ _ -> sqlSelectColCount (Proxy @($(pure joinedTypes))) |]

-- | Generates the `sqlSelectProcessRow` declaration for an `SqlSelect`
-- instance.
Expand Down Expand Up @@ -757,7 +757,7 @@ toMaybeDec RecordInfo {..} = do
, (maybeFieldName', VarE 'toMaybe `AppE` VarE fieldPatternName)
))

[d| toMaybe $(pure $ RecP sqlName fieldPatterns) =
[d| $(varP 'toMaybe) = \ $(pure $ RecP sqlName fieldPatterns) ->
$(pure $ RecConE sqlMaybeName fieldExps)
|]

Expand Down Expand Up @@ -800,7 +800,7 @@ sqlMaybeSelectColsDec RecordInfo {..} = do
in foldl' helper (VarE f1) rest

identInfo <- newName "identInfo"
[d| sqlSelectCols $(varP identInfo) $(pure $ RecP sqlMaybeName fieldPatterns) =
[d| $(varP 'sqlSelectCols) = \ $(varP identInfo) $(pure $ RecP sqlMaybeName fieldPatterns) ->
sqlSelectCols $(varE identInfo) $(pure joinedFields)
|]

Expand Down Expand Up @@ -880,7 +880,7 @@ sqlMaybeSelectColCountDec RecordInfo {..} = do
InfixT lhs ''(:&) ty
in foldl' helper t1 rest

[d| sqlSelectColCount _ = sqlSelectColCount (Proxy @($(pure joinedTypes))) |]
[d| $(varP 'sqlSelectColCount) = \_ -> sqlSelectColCount (Proxy @($(pure joinedTypes))) |]

-- | Statefully parse some number of columns from a list of `PersistValue`s,
-- where the number of columns to parse is determined by `sqlSelectColCount`
Expand Down

0 comments on commit 89be96a

Please sign in to comment.