Skip to content

Compatibility with GHC 8.8 #20

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Data/Vector/Unboxed/Deriving.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
#if __GLASGOW_HASKELL__ >= 800
{-# LANGUAGE TemplateHaskellQuotes #-}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder why I made this change.

#else
{-# LANGUAGE TemplateHaskell #-}
#endif
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
Expand Down Expand Up @@ -126,8 +122,15 @@ derivingUnbox name argsQ toRepQ fromRepQ = do
# define MAYBE_KIND
# define MAYBE_OVERLAP
#endif
let newtypeMVector = NewtypeInstD [] ''MVector [s, typ] MAYBE_KIND
#if MIN_VERSION_template_haskell(2,15,0)
newtypeMVector <- do
tmp <- [t|MVector $(return s) $(return typ)|]
return $ NewtypeInstD [] Nothing tmp MAYBE_KIND
(NormalC mvName [(lazy, ConT ''MVector `AppT` s `AppT` rep)]) []
#else
let newtypeMVector = NewtypeInstD [] ''MVector [s, typ] MAYBE_KIND []
(NormalC mvName [(lazy, ConT ''MVector `AppT` s `AppT` rep)]) []
#endif
let mvCon = ConE mvName
let instanceMVector = InstanceD MAYBE_OVERLAP cxts
(ConT ''M.MVector `AppT` ConT ''MVector `AppT` typ) $ concat
Expand All @@ -147,8 +150,15 @@ derivingUnbox name argsQ toRepQ fromRepQ = do
, wrap 'M.basicUnsafeMove [mv, mv'] id
, wrap 'M.basicUnsafeGrow [mv, n] (liftE mvCon) ]

#if MIN_VERSION_template_haskell(2,15,0)
newtypeVector <- do
tmp <- [t|Vector $(return typ)|]
return $ NewtypeInstD [] Nothing tmp MAYBE_KIND
(NormalC vName [(lazy, ConT ''Vector `AppT` rep)]) []
#else
let newtypeVector = NewtypeInstD [] ''Vector [typ] MAYBE_KIND
(NormalC vName [(lazy, ConT ''Vector `AppT` rep)]) []
#endif
let vCon = ConE vName
let instanceVector = InstanceD MAYBE_OVERLAP cxts
(ConT ''G.Vector `AppT` ConT ''Vector `AppT` typ) $ concat
Expand Down