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

Initialize plugins for ghc-8.6 #93

Closed
judah opened this issue Apr 22, 2019 · 0 comments
Closed

Initialize plugins for ghc-8.6 #93

judah opened this issue Apr 22, 2019 · 0 comments

Comments

@judah
Copy link

judah commented Apr 22, 2019

ghc-8.6, when using the GHC API, requires that plugins be initialized explicitly for each module. (Previous versions of the API initialized them automatically).
See for example:
sol/doctest#224

The following file that uses ghc-typelits-knownnat can reproduce the problem. It builds fine with ghc-8.6, but fails to load in the indexer. I applied a patch on our internal codebase similar to the above doctest PR, but wasn't sure how to test it in this codebase given the external dependency requirement.

{-# OPTIONS_GHC -fplugin=GHC.TypeLits.KnownNat.Solver #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
module Main (main) where

import Control.Exception (assert)
import Data.Proxy
import GHC.TypeLits

-- | Requires ghc-typelits-knownnat to solve its constraints:
plusOne :: forall n . KnownNat n => Proxy n -> Integer
plusOne _ = natVal (Proxy :: Proxy (n + 1))

two :: Integer
two = plusOne (Proxy :: Proxy 1)

main :: IO ()
main = assert (2 == two) $ return ()
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