Skip to content

Example sdl-triangle compiles error in ghc 9.6.3 and success in ghc 8.10.7 #498

@ZichaoNickFox

Description

@ZichaoNickFox

Hello. I build a new project, with dependence

extra-deps:
- vulkan-3.26.1@sha256:74209384b562b5b1483b25243e82999f9d55de23b0c574df08495768c3a7ea12,33611
- vulkan-utils-0.5.10.6@sha256:8ee8450d48f7ed4ba6baed20d33f28daae1a14a4f77e610f9dd4875a6b290576,3968

and same language extensions as example/sdl-triangle

- DataKinds
- DefaultSignatures
- DeriveFoldable
- DeriveFunctor
- DeriveTraversable
- DerivingStrategies
- DuplicateRecordFields
- FlexibleContexts
- FlexibleInstances
- GADTs
- GeneralizedNewtypeDeriving
- InstanceSigs
- LambdaCase
- MagicHash
- NamedFieldPuns
- NoMonomorphismRestriction
- NumDecimals
- OverloadedStrings
- PatternSynonyms
- PolyKinds
- QuantifiedConstraints
- RankNTypes
- RecordWildCards
- RoleAnnotations
- ScopedTypeVariables
- StandaloneDeriving
- Strict
- TupleSections
- TypeApplications
- TypeFamilyDependencies
- TypeOperators
- TypeSynonymInstances
- ViewPatterns

When compile with ghc 9.6.3, an compile error occurred. Message is

/Users/liuzichao/Hulkan/test/Main.hs:283:40: error:
    Ambiguous occurrence ‘width’
    It could refer to
       either the field ‘width’ of record ‘Viewport’,
              imported from ‘Vulkan.Core10’ at test/Main.hs:36:1-30
              (and originally defined in ‘Vulkan.Core10.Pipeline’)
           or the field ‘width’ of record ‘FramebufferCreateInfo’,
              imported from ‘Vulkan.Core10’ at test/Main.hs:36:1-30
              (and originally defined in ‘Vulkan.Core10.Pass’)
           or the field ‘width’ of record ‘Extent3D’,
              imported from ‘Vulkan.Core10’ at test/Main.hs:36:1-30
              (and originally defined in ‘Vulkan.Core10.FundamentalTypes’)
           or the field ‘width’ of record ‘Extent2D’,
              imported from ‘Vulkan.Core10’ at test/Main.hs:36:1-30
              (and originally defined in ‘Vulkan.Core10.FundamentalTypes’)
    |       
283 |               , width    = realToFrac (width (swapchainExtent :: Extent2D))
    |    

Position: https://github.com/expipiplus1/vulkan/blob/2007a6ebca9a585028163a850bcedef856fc1e94/examples/sdl-triangle/Main.hs#L283C66-L283C74

Everything is OK in ghc 8.10.7. I think this is not an issue of vulkan project. I just want to get a help why this happend? If ghc 9.6.3 has something different with ghc 8.10.7?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions