Skip to content

make osp :: QuasiQuoter valid as a pattern#210

Merged
hasufell merged 1 commit into
haskell:masterfrom
lawbel:master
Dec 2, 2023
Merged

make osp :: QuasiQuoter valid as a pattern#210
hasufell merged 1 commit into
haskell:masterfrom
lawbel:master

Conversation

@lawbel

@lawbel lawbel commented Nov 29, 2023

Copy link
Copy Markdown
Contributor

Resolves issue #205

Notes:

  • Alternative to the quote [p|...|] is something like

    viewP (appE (varE '(==)) (lift osp')) (conP 'True [])

    Although this may then need CPP to adjust for conP gaining an extra argument in template-haskell v2.18.0.0. Not sure which GHC version this changed in, but it's due to the ability to bind a type parameter with a constructor like

    foo :: Maybe a -> String
    foo (Just @a x) = "just"

    Given that, I thought the quote would be clearer. I'm assuming it should be easier to maintain as well, as it should avoid the need to update with any TH changes?

  • TemplateHaskellQuotes and ViewPatterns extensions both go back to GHC v6.x which should be plenty for back-compat?

  • Any other changes that should be made? Add some suitable tests?

  • Should we change the other QuasiQuoters as well? Make similar changes to osstr and pstr?

@Bodigrim

Copy link
Copy Markdown
Contributor

I think filepath should define just

osp :: QuasiQuoter
osp = OS.osstr

pstr :: QuasiQuoter
pstr = OS.osstr

while the actual quasiquoter to be improved in https://github.com/haskell/os-string.

@hasufell

Copy link
Copy Markdown
Member

I think filepath should define just

osp :: QuasiQuoter
osp = OS.osstr

pstr :: QuasiQuoter
pstr = OS.osstr

while the actual quasiquoter to be improved in https://github.com/haskell/os-string.

We run isValid at compile time here, which we don't in the osstr quasiquoters.

@hasufell

hasufell commented Dec 1, 2023

Copy link
Copy Markdown
Member

@lawbel we probably want this patch for os-string as well

@hasufell hasufell merged commit 0682302 into haskell:master Dec 2, 2023
hasufell added a commit to haskell/os-string that referenced this pull request Dec 2, 2023
@lawbel

lawbel commented Dec 4, 2023

Copy link
Copy Markdown
Contributor Author

@hasufell sorry I wasn't able to look at this over the weekend. I see you've done a PR for os-string as well, so I guess this is all done then? I appreciate the help in getting this over the line 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants