Giter Club home page Giter Club logo

Comments (4)

tchoutri avatar tchoutri commented on June 13, 2024

Let's simply deactivate -Wunticked-promoted-constructors for all GHC versions?

from servant.

ysangkok avatar ysangkok commented on June 13, 2024

Let's simply deactivate -Wunticked-promoted-constructors for all GHC versions?

I don't think this works. The issue is not caused by warnings, but it is caused by types in error messages not having the tick as they previously had. To verify this, I added -Wunticked-promoted-constructors to the test-suite of servant-server, and reran the doctest. I still get the failures. I suspect I'd be another flag we'd need to set for older GHCs, one about formatting errors. And I am not sure that exists, since the change of heart on unticked promoted constructors might not have been anticipated such that it'd be available in all the GHC versions we run the doctests for.

Solutions I can think of:

  • Only run doctests on GHC <9.6: This would mean keeping the existing ticks in the code
  • Only run doctests on GHC >=9.6: This would mean adapting the code to pass the current failing tests, e.g. replacing Verb 'GET with Verb GET.
  • Duplicating the test:
    -- | This instance prevents from accidentally using '->' instead of ':>'      
    --                                                                            
    #if __GLASGOW_HASKELL__ >= 906                                                
    -- >>> serve (Proxy :: Proxy (Capture "foo" Int -> Get '[JSON] Int)) (error "...")
    -- ...                                                                        
    -- ...No instance HasServer (a -> b).                                         
    -- ...Maybe you have used '->' instead of ':>' between                        
    -- ...Capture' '[] "foo" Int                                                  
    -- ...and                                                                     
    -- ...Verb GET 200 [JSON] Int                                                 
    -- ...                                                                        
    #else                                                                         
    -- >>> serve (Proxy :: Proxy (Capture "foo" Int -> Get '[JSON] Int)) (error "...")
    -- ...                                                                        
    -- ...No instance HasServer (a -> b).                                         
    -- ...Maybe you have used '->' instead of ':>' between                        
    -- ...Capture' '[] "foo" Int                                                  
    -- ...and                                                                     
    -- ...Verb 'GET 200 '[JSON] Int                                               
    -- ...                                                                        
    #endif
    

from servant.

voidus avatar voidus commented on June 13, 2024

We could also add -fprint-redundant-promotion-ticks to have GHC print it in the old style.

from servant.

ysangkok avatar ysangkok commented on June 13, 2024

@voidus Thank you! I have added the flag in #1680 . I would appreciate a review if you have time.

from servant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.