GHC version check in code

前端 未结 3 2019
礼貌的吻别
礼貌的吻别 2021-02-19 10:54

I\'m contributing to Alex, and it obviously depends on a lot of libraries and should compile for a lot of versions.

I need to use a function that is only available from

3条回答
  •  没有蜡笔的小新
    2021-02-19 11:25

    That's described in section 6.11.3.1 of GHC's users guide:

    For version x.y.z of GHC, the value of __GLASGOW_HASKELL__ is the integer ⟨xyy⟩ (if ⟨y⟩ is a single digit, then a leading zero is added, so for example in version 6.2 of GHC, __GLASGOW_HASKELL__==602). More information in GHC version numbering policy.

    So for 7.6.1, you would check __GLASGOW_HASKELL__ >= 706. The reason for this are versions like 7.10.x.

提交回复
热议问题