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

Get llvm-7 working with GHC 8.10 #381

Open
wants to merge 1 commit into
base: llvm-7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm-hs/src/Control/Monad/Trans/AnyCont.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE
RankNTypes
CPP, RankNTypes
#-}
module Control.Monad.Trans.AnyCont where

Expand All @@ -21,7 +21,9 @@ instance Applicative (AnyContT m) where
instance Monad m => Monad (AnyContT m) where
AnyContT f >>= k = AnyContT $ f >>= unAnyContT . k
return a = AnyContT $ return a
#if !(MIN_VERSION_base(4,13,0))
fail s = AnyContT (ContT (\_ -> Cont.fail s))
#endif

instance MonadFail m => MonadFail (AnyContT m) where
fail s = AnyContT (ContT (\_ -> Fail.fail s))
Expand Down
4 changes: 2 additions & 2 deletions llvm-hs/src/LLVM/Internal/EncodeAST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Control.Monad.State
import Foreign.Ptr
import Foreign.C

import qualified LLVM.Internal.FFI.ShortByteString as ShortByteString
import LLVM.Internal.FFI.ShortByteString (useAsCString)
import qualified Data.ByteString.Short as ShortByteString

import Data.Map (Map)
Expand Down Expand Up @@ -95,7 +95,7 @@ runEncodeAST context@(Context ctx) (EncodeAST a) =
flip evalStateT initEncodeState . flip runAnyContT return $ a

withName :: A.Name -> (CString -> IO a) -> IO a
withName (A.Name n) = ShortByteString.useAsCString n
withName (A.Name n) = useAsCString n
withName (A.UnName _) = withCString ""

instance MonadAnyCont IO m => EncodeM m A.Name CString where
Expand Down
2 changes: 1 addition & 1 deletion llvm-hs/src/LLVM/Internal/FFI/ShortByteString.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module LLVM.Internal.FFI.ShortByteString
import LLVM.Prelude

import Data.ByteString.Internal (c_strlen)
import Data.ByteString.Short.Internal
import Data.ByteString.Short.Internal (createFromPtr, copyToPtr)
import qualified Data.ByteString.Short as ByteString
import Foreign.C.String
import Foreign.Marshal.Alloc
Expand Down
2 changes: 1 addition & 1 deletion llvm-hs/src/LLVM/Internal/Target.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ newtype CPUFeature = CPUFeature ByteString
instance EncodeM e ByteString es => EncodeM e (Map CPUFeature Bool) es where
encodeM = encodeM . ByteString.intercalate "," . map (\(CPUFeature f, enabled) -> (if enabled then "+" else "-") <> f) . Map.toList

instance (Monad d, DecodeM d ByteString es) => DecodeM d (Map CPUFeature Bool) es where
instance (MonadFail d, DecodeM d ByteString es) => DecodeM d (Map CPUFeature Bool) es where
decodeM es = do
s <- decodeM es
let flag = do
Expand Down