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

Couldn't match type ‘'False’ with ‘'True’ #141

Closed
chrisdone opened this issue May 18, 2019 · 2 comments
Closed

Couldn't match type ‘'False’ with ‘'True’ #141

chrisdone opened this issue May 18, 2019 · 2 comments

Comments

@chrisdone
Copy link
Contributor

It's the same issue I encountered in persist: minad/persist#4

    /home/chris/Work/chrisdone/prana/prana-primops/src/Prana/PrimOp/Type.hs:13:10: error:
        • Couldn't match type ‘'False’ with ‘'True’
            arising from a use of ‘Data.Persist.$dmput’
        • In the expression: Data.Persist.$dmput @(PrimOp)
          In an equation for ‘put’: put = Data.Persist.$dmput @(PrimOp)
          In the instance declaration for ‘Persist PrimOp’
       |
    13 | instance Persist PrimOp
       |          ^^^^^^^^^^^^^^
    
    /home/chris/Work/chrisdone/prana/prana-primops/src/Prana/PrimOp/Type.hs:13:10: error:
        • Couldn't match type ‘'False’ with ‘'True’
            arising from a use of ‘Data.Persist.$dmget’
        • In the expression: Data.Persist.$dmget @(PrimOp)
          In an equation for ‘get’: get = Data.Persist.$dmget @(PrimOp)
          In the instance declaration for ‘Persist PrimOp’

Here's a gist with a reproducible case:

https://gist.github.com/chrisdone/c908dbdbbeaaa945575ce5be7b47b9a6

I was deriving the type with TH (commented out), but it's reproducible with the derived sum type copy/pasted in.

@mgsloan
Copy link
Owner

mgsloan commented May 21, 2019

Ah, interesting! This is coming from the general obtuseness of GHC complaining about constraints deep in instance resolution. I've improved the errors in d6bee5a and released as version 0.5.1.1

Error with base>=4.9:

    /home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
        • Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
        • In the expression: store-0.5.1.0:Data.Store.Impl.$dmsize @PrimOp
          In an equation for ‘size’:
              size = store-0.5.1.0:Data.Store.Impl.$dmsize @PrimOp
          In the instance declaration for ‘Store PrimOp’
        |
    481 | instance Store PrimOp
        |          ^^^^^^^^^^^^

    /home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
        • Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
        • In the expression: store-0.5.1.0:Data.Store.Impl.$dmpoke @PrimOp
          In an equation for ‘poke’:
              poke = store-0.5.1.0:Data.Store.Impl.$dmpoke @PrimOp
          In the instance declaration for ‘Store PrimOp’
        |
    481 | instance Store PrimOp
        |          ^^^^^^^^^^^^

    /home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10: error:
        • Generic deriving of Store instances can only be used on datatypes with fewer than 256 constructors.
        • In the expression: store-0.5.1.0:Data.Store.Impl.$dmpeek @PrimOp
          In an equation for ‘peek’:
              peek = store-0.5.1.0:Data.Store.Impl.$dmpeek @PrimOp
          In the instance declaration for ‘Store PrimOp’
        |
    481 | instance Store PrimOp

Error from before TypeError was a thing:

    /home/mgsloan/proj/store/test/Data/HmmSpec.hs:481:10:
        Could not deduce (store-0.5.1.0:Data.Store.Impl.TypeErrorMessage
                            "Generic deriving of Store instances can only be used on datatypes with fewer than
256 constructors.")
          arising from a use of ‘store-0.5.1.0:Data.Store.Impl.$gdmsize’
        In the expression: store-0.5.1.0:Data.Store.Impl.$gdmsize
        In an equation for ‘size’:
            size = store-0.5.1.0:Data.Store.Impl.$gdmsize
        In the instance declaration for ‘Store PrimOp’

@chrisdone
Copy link
Contributor Author

💪 Nice!

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