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

More/less binders expected when using --typeclass #2269

Open
nmeum opened this issue Feb 8, 2024 · 2 comments
Open

More/less binders expected when using --typeclass #2269

nmeum opened this issue Feb 8, 2024 · 2 comments

Comments

@nmeum
Copy link

nmeum commented Feb 8, 2024

Hey, I am new to Liquid Haskell and was interested in using it in conjunction with type classes. For this purpose, I tried the following example from the Liquid Haskell specification:

{-# LANGUAGE RankNTypes #-}
{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--typeclass" @-}
{-@ LIQUID "--aux-inline" @-}
{-@ LIQUID "--ple" @-}

import qualified Prelude

class Semigroup a where
    {-@ mappend :: a -> a -> a @-}
    mappend :: a -> a -> a

class Semigroup a => VSemigroup a where
    {-@ lawAssociative :: v:a -> v':a -> v'':a ->
          {mappend (mappend v v') v'' == mappend v (mappend v' v'')} @-}
    lawAssociative :: a -> a -> a -> ()

Running this as:

$ ghci -fplugin=LiquidHaskell semigroup.hs

Gives me the following error message:

GHCi, version 9.2.5: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( semigroup.hs, interpreted )

<no location info>: error:
    • Uh oh.
    Oops, Ghc gave back more/less binders than I expected
    •
Failed, no modules loaded.

This is with liquidhaskell 0.9.2.5.0 and GHC 9.2.5. I also tried this with GHC 9.4.7 and liquidhaskell 0.9.4.7.0 but with this setup I get the same error message. As I said, I am new to liquidhaskell so I suspect I am just using it wrong or is this an expect error given that --typeclass is still considered experimental?

@nmeum nmeum changed the title More/less binders expected when using --typclass More/less binders expected when using --typeclass Feb 8, 2024
@facundominguez
Copy link
Collaborator

Hello! Typeclass support remains experimental. I just reviewed the tests. There are tests like this that were disabled in the move from ghc 8 to ghc 9, so the chances of making it work without hacking on LH are slim. You could try ghc 8, though that is a tad harder to setup as it requires liquid-base in addition to liquidhaskell.

@facundominguez
Copy link
Collaborator

facundominguez commented Feb 8, 2024

Here there are instructions to test with ghc 8 by building an older LH from the github repo.

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

No branches or pull requests

2 participants