summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind
diff options
context:
space:
mode:
authorkrangelov <kr.angelov@gmail.com>2021-07-26 16:52:11 +0200
committerkrangelov <kr.angelov@gmail.com>2021-07-26 16:52:11 +0200
commite47042424ee2450c69c509601ddc3c1cc8cd9a39 (patch)
tree5cfad2acca46f8c9aafa3a5f97600ae26bbe0e1c /src/runtime/haskell-bind
parentecf309a28e9935923308da4b6aa2b1cc6c4b52e2 (diff)
parentd0a881f9038d2ca1620e0d95f90c297a452774d5 (diff)
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
Diffstat (limited to 'src/runtime/haskell-bind')
-rw-r--r--src/runtime/haskell-bind/PGF2/Expr.hsc14
-rw-r--r--src/runtime/haskell-bind/pgf2.cabal22
-rw-r--r--src/runtime/haskell-bind/stack-ghc7.10.3.yaml3
-rw-r--r--src/runtime/haskell-bind/stack-ghc8.0.2.yaml1
-rw-r--r--src/runtime/haskell-bind/stack-ghc8.10.4.yaml1
5 files changed, 25 insertions, 16 deletions
diff --git a/src/runtime/haskell-bind/PGF2/Expr.hsc b/src/runtime/haskell-bind/PGF2/Expr.hsc
index 85e55ab40..35ee628d1 100644
--- a/src/runtime/haskell-bind/PGF2/Expr.hsc
+++ b/src/runtime/haskell-bind/PGF2/Expr.hsc
@@ -19,7 +19,7 @@ wildCId = "_" :: CId
type Cat = CId -- ^ Name of syntactic category
type Fun = CId -- ^ Name of function
-data BindType =
+data BindType =
Explicit
| Implicit
deriving Show
@@ -38,7 +38,7 @@ instance Show Expr where
show = showExpr []
instance Eq Expr where
- (Expr e1 e1_touch) == (Expr e2 e2_touch) =
+ (Expr e1 e1_touch) == (Expr e2 e2_touch) =
unsafePerformIO $ do
res <- pgf_expr_eq e1 e2
e1_touch >> e2_touch
@@ -113,9 +113,9 @@ unApp (Expr expr touch) =
appl <- pgf_expr_unapply expr pl
if appl == nullPtr
then return Nothing
- else do
+ else do
fun <- peekCString =<< (#peek PgfApplication, fun) appl
- arity <- (#peek PgfApplication, n_args) appl :: IO CInt
+ arity <- (#peek PgfApplication, n_args) appl :: IO CInt
c_args <- peekArray (fromIntegral arity) (appl `plusPtr` (#offset PgfApplication, args))
return $ Just (fun, [Expr c_arg touch | c_arg <- c_args])
@@ -140,7 +140,9 @@ unStr (Expr expr touch) =
touch
return (Just s)
--- | Constructs an expression from an integer literal
+-- | Constructs an expression from an integer literal.
+-- Note that the C runtime does not support long integers, and you may run into overflow issues with large values.
+-- See [here](https://github.com/GrammaticalFramework/gf-core/issues/109) for more details.
mkInt :: Int -> Expr
mkInt val =
unsafePerformIO $ do
@@ -267,7 +269,7 @@ foreign import ccall "wrapper"
-- in the expression in order reverse to the order
-- of binding.
showExpr :: [CId] -> Expr -> String
-showExpr scope e =
+showExpr scope e =
unsafePerformIO $
withGuPool $ \tmpPl ->
do (sb,out) <- newOut tmpPl
diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal
index 91e77c77b..1d5f61991 100644
--- a/src/runtime/haskell-bind/pgf2.cabal
+++ b/src/runtime/haskell-bind/pgf2.cabal
@@ -1,19 +1,21 @@
name: pgf2
version: 1.3.0
+
+cabal-version: 1.22
+build-type: Simple
+license: LGPL-3
+license-file: LICENSE
+category: Natural Language Processing
synopsis: Bindings to the C version of the PGF runtime
description:
GF, Grammatical Framework, is a programming language for multilingual grammar applications.
GF grammars are compiled into Portable Grammar Format (PGF) which can be used with the PGF runtime, written in C.
This package provides Haskell bindings to that runtime.
-homepage: https://www.grammaticalframework.org
-license: LGPL-3
-license-file: LICENSE
+homepage: https://www.grammaticalframework.org/
+bug-reports: https://github.com/GrammaticalFramework/gf-core/issues
author: Krasimir Angelov
-maintainer: kr.angelov@gmail.com
-category: Language
-build-type: Simple
extra-source-files: CHANGELOG.md, README.md
-cabal-version: >=1.10
+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4
library
exposed-modules:
@@ -24,9 +26,9 @@ library
PGF2.Expr,
PGF2.Type
build-depends:
- base >=4.3 && <5,
- containers,
- pretty
+ base >= 4.9.1 && < 4.15,
+ containers >= 0.5.7 && < 0.7,
+ pretty >= 1.1.3 && < 1.2
default-language: Haskell2010
build-tools: hsc2hs
extra-libraries: pgf gu
diff --git a/src/runtime/haskell-bind/stack-ghc7.10.3.yaml b/src/runtime/haskell-bind/stack-ghc7.10.3.yaml
new file mode 100644
index 000000000..c916b4bb0
--- /dev/null
+++ b/src/runtime/haskell-bind/stack-ghc7.10.3.yaml
@@ -0,0 +1,3 @@
+resolver: lts-6.35 # ghc 7.10.3
+
+allow-newer: true
diff --git a/src/runtime/haskell-bind/stack-ghc8.0.2.yaml b/src/runtime/haskell-bind/stack-ghc8.0.2.yaml
new file mode 100644
index 000000000..af08206d9
--- /dev/null
+++ b/src/runtime/haskell-bind/stack-ghc8.0.2.yaml
@@ -0,0 +1 @@
+resolver: lts-9.21 # ghc 8.0.2
diff --git a/src/runtime/haskell-bind/stack-ghc8.10.4.yaml b/src/runtime/haskell-bind/stack-ghc8.10.4.yaml
new file mode 100644
index 000000000..195e90993
--- /dev/null
+++ b/src/runtime/haskell-bind/stack-ghc8.10.4.yaml
@@ -0,0 +1 @@
+resolver: lts-18.0 # ghc 8.10.4