profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/parsonsmatt/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Matt Parsons parsonsmatt @mercurytechnologies Denver, CO parsonsmatt.org

bitemyapp/fp-course 339

Fork of the original Data61 course to be more Stack friendly

bitemyapp/esqueleto 330

New home of Esqueleto, please file issues so we can get things caught up!

hoerresb/WifiWizard 204

A Cordova plugin for managing Wifi networks

aloiscochard/codex 164

A ctags file generator for cabal/stack project dependencies.

fourmolu/fourmolu 107

A fourk of ormolu that uses four space indentation and allows arbitrary configuration. Don't like it? PRs welcome!

jhickner/smtp-mail 69

Making it easy to send SMTP email from Haskell

parsonsmatt/beginner-error-messages 15

Informative error messages for common beginner misunderstandings with Haskell

lumihq/persistent-documentation 14

DSL for attaching documentation to persistent entities

MercuryTechnologies/moat 10

mobile type (currently Swift, Kotlin) generation from Haskell types

issue commentbitemyapp/esqueleto

Missing Instances for `:&` - bug or feature?

We should still implement ToAlias and ToAliasReference, I think :)

m4dc4p

comment created time in an hour

IssuesEvent

issue commentbitemyapp/esqueleto

Missing Instances for `:&` - bug or feature?

Definitely a bug/oversight if we're supporting (,,) in places but not :&

There's a SqlSelect instance in a new version

m4dc4p

comment created time in an hour

issue openedbitemyapp/esqueleto

`IdentInfo` shouldn't require a `SqlBackend`

Currently, IdentInfo carries an entire SqlBackend. It can't possibly use most of it. Instead, let's ask for what we actually want - the escaping function. This would reduce the "dummy" functions.

created time in a day

issue openedfourmolu/fourmolu

Merge comments instead of deleting

At work, we had a record that was documented like this:

data X = X
  { xName :: Int
  -- | A comment about age
  , xAge :: Int
  -- ^ Another comment about age
  }

fourmolu deleted the second comment, instead of merging them together. Ideally, after formatting, it'd have unified them:

data X = X
  { xName :: Int
  -- | A comment about age
  -- Another comment about age
  , xAge :: Int
  }

created time in 4 days

push eventbitemyapp/esqueleto

parsonsmatt

commit sha 2b0b0d83687814a561f4c3c886200a36be956d92

lol

view details

push time in 6 days

issue openedbitemyapp/esqueleto

Delete deprecated terms

Will be nice to clear out some deprecations. We're on 3.5.2.2, which means that everything (aside from #286) has been deprecated for at least a whole major version now. Stackage LTS is on 3.5.2.2, so we're probably fine to delete them all.

created time in 6 days

pull request commentbitemyapp/esqueleto

Fix distinctOn

Closes #286

parsonsmatt

comment created time in 6 days

PR opened bitemyapp/esqueleto

Fix distinctOn

Before submitting your PR, check that you've:

After submitting your PR:

  • [ ] Update the Changelog.md file with a link to your PR.
  • [ ] Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts).

<!---Thanks so much for contributing! :)

If these checkboxes don't apply to your PR, you can delete them

If you're unsure on what the new version number should be, feel free to ask.

-->

+66 -0

0 comment

2 changed files

pr created time in 6 days

create barnchbitemyapp/esqueleto

branch : matt/distinct-on

created branch time in 6 days

issue openedbitemyapp/esqueleto

distinctOn

distinctOn is a bit weird.

distinctOn :: [SqlExpr DistinctOn] -> SqlQuery a -> SqlQuery a
distinctOn exprs act = Q (W.tell mempty { sdDistinctClause = DistinctOn exprs }) >> act

It might as well just be distinctOn :: [SqlExpr DistinctOn] -> SqlQuery ().

Also, the docs indicate it only works on Postgres.

I propose we deprecate the term, and move the SqlQuery () variant into Database.Esqueleto.Postgres.

created time in 6 days

push eventparsonsmatt/gslp

parsonsmatt

commit sha a6581af4873e3d0abe027f4903ce9e07a85be23b

ok

view details

parsonsmatt

commit sha b8f473bfbb694e8e5a108a9b485e024a468d6cb2

hell yeah brother

view details

push time in 6 days

PullRequestReviewEvent

Pull request review commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

 filterWhere aggExpr clauseExpr = ERaw noMeta $ \_ info ->     in ( aggBuilder <> " FILTER (WHERE " <> clauseBuilder <> ")"        , aggValues <> clauseValues        )++newtype PgValuesExprs a = PgValuesExprs { unPgValuesExprs :: NE.NonEmpty a }

esqueleto doesn't currently do anything to differentiate the database provider - it's all Sqlbackend as far as we're concerned. So I'd rather not try and do anything clever here and just support PG directly. If someone else wants MySQL support or Sqlite, then we can add those in vendor-specific modules, and if we really want to unify it, we can try and do that.

NikitaRazmakhnin

comment created time in 6 days

push eventbitemyapp/esqueleto

Matt Parsons

commit sha 982b354c7e323f1a7a09725aa7eaed4f054a93ea

Use haskell/actions/setup for CI (#285)

view details

push time in 6 days

Pull request review commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

 filterWhere aggExpr clauseExpr = ERaw noMeta $ \_ info ->     in ( aggBuilder <> " FILTER (WHERE " <> clauseBuilder <> ")"        , aggValues <> clauseValues        )++newtype PgValuesExprs a = PgValuesExprs { unPgValuesExprs :: NE.NonEmpty a }

Oh, if they require different syntax, then let's not bother. The current solution is to keep anything that varies in these separate modules.

NikitaRazmakhnin

comment created time in 6 days

PullRequestReviewEvent

pull request commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

Try merging master once #285 is pulled in

NikitaRazmakhnin

comment created time in 6 days

create barnchbitemyapp/esqueleto

branch : matt/update-gh-actions

created branch time in 6 days

push eventparsonsmatt/discover-instances

parsonsmatt

commit sha 63032f3d451d1206e24846a27f866d3bb6afb3c3

fix ci

view details

push time in 6 days

push eventparsonsmatt/some-dict-of

parsonsmatt

commit sha c4d95b16f08ac98bdfdf7f92737f6dbd0497aa69

t1

view details

parsonsmatt

commit sha 029116099d3111278e1d78a812c22e7cc43650c7

lol

view details

Matt Parsons

commit sha 9794648274213bf52d49d540ba120f6c700ddec1

Merge pull request #2 from parsonsmatt/matt/ci-fix fix CI

view details

push time in 6 days

PR merged parsonsmatt/some-dict-of

fix CI
+1 -1

1 comment

1 changed file

parsonsmatt

pr closed time in 6 days

Pull request review commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

 testLateralQuery = do             let _ = res :: [(Entity Lord, Value (Maybe Int))]             asserting noExceptions +testValuesExpression :: SpecDb+testValuesExpression = do

blessed tests ❤️

NikitaRazmakhnin

comment created time in 6 days

Pull request review commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

 filterWhere aggExpr clauseExpr = ERaw noMeta $ \_ info ->     in ( aggBuilder <> " FILTER (WHERE " <> clauseBuilder <> ")"        , aggValues <> clauseValues        )++newtype PgValuesExprs a = PgValuesExprs { unPgValuesExprs :: NE.NonEmpty a }++instance (ToSomeValues a, Ex.ToAliasReference a, Ex.ToAlias a) => Ex.ToFrom (PgValuesExprs a) a where+  toFrom = fromValues . unPgValuesExprs++fromValues :: (ToSomeValues a, Ex.ToAliasReference a, Ex.ToAlias a) => NE.NonEmpty a -> Ex.From a+fromValues exprs = Ex.From $ do+    ident <- newIdentFor $ DBName "vq"+    alias <- Ex.toAlias $ NE.head exprs+    ref   <- Ex.toAliasReference ident alias+    let aliasIdents = mapMaybe (\someVal -> case someVal of+            SomeValue (ERaw aliasMeta _) -> sqlExprMetaAlias aliasMeta+            ) $ toSomeValues ref+    pure (ref, const $ mkExpr ident aliasIdents)+  where+    someValueToSql :: IdentInfo -> SomeValue -> (TLB.Builder, [PersistValue])+    someValueToSql info (SomeValue expr) = materializeExpr info expr++    mkValuesRowSql :: IdentInfo -> [SomeValue] -> (TLB.Builder, [PersistValue])+    mkValuesRowSql info vs =+        let materialized = someValueToSql info <$> vs+            valsSql = TLB.toLazyText . fst <$> materialized+            params = concatMap snd materialized+        in (TLB.fromLazyText $ "(" <> TL.intercalate "," valsSql <> ")", params)++    -- (VALUES (v11, v12,..), (v21, v22,..)) as "vq"("v1", "v2",..)+    mkExpr :: Ident -> [Ident] -> IdentInfo -> (TLB.Builder, [PersistValue])+    mkExpr valsIdent colIdents info =+        let materialized = mkValuesRowSql info . toSomeValues <$> NE.toList exprs+            (valsSql, params) =+                ( TL.intercalate "," $ map (TLB.toLazyText . fst) materialized+                , concatMap snd materialized+                )+            colsAliases = TL.intercalate "," (map (TLB.toLazyText . useIdent info) colIdents)+        in+            ( "(VALUES " <> TLB.fromLazyText valsSql <> ") AS "+            <> useIdent info valsIdent+            <> "(" <> TLB.fromLazyText colsAliases <> ")"+            , params+            )++-- | Allows to use `VALUES (..)` in-memory set of values+-- in RHS of `from` expressions. Useful for JOIN's on+-- known values which also can be additionally preprocessed+-- somehow on db side with usage of inner PostgreSQL capabilities.+--+--+-- Example of usage:+--+-- @+-- share [mkPersist sqlSettings] [persistLowerCase|+--   User+--     name Text+--     age Int+--     deriving Eq Show+--+-- select $ do+--  bound :& user <- from $+--      values (   (val (10 :: Int), val ("ten" :: Text))+--            :| [ (val 20, val "twenty")+--               , (val 30, val "thirty") ]+--            )+--      `InnerJoin` table User+--      `on` (\((bound, _boundName) :& user) -> user^.UserAge >=. bound)+--  groupBy bound+--  pure (bound, count @Int $ user^.UserName)+-- @+--+-- @since 3.5.2.3

🙌🏻 this is dope

NikitaRazmakhnin

comment created time in 6 days

PullRequestReviewEvent

Pull request review commentbitemyapp/esqueleto

Add support of PostgreSQL-specific `VALUES(..)` expression

 filterWhere aggExpr clauseExpr = ERaw noMeta $ \_ info ->     in ( aggBuilder <> " FILTER (WHERE " <> clauseBuilder <> ")"        , aggValues <> clauseValues        )++newtype PgValuesExprs a = PgValuesExprs { unPgValuesExprs :: NE.NonEmpty a }

Is this a Postgres specific feature?

This article seems to indicate that it is a SQL-92 feature, and should be supported by all SQL databases.

MySQL supports VALUES, as does SQLite. So I think we can move this into esqueleto proper.

NikitaRazmakhnin

comment created time in 6 days

PullRequestReviewEvent

issue commenthaskell/actions

Unable to install GHC error

Yeah, that did it! Thanks.

Man, I wonder if there's some way to poison-pill the original repo? Looks like they'd need to un-archive it for any changes to be made.

parsonsmatt

comment created time in 6 days