From 4e6c686dd496e9b7bdd209da3e8fbd3ac47de65a Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Thu, 1 Sep 2011 14:25:37 +0000 Subject: Get rid of some deprecation warnings & Use more explicit imports --- lib/Data/Packed/Internal/Matrix.hs | 12 ++++++++---- lib/Data/Packed/Internal/Vector.hs | 7 ++++++- lib/Data/Packed/Matrix.hs | 5 +++-- lib/Data/Packed/ST.hs | 12 ++++++++++-- lib/Numeric/GSL/Differentiation.hs | 5 ++++- lib/Numeric/GSL/Fitting.hs | 6 ++++-- lib/Numeric/GSL/Fourier.hs | 2 +- lib/Numeric/GSL/Integration.hs | 6 ++++-- lib/Numeric/GSL/Internal.hs | 5 ++++- lib/Numeric/GSL/Minimization.hs | 6 ++++-- lib/Numeric/GSL/ODE.hs | 6 ++++-- lib/Numeric/GSL/Polynomials.hs | 2 +- lib/Numeric/GSL/Root.hs | 6 ++++-- lib/Numeric/GSL/Vector.hs | 5 ++++- lib/Numeric/LinearAlgebra/LAPACK.hs | 7 ++++--- 15 files changed, 65 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 57142b7..d5fa5a0 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs @@ -39,10 +39,14 @@ import Data.Packed.Internal.Common import Data.Packed.Internal.Signatures import Data.Packed.Internal.Vector -import Foreign hiding (xor) -import Data.Complex -import Foreign.C.Types -import Foreign.C.String +import Foreign.Marshal.Alloc(alloca, free) +import Foreign.Marshal.Array(newArray) +import Foreign.Ptr(Ptr, castPtr) +import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf) +import Data.Complex(Complex) +import Foreign.C.Types(CInt, CChar) +import Foreign.C.String(newCString) +import System.IO.Unsafe(unsafePerformIO) ----------------------------------------------------------------- diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index 8f403f4..e5a7782 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs @@ -32,11 +32,16 @@ module Data.Packed.Internal.Vector ( import Data.Packed.Internal.Common import Data.Packed.Internal.Signatures -import Foreign +import Foreign.Marshal.Alloc(free) +import Foreign.Marshal.Array(peekArray, pokeArray, copyArray, advancePtr) +import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) +import Foreign.Ptr(Ptr) +import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) import Foreign.C.String import Foreign.C.Types(CInt,CChar) import Data.Complex import Control.Monad(when) +import System.IO.Unsafe(unsafePerformIO) #if __GLASGOW_HASKELL__ >= 605 import GHC.ForeignPtr (mallocPlainForeignPtrBytes) diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 0b23b2f..27fa36c 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs @@ -42,9 +42,10 @@ module Data.Packed.Matrix ( import Data.Packed.Internal import qualified Data.Packed.ST as ST -import Data.List(transpose,intersperse) import Data.Array -import Foreign.Storable + +import Data.List(transpose,intersperse) +import Foreign.Storable(Storable) import Control.Arrow((***)) ------------------------------------------------------------------- diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs index 2fad6ae..22aff07 100644 --- a/lib/Data/Packed/ST.hs +++ b/lib/Data/Packed/ST.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE BangPatterns #-} @@ -33,8 +34,15 @@ module Data.Packed.ST ( ) where import Data.Packed.Internal -import Control.Monad.ST -import Foreign + +import Control.Monad.ST(ST, runST) +import Foreign.Storable(Storable, peekElemOff, pokeElemOff) + +#if MIN_VERSION_base(4,4,0) +import Control.Monad.ST.Unsafe(unsafeIOToST) +#else +import Control.Monad.ST(unsafeIOToST) +#endif {-# INLINE ioReadV #-} ioReadV :: Storable t => Vector t -> Int -> IO t diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs index ebbada0..a3c1aea 100644 --- a/lib/Numeric/GSL/Differentiation.hs +++ b/lib/Numeric/GSL/Differentiation.hs @@ -22,9 +22,12 @@ module Numeric.GSL.Differentiation ( derivBackward ) where -import Foreign import Foreign.C.Types(CInt) +import Foreign.Marshal.Alloc(malloc, free) +import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) +import Foreign.Storable(peek) import Data.Packed.Internal(check,(//)) +import System.IO.Unsafe(unsafePerformIO) derivGen :: CInt -- ^ type: 0 central, 1 forward, 2 backward diff --git a/lib/Numeric/GSL/Fitting.hs b/lib/Numeric/GSL/Fitting.hs index e5aa528..337dc6a 100644 --- a/lib/Numeric/GSL/Fitting.hs +++ b/lib/Numeric/GSL/Fitting.hs @@ -51,10 +51,12 @@ module Numeric.GSL.Fitting ( import Data.Packed.Internal import Numeric.LinearAlgebra -import Foreign -import Foreign.C.Types(CInt) import Numeric.GSL.Internal +import Foreign.Ptr(FunPtr, freeHaskellFunPtr) +import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) + ------------------------------------------------------------------------- data FittingMethod = LevenbergMarquardtScaled -- ^ Interface to gsl_multifit_fdfsolver_lmsder. This is a robust and efficient version of the Levenberg-Marquardt algorithm as implemented in the scaled lmder routine in minpack. Minpack was written by Jorge J. More, Burton S. Garbow and Kenneth E. Hillstrom. diff --git a/lib/Numeric/GSL/Fourier.hs b/lib/Numeric/GSL/Fourier.hs index 22782b7..25487d4 100644 --- a/lib/Numeric/GSL/Fourier.hs +++ b/lib/Numeric/GSL/Fourier.hs @@ -22,8 +22,8 @@ module Numeric.GSL.Fourier ( import Data.Packed.Internal import Data.Complex -import Foreign import Foreign.C.Types(CInt) +import System.IO.Unsafe (unsafePerformIO) genfft code v = unsafePerformIO $ do r <- createVector (dim v) diff --git a/lib/Numeric/GSL/Integration.hs b/lib/Numeric/GSL/Integration.hs index 7103ea4..84e8546 100644 --- a/lib/Numeric/GSL/Integration.hs +++ b/lib/Numeric/GSL/Integration.hs @@ -20,10 +20,12 @@ module Numeric.GSL.Integration ( integrateQAGS ) where -import Foreign import Foreign.C.Types(CInt) +import Foreign.Marshal.Alloc(malloc, free) +import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) +import Foreign.Storable(peek) import Data.Packed.Internal(check,(//)) - +import System.IO.Unsafe(unsafePerformIO) {- | conversion of Haskell functions into function pointers that can be used in the C side -} diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs index 2ccc3ef..db2c633 100644 --- a/lib/Numeric/GSL/Internal.hs +++ b/lib/Numeric/GSL/Internal.hs @@ -13,8 +13,11 @@ module Numeric.GSL.Internal where import Data.Packed.Internal -import Foreign + +import Foreign.Marshal.Array(copyArray) +import Foreign.Ptr(Ptr, FunPtr) import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) iv f n p = f (createV (fromIntegral n) copy "iv") where diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs index 729f383..5770c91 100644 --- a/lib/Numeric/GSL/Minimization.hs +++ b/lib/Numeric/GSL/Minimization.hs @@ -62,10 +62,12 @@ module Numeric.GSL.Minimization ( import Data.Packed.Internal import Data.Packed.Matrix -import Foreign -import Foreign.C.Types(CInt) import Numeric.GSL.Internal +import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) +import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) + ------------------------------------------------------------------------ {-# DEPRECATED minimizeNMSimplex "use minimize NMSimplex2 eps maxit sizes f xi" #-} diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs index 912e8a8..ea064d6 100644 --- a/lib/Numeric/GSL/ODE.hs +++ b/lib/Numeric/GSL/ODE.hs @@ -33,10 +33,12 @@ module Numeric.GSL.ODE ( ) where import Data.Packed.Internal -import Foreign -import Foreign.C.Types(CInt) import Numeric.GSL.Internal +import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) +import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) + ------------------------------------------------------------------------- -- | Stepping functions diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs index 19e8944..9885920 100644 --- a/lib/Numeric/GSL/Polynomials.hs +++ b/lib/Numeric/GSL/Polynomials.hs @@ -21,7 +21,7 @@ module Numeric.GSL.Polynomials ( import Data.Packed.Internal import Data.Complex -import Foreign +import System.IO.Unsafe (unsafePerformIO) {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, the three solutions of x^3 + 8 = 0 diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs index ddb090d..784bbd4 100644 --- a/lib/Numeric/GSL/Root.hs +++ b/lib/Numeric/GSL/Root.hs @@ -51,10 +51,12 @@ module Numeric.GSL.Root ( import Data.Packed.Internal import Data.Packed.Matrix -import Foreign -import Foreign.C.Types(CInt) import Numeric.GSL.Internal +import Foreign.Ptr(FunPtr, freeHaskellFunPtr) +import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) + ------------------------------------------------------------------------- data RootMethod = Hybrids diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index 40abfa8..e912953 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs @@ -28,8 +28,11 @@ import Data.Packed.Internal.Signatures import Data.Packed.Internal.Vector import Data.Complex -import Foreign +import Foreign.Marshal.Alloc(free) +import Foreign.Marshal.Array(newArray) +import Foreign.Ptr(Ptr) import Foreign.C.Types(CInt) +import System.IO.Unsafe(unsafePerformIO) fromei x = fromIntegral (fromEnum x) :: CInt diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index fbc5460..2fac1ee 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs @@ -43,12 +43,13 @@ module Numeric.LinearAlgebra.LAPACK ( import Data.Packed.Internal import Data.Packed.Matrix ---import Data.Complex import Numeric.Conversion import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) -import Foreign -import Foreign.C.Types (CInt) + +import Foreign.Ptr(nullPtr) +import Foreign.C.Types(CInt) import Control.Monad(when) +import System.IO.Unsafe(unsafePerformIO) ----------------------------------------------------------------------------------- -- cgit v1.2.3