[GHC] #9835: Add bindings for marshaling to/from mpz_t

#9835: Add bindings for marshaling to/from mpz_t -------------------------------------+------------------------------------- Reporter: dfranke | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: libraries (other) | Version: 7.8.3 Keywords: integer-gmp | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Please add bindings to allow efficient marshaling between Haskell Integer and C mpz_t's, e.g.: {{{ -- Wraps a (struct __mpz_struct*). type Mpz = Ptr () toMpz :: Integer -> IO Mpz fromMpz :: Mpz -> IO Integer }}} This would be useful for efficiently interfacing with foreign code that uses GMP. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9835 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9835: Add bindings for marshaling to/from mpz_t -------------------------------------+------------------------------------- Reporter: dfranke | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: libraries | Keywords: integer-gmp (other) | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by hvr): For one, `integer-gmp` has been completely rewritten, see #9281. Otoh, things like this should easily be implementable outside of `integer-gmp` in a 3rd party package. Alas, conversions between `Integer` and a `Mpz` pointer will involve allocations and `memcpy`s -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9835#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9835: Add bindings for marshaling to/from mpz_t -------------------------------------+------------------------------------- Reporter: dfranke | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: libraries | Keywords: integer-gmp (other) | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfranke):
Things like this should easily be implementable outside of integer-gmp in a 3rd party package.
I wrote it this morning :-). But since it relies on internals of both integer-gmp (treating `Integer` non-opaquely) and libgmp (treating `struct __mpz_struct` non-opaquely), I think having it merged into integer-gmp would create fewer maintenance headaches. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9835#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9835: Add bindings for marshaling to/from mpz_t -------------------------------------+------------------------------------- Reporter: dfranke | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: libraries | Keywords: integer-gmp (other) | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: #7860 Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #7860 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9835#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9835: Add bindings for marshaling to/from mpz_t -------------------------------------+------------------------------------- Reporter: dfranke | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.3 Component: libraries | Keywords: integer-gmp (other) | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: #3489,#7860 Type of failure: | None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * related: #7860 => #3489,#7860 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9835#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC