Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "Non-exhaustive patterns" when using TypeApplications #26

Closed
dcastro opened this issue Mar 14, 2023 · 4 comments · Fixed by #23
Closed

[BUG] "Non-exhaustive patterns" when using TypeApplications #26

dcastro opened this issue Mar 14, 2023 · 4 comments · Fixed by #23
Labels
bug Something isn't working

Comments

@dcastro
Copy link
Member

dcastro commented Mar 14, 2023

Description

When interpolating an expression that uses TypeApplications, TH fails with a "Non-exhaustive patterns" error.

To Reproduce

Steps to reproduce the behavior:

$ import Text.Interpolation.Nyan
$ varMonomorphic = 0 :: Int
$ varPolymorphic = 0 :: Num a => a

$ [int||Testing #{varMonomorphic}|]
Testing 0

$ [int||Testing #{varPolymorphic :: Int}|]
Testing 0

$[int||Testing #{varPolymorphic @Int}|]

<interactive>:13:1: error:
     Exception when trying to run compile-time code:
        src/Language/Haskell/Meta/Extensions.hs:(179,19)-(348,49): Non-exhaustive patterns in case

      Code: template-haskell-2.18.0.0:Language.Haskell.TH.Quote.quoteExp
              int "|Testing #{varPolymorphic @Int}"
     In the quasi-quotation: [int||Testing #{varPolymorphic @Int}|]

Expected behavior

Expected the interpolation of varPolymorphic @Int to work.

Environment

  • master 5e15805
  • ghc-9.2.5, LTS-20.05
@dcastro dcastro added the bug Something isn't working label Mar 14, 2023
@dcastro
Copy link
Member Author

dcastro commented Mar 14, 2023

cc @Martoon-00

@Martoon-00
Copy link
Member

Martoon-00 commented Mar 14, 2023

Yeah, unfortunatelly it does not work with the recent LTS, #24 is related.

I'll try handle this once having time. Thanks for posting this issue.

@Martoon-00
Copy link
Member

The 0.9.1 versions on hackage should contain the fix, please check!

@dcastro
Copy link
Member Author

dcastro commented May 2, 2023

Yup, seems to be fixed now, thanks! 😄

λ> let varPolymorphic :: Num a => a; varPolymorphic = 0

λ> [int||Testing #{varPolymorphic @Int}|]
Testing 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants