mirror of
https://github.com/lexi-lambda/freer-simple.git
synced 2024-11-23 00:08:01 +03:00
Allow template-haskell 2.17, 2.18 (#34)
With a bit of CPP for backwards compatibility. Ref https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0#template-haskell-217
This commit is contained in:
parent
e5ef0fec4a
commit
87403cc229
@ -57,7 +57,7 @@ library:
|
||||
dependencies:
|
||||
- natural-transformation >= 0.2
|
||||
- transformers-base
|
||||
- template-haskell >= 2.11 && < 2.17
|
||||
- template-haskell >= 2.11 && < 2.19
|
||||
|
||||
executables:
|
||||
freer-examples:
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
@ -121,7 +122,11 @@ genType (GadtC _ tArgs' (AppT eff tRet)) = do
|
||||
resultType = ConT ''Eff `AppT` VarT effs `AppT` tRet
|
||||
|
||||
return
|
||||
#if MIN_VERSION_template_haskell(2,17,0)
|
||||
. ForallT [PlainTV effs SpecifiedSpec] [memberConstraint]
|
||||
#else
|
||||
. ForallT [PlainTV effs] [memberConstraint]
|
||||
#endif
|
||||
. foldArrows
|
||||
$ tArgs
|
||||
++ [resultType]
|
||||
@ -141,8 +146,13 @@ simplifyBndrs t = t
|
||||
|
||||
-- | Turn TvVarBndrs of the form (KindedTV tv StarT) into (PlainTV tv)
|
||||
-- This can prevent the need for KindSignatures
|
||||
#if MIN_VERSION_template_haskell(2,17,0)
|
||||
simplifyBndr :: TyVarBndrSpec -> TyVarBndrSpec
|
||||
simplifyBndr (KindedTV tv f StarT) = PlainTV tv f
|
||||
#else
|
||||
simplifyBndr :: TyVarBndr -> TyVarBndr
|
||||
simplifyBndr (KindedTV tv StarT) = PlainTV tv
|
||||
#endif
|
||||
simplifyBndr bndr = bndr
|
||||
|
||||
-- | Generates a type signature of the form
|
||||
|
Loading…
Reference in New Issue
Block a user