makeFreeCon fails for GHC master
Summary
Using the free
package from head.hackage
and current GHC master,
makeFreeCon
fails.
In particular, for the file
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Control.Monad.Trans.Free
import Control.Monad.Free.TH (makeFreeCon)
import qualified GHC as GHC
data AnnotationF next where
CountAnns :: GHC.AnnKeywordId -> (Int -> next) -> AnnotationF next
CountAnns2 :: Char -> (Int -> next) -> AnnotationF next
deriving (Functor)
makeFreeCon 'CountAnns
makeFreeCon 'CountAnns2
we get the error message
Main.hs:17:1: error:
• Couldn't match type ‘Int’ with ‘(Int)’
Expected type: m (Int)
Actual type: m Int
• In the expression:
liftF ((CountAnns p_al6n) (\ x_al6m -> (x_al6m)))
In an equation for ‘countAnns’:
countAnns p_al6n
= liftF ((CountAnns p_al6n) (\ x_al6m -> (x_al6m)))
|
17 | makeFreeCon 'CountAnns
| ^^^^^^^^^^^^^^^^^^^^^^^
Note that the CountAnns2
version does not show the problem.
Steps to reproduce
Compile using GHC master and head.hackage.cabal.project
Expected behavior
It should compile cleanly
Environment
- GHC version used: master at 798037a1
cabal new-update
Downloading the latest package lists from:
- hackage.haskell.org
- head.hackage.ghc.haskell.org
To revert to previous state run:
cabal v2-update 'head.hackage.ghc.haskell.org,2019-10-08T15:28:09Z'
To revert to previous state run:
cabal v2-update 'hackage.haskell.org,2019-10-16T20:57:37Z'
Optional:
- Operating System: Debian testing
- System Architecture: x86_64