Coder Social home page Coder Social logo

GHC 8.6 compatibility about plutus HOT 8 CLOSED

michaelpj avatar michaelpj commented on July 23, 2024
GHC 8.6 compatibility

from plutus.

Comments (8)

shmish111 avatar shmish111 commented on July 23, 2024

The changes I made to get to this point are in the following patch. The following PR is also open eskimor/servant-subscriber#20

diff --git a/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Expr.hs b/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Expr.hs
index 85d275c1..bfde9fc3 100644
--- a/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Expr.hs
+++ b/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Expr.hs
@@ -69,8 +69,8 @@ This is a pain to recognize.
 convLiteral :: Converting m => GHC.Literal -> m PIRTerm
 convLiteral = \case
     -- TODO: better sizes
-    GHC.MachInt64 i    -> pure $ PIR.Constant () $ PLC.BuiltinInt () haskellIntSize i
-    GHC.MachInt i      -> pure $ PIR.Constant () $ PLC.BuiltinInt () haskellIntSize i
+    (GHC.LitNumber GHC.LitNumInt64 i _) -> pure $ PIR.Constant () $ PLC.BuiltinInt () haskellIntSize i
+    (GHC.LitNumber GHC.LitNumInt i _)   -> pure $ PIR.Constant () $ PLC.BuiltinInt () haskellIntSize i
     GHC.MachStr bs     ->
         -- Convert the bytestring into a core expression representing the list
         -- of characters, then compile that!
@@ -86,13 +86,11 @@ convLiteral = \case
         case maybeEncoded of
             Just t  -> pure $ PIR.embedIntoIR t
             Nothing -> throwPlain $ UnsupportedError "Conversion of character failed"
-    GHC.LitInteger _ _ -> throwPlain $ UnsupportedError "Literal (unbounded) integer"
-    GHC.MachWord _     -> throwPlain $ UnsupportedError "Literal word"
-    GHC.MachWord64 _   -> throwPlain $ UnsupportedError "Literal word64"
     GHC.MachFloat _    -> throwPlain $ UnsupportedError "Literal float"
     GHC.MachDouble _   -> throwPlain $ UnsupportedError "Literal double"
     GHC.MachLabel {}   -> throwPlain $ UnsupportedError "Literal label"
     GHC.MachNullAddr   -> throwPlain $ UnsupportedError "Literal null"
+    GHC.LitNumber _ _ _   -> throwPlain $ UnsupportedError "Literal null"

 isPrimitiveWrapper :: GHC.Id -> Bool
 isPrimitiveWrapper i = case GHC.idDetails i of
diff --git a/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Kind.hs b/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Kind.hs
index ca653672..b94fd988 100644
--- a/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Kind.hs
+++ b/plutus-tx-plugin/src/Language/PlutusTx/Compiler/Kind.hs
@@ -17,6 +17,6 @@ import qualified Language.PlutusCore              as PLC
 convKind :: Converting m => GHC.Kind -> m (PLC.Kind ())
 convKind k = withContextM (sdToTxt $ "Converting kind:" GHC.<+> GHC.ppr k) $ case k of
     -- this is a bit weird because GHC uses 'Type' to represent kinds, so '* -> *' is a 'TyFun'
-    (GHC.isStarKind -> True)              -> pure $ PLC.Type ()
+    (GHC.isLiftedTypeKind -> True)              -> pure $ PLC.Type ()
     (GHC.splitFunTy_maybe -> Just (i, o)) -> PLC.KindArrow () <$> convKind i <*> convKind o
     _                                     -> throwSd UnsupportedError $ "Kind:" GHC.<+> GHC.ppr k
diff --git a/stack.yaml b/stack.yaml
index 1b6b3ca8..ca7e3f74 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,4 +1,4 @@
-resolver: lts-12.14
+resolver: lts-13.2

 packages:
 - language-plutus-core
@@ -24,8 +24,8 @@ packages:
   extra-dep: true

 - location:
-    git: https://github.com/smobs/servant-subscriber.git
-    commit: 0354e99f5e1d244d5ec01f78e7e7439478b1d1d3
+    git: https://github.com/shmish111/servant-subscriber.git
+    commit: e7fc0d049b85b45073d818541c6a7678c8222ce8
   extra-dep: true

 extra-deps:
@@ -35,6 +35,8 @@ extra-deps:
 - hint-0.9.0
 - exceptions-0.10.0
 - purescript-bridge-0.13.0.0
+- algebraic-graphs-0.2
+- composition-prelude-2.0.2.1
 flags:
   language-plutus-core:
     development: true
@@ -50,4 +52,4 @@ flags:
     development: true
 extra-package-dbs: []
 nix:
-  packages: [gmp, openssl]
+  packages: [zlib, gmp, openssl]
diff --git a/wallet-api/src/Ledger/Types.hs b/wallet-api/src/Ledger/Types.hs
index a7d84c68..23909f5b 100644
--- a/wallet-api/src/Ledger/Types.hs
+++ b/wallet-api/src/Ledger/Types.hs
@@ -99,6 +99,9 @@ module Ledger.Types(
     inSignature
     ) where

+import qualified Language.PlutusTx.Builtins
+import qualified GHC.IO.Unsafe
+import qualified Data.ByteString.Unsafe
 import qualified Codec.CBOR.Write                         as Write
 import           Codec.Serialise                          (deserialise, deserialiseOrFail, serialise)
 import           Codec.Serialise.Class                    (Serialise, decode, encode)

from plutus.

michaelpj avatar michaelpj commented on July 23, 2024

@angerman is going to bring up the GHC ticket at the next GHC HQ call.

from plutus.

vmchale avatar vmchale commented on July 23, 2024

For my englightenment, is the plan then to jump to GHC 8.8, or rather to use some kind of GHC 8.6.4?

from plutus.

angerman avatar angerman commented on July 23, 2024

@vmchale is there a reason you'd like to skip 8.6? As 8.8 hasn't been released yet, that would be a bit aggressive, no?

from plutus.

vmchale avatar vmchale commented on July 23, 2024

Oh, no, I was just curious. I have no interest in skipping 8.6 if it is detrimental to development :)

from plutus.

angerman avatar angerman commented on July 23, 2024

@vmchale so your question is more as to why not to stick with 8.4?

from plutus.

michaelpj avatar michaelpj commented on July 23, 2024

Well, hopefully this will get fixed for 8.6.4 rather than 8.8. And remember we want to use 8.6 because it's what the new Cardano is planning to use for their release.

from plutus.

michaelpj avatar michaelpj commented on July 23, 2024

Done.

from plutus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.