Corentin Dupont | 20 Mar 00:34 2013
Picon

Extracting exposed modules from an installed library

Hi Cafe!
I'm looking for how to extract the exposed modules (as a list of strings) from an installed library, giving the library name.
I can see some structures in Cabal (InstalledPackageInfo) and some functions in ghc-pkg.hs in GHC, but nothing readily useable...
Thanks,
Corenti

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Joachim Breitner | 20 Mar 23:23 2013
Picon

Re: Extracting exposed modules from an installed library

Hi,

Am Mittwoch, den 20.03.2013, 00:34 +0100 schrieb Corentin Dupont:
> Hi Cafe!
> I'm looking for how to extract the exposed modules (as a list of
> strings) from an installed library, giving the library name.
> I can see some structures in Cabal (InstalledPackageInfo) and some
> functions in ghc-pkg.hs in GHC, but nothing readily useable...

$ ghc-pkg field base exposed-modules
exposed-modules: Foreign.Concurrent GHC.Arr GHC.Base GHC.Char
                 GHC.Conc GHC.Conc.IO GHC.Conc.Signal GHC.Conc.Sync
                 GHC.ConsoleHandler GHC.Constants GHC.Desugar GHC.Enum
                 GHC.Environment GHC.Err GHC.Exception GHC.Exts GHC.Fingerprint
                 GHC.Fingerprint.Type GHC.Float GHC.Float.ConversionUtils
                 GHC.Float.RealFracMethods GHC.Foreign GHC.ForeignPtr GHC.Generics
                 GHC.GHCi GHC.Handle GHC.IO GHC.IO.Buffer GHC.IO.BufferedIO
                 GHC.IO.Device GHC.IO.Encoding GHC.IO.Encoding.CodePage
                 GHC.IO.Encoding.Failure GHC.IO.Encoding.Iconv
                 GHC.IO.Encoding.Latin1 GHC.IO.Encoding.Types GHC.IO.Encoding.UTF16
                 GHC.IO.Encoding.UTF32 GHC.IO.Encoding.UTF8 GHC.IO.Exception
                 GHC.IO.FD GHC.IO.Handle GHC.IO.Handle.FD GHC.IO.Handle.Internals
                 GHC.IO.Handle.Text GHC.IO.Handle.Types GHC.IO.IOMode GHC.IOArray
                 GHC.IOBase GHC.IORef GHC.IP GHC.Int GHC.List GHC.MVar GHC.Num
                 GHC.PArr GHC.Pack GHC.Ptr GHC.Read GHC.Real GHC.ST GHC.Stack
                 GHC.Stats GHC.Show GHC.Stable GHC.Storable GHC.STRef GHC.TypeLits
                 GHC.TopHandler GHC.Unicode GHC.Weak GHC.Word System.Timeout
                 GHC.Event Control.Applicative Control.Arrow Control.Category
                 Control.Concurrent Control.Concurrent.Chan Control.Concurrent.MVar
                 Control.Concurrent.QSem Control.Concurrent.QSemN
                 Control.Concurrent.SampleVar Control.Exception
                 Control.Exception.Base Control.Monad Control.Monad.Fix
                 Control.Monad.Instances Control.Monad.ST Control.Monad.ST.Safe
                 Control.Monad.ST.Unsafe Control.Monad.ST.Lazy
                 Control.Monad.ST.Lazy.Safe Control.Monad.ST.Lazy.Unsafe
                 Control.Monad.ST.Strict Control.Monad.Zip Data.Bits Data.Bool
                 Data.Char Data.Complex Data.Dynamic Data.Either Data.Eq Data.Data
                 Data.Fixed Data.Foldable Data.Function Data.Functor Data.HashTable
                 Data.IORef Data.Int Data.Ix Data.List Data.Maybe Data.Monoid
                 Data.Ord Data.Ratio Data.STRef Data.STRef.Lazy Data.STRef.Strict
                 Data.String Data.Traversable Data.Tuple Data.Typeable
                 Data.Typeable.Internal Data.Unique Data.Version Data.Word
                 Debug.Trace Foreign Foreign.C Foreign.C.Error Foreign.C.String
                 Foreign.C.Types Foreign.ForeignPtr Foreign.ForeignPtr.Safe
                 Foreign.ForeignPtr.Unsafe Foreign.Marshal Foreign.Marshal.Alloc
                 Foreign.Marshal.Array Foreign.Marshal.Error Foreign.Marshal.Pool
                 Foreign.Marshal.Safe Foreign.Marshal.Utils Foreign.Marshal.Unsafe
                 Foreign.Ptr Foreign.Safe Foreign.StablePtr Foreign.Storable Numeric
                 Prelude System.Console.GetOpt System.CPUTime System.Environment
                 System.Exit System.IO System.IO.Error System.IO.Unsafe System.Info
                 System.Mem System.Mem.StableName System.Mem.Weak
                 System.Posix.Internals System.Posix.Types
                 Text.ParserCombinators.ReadP Text.ParserCombinators.ReadPrec
                 Text.Printf Text.Read Text.Read.Lex Text.Show Text.Show.Functions
                 Unsafe.Coerce

Greetings,
Joachim

--

-- 
Joachim "nomeata" Breitner
Debian Developer
  nomeata <at> debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata <at> joachim-breitner.de | http://people.debian.org/~nomeata

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Corentin Dupont | 21 Mar 09:52 2013
Picon

Re: Extracting exposed modules from an installed library

Hi Joachim,
that's right thanks, but I was looking for a way to do that from a program.
ghc-pkg does not seems to expose any library...

On Wed, Mar 20, 2013 at 11:23 PM, Joachim Breitner <mail <at> joachim-breitner.de> wrote:
Hi,

Am Mittwoch, den 20.03.2013, 00:34 +0100 schrieb Corentin Dupont:
> Hi Cafe!
> I'm looking for how to extract the exposed modules (as a list of
> strings) from an installed library, giving the library name.
> I can see some structures in Cabal (InstalledPackageInfo) and some
> functions in ghc-pkg.hs in GHC, but nothing readily useable...

$ ghc-pkg field base exposed-modules
exposed-modules: Foreign.Concurrent GHC.Arr GHC.Base GHC.Char
                 GHC.Conc GHC.Conc.IO GHC.Conc.Signal GHC.Conc.Sync
                 GHC.ConsoleHandler GHC.Constants GHC.Desugar GHC.Enum
                 GHC.Environment GHC.Err GHC.Exception GHC.Exts GHC.Fingerprint
                 GHC.Fingerprint.Type GHC.Float GHC.Float.ConversionUtils
                 GHC.Float.RealFracMethods GHC.Foreign GHC.ForeignPtr GHC.Generics
                 GHC.GHCi GHC.Handle GHC.IO GHC.IO.Buffer GHC.IO.BufferedIO
                 GHC.IO.Device GHC.IO.Encoding GHC.IO.Encoding.CodePage
                 GHC.IO.Encoding.Failure GHC.IO.Encoding.Iconv
                 GHC.IO.Encoding.Latin1 GHC.IO.Encoding.Types GHC.IO.Encoding.UTF16
                 GHC.IO.Encoding.UTF32 GHC.IO.Encoding.UTF8 GHC.IO.Exception
                 GHC.IO.FD GHC.IO.Handle GHC.IO.Handle.FD GHC.IO.Handle.Internals
                 GHC.IO.Handle.Text GHC.IO.Handle.Types GHC.IO.IOMode GHC.IOArray
                 GHC.IOBase GHC.IORef GHC.IP GHC.Int GHC.List GHC.MVar GHC.Num
                 GHC.PArr GHC.Pack GHC.Ptr GHC.Read GHC.Real GHC.ST GHC.Stack
                 GHC.Stats GHC.Show GHC.Stable GHC.Storable GHC.STRef GHC.TypeLits
                 GHC.TopHandler GHC.Unicode GHC.Weak GHC.Word System.Timeout
                 GHC.Event Control.Applicative Control.Arrow Control.Category
                 Control.Concurrent Control.Concurrent.Chan Control.Concurrent.MVar
                 Control.Concurrent.QSem Control.Concurrent.QSemN
                 Control.Concurrent.SampleVar Control.Exception
                 Control.Exception.Base Control.Monad Control.Monad.Fix
                 Control.Monad.Instances Control.Monad.ST Control.Monad.ST.Safe
                 Control.Monad.ST.Unsafe Control.Monad.ST.Lazy
                 Control.Monad.ST.Lazy.Safe Control.Monad.ST.Lazy.Unsafe
                 Control.Monad.ST.Strict Control.Monad.Zip Data.Bits Data.Bool
                 Data.Char Data.Complex Data.Dynamic Data.Either Data.Eq Data.Data
                 Data.Fixed Data.Foldable Data.Function Data.Functor Data.HashTable
                 Data.IORef Data.Int Data.Ix Data.List Data.Maybe Data.Monoid
                 Data.Ord Data.Ratio Data.STRef Data.STRef.Lazy Data.STRef.Strict
                 Data.String Data.Traversable Data.Tuple Data.Typeable
                 Data.Typeable.Internal Data.Unique Data.Version Data.Word
                 Debug.Trace Foreign Foreign.C Foreign.C.Error Foreign.C.String
                 Foreign.C.Types Foreign.ForeignPtr Foreign.ForeignPtr.Safe
                 Foreign.ForeignPtr.Unsafe Foreign.Marshal Foreign.Marshal.Alloc
                 Foreign.Marshal.Array Foreign.Marshal.Error Foreign.Marshal.Pool
                 Foreign.Marshal.Safe Foreign.Marshal.Utils Foreign.Marshal.Unsafe
                 Foreign.Ptr Foreign.Safe Foreign.StablePtr Foreign.Storable Numeric
                 Prelude System.Console.GetOpt System.CPUTime System.Environment
                 System.Exit System.IO System.IO.Error System.IO.Unsafe System.Info
                 System.Mem System.Mem.StableName System.Mem.Weak
                 System.Posix.Internals System.Posix.Types
                 Text.ParserCombinators.ReadP Text.ParserCombinators.ReadPrec
                 Text.Printf Text.Read Text.Read.Lex Text.Show Text.Show.Functions
                 Unsafe.Coerce


Greetings,
Joachim

--
Joachim "nomeata" Breitner
Debian Developer
  nomeata <at> debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata <at> joachim-breitner.de | http://people.debian.org/~nomeata


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Ivan Lazar Miljenovic | 21 Mar 10:09 2013
Picon

Re: Extracting exposed modules from an installed library

On 21 March 2013 19:52, Corentin Dupont <corentin.dupont <at> gmail.com> wrote:
> Hi Joachim,
> that's right thanks, but I was looking for a way to do that from a program.
> ghc-pkg does not seems to expose any library...

http://hackage.haskell.org/packages/archive/Cabal/1.16.0.3/doc/html/Distribution-InstalledPackageInfo.html#t:InstalledPackageInfo_
?

>
> On Wed, Mar 20, 2013 at 11:23 PM, Joachim Breitner
> <mail <at> joachim-breitner.de> wrote:
>>
>> Hi,
>>
>> Am Mittwoch, den 20.03.2013, 00:34 +0100 schrieb Corentin Dupont:
>> > Hi Cafe!
>> > I'm looking for how to extract the exposed modules (as a list of
>> > strings) from an installed library, giving the library name.
>> > I can see some structures in Cabal (InstalledPackageInfo) and some
>> > functions in ghc-pkg.hs in GHC, but nothing readily useable...
>>
>> $ ghc-pkg field base exposed-modules
>> exposed-modules: Foreign.Concurrent GHC.Arr GHC.Base GHC.Char
>>                  GHC.Conc GHC.Conc.IO GHC.Conc.Signal GHC.Conc.Sync
>>                  GHC.ConsoleHandler GHC.Constants GHC.Desugar GHC.Enum
>>                  GHC.Environment GHC.Err GHC.Exception GHC.Exts
>> GHC.Fingerprint
>>                  GHC.Fingerprint.Type GHC.Float GHC.Float.ConversionUtils
>>                  GHC.Float.RealFracMethods GHC.Foreign GHC.ForeignPtr
>> GHC.Generics
>>                  GHC.GHCi GHC.Handle GHC.IO GHC.IO.Buffer
>> GHC.IO.BufferedIO
>>                  GHC.IO.Device GHC.IO.Encoding GHC.IO.Encoding.CodePage
>>                  GHC.IO.Encoding.Failure GHC.IO.Encoding.Iconv
>>                  GHC.IO.Encoding.Latin1 GHC.IO.Encoding.Types
>> GHC.IO.Encoding.UTF16
>>                  GHC.IO.Encoding.UTF32 GHC.IO.Encoding.UTF8
>> GHC.IO.Exception
>>                  GHC.IO.FD GHC.IO.Handle GHC.IO.Handle.FD
>> GHC.IO.Handle.Internals
>>                  GHC.IO.Handle.Text GHC.IO.Handle.Types GHC.IO.IOMode
>> GHC.IOArray
>>                  GHC.IOBase GHC.IORef GHC.IP GHC.Int GHC.List GHC.MVar
>> GHC.Num
>>                  GHC.PArr GHC.Pack GHC.Ptr GHC.Read GHC.Real GHC.ST
>> GHC.Stack
>>                  GHC.Stats GHC.Show GHC.Stable GHC.Storable GHC.STRef
>> GHC.TypeLits
>>                  GHC.TopHandler GHC.Unicode GHC.Weak GHC.Word
>> System.Timeout
>>                  GHC.Event Control.Applicative Control.Arrow
>> Control.Category
>>                  Control.Concurrent Control.Concurrent.Chan
>> Control.Concurrent.MVar
>>                  Control.Concurrent.QSem Control.Concurrent.QSemN
>>                  Control.Concurrent.SampleVar Control.Exception
>>                  Control.Exception.Base Control.Monad Control.Monad.Fix
>>                  Control.Monad.Instances Control.Monad.ST
>> Control.Monad.ST.Safe
>>                  Control.Monad.ST.Unsafe Control.Monad.ST.Lazy
>>                  Control.Monad.ST.Lazy.Safe Control.Monad.ST.Lazy.Unsafe
>>                  Control.Monad.ST.Strict Control.Monad.Zip Data.Bits
>> Data.Bool
>>                  Data.Char Data.Complex Data.Dynamic Data.Either Data.Eq
>> Data.Data
>>                  Data.Fixed Data.Foldable Data.Function Data.Functor
>> Data.HashTable
>>                  Data.IORef Data.Int Data.Ix Data.List Data.Maybe
>> Data.Monoid
>>                  Data.Ord Data.Ratio Data.STRef Data.STRef.Lazy
>> Data.STRef.Strict
>>                  Data.String Data.Traversable Data.Tuple Data.Typeable
>>                  Data.Typeable.Internal Data.Unique Data.Version Data.Word
>>                  Debug.Trace Foreign Foreign.C Foreign.C.Error
>> Foreign.C.String
>>                  Foreign.C.Types Foreign.ForeignPtr
>> Foreign.ForeignPtr.Safe
>>                  Foreign.ForeignPtr.Unsafe Foreign.Marshal
>> Foreign.Marshal.Alloc
>>                  Foreign.Marshal.Array Foreign.Marshal.Error
>> Foreign.Marshal.Pool
>>                  Foreign.Marshal.Safe Foreign.Marshal.Utils
>> Foreign.Marshal.Unsafe
>>                  Foreign.Ptr Foreign.Safe Foreign.StablePtr
>> Foreign.Storable Numeric
>>                  Prelude System.Console.GetOpt System.CPUTime
>> System.Environment
>>                  System.Exit System.IO System.IO.Error System.IO.Unsafe
>> System.Info
>>                  System.Mem System.Mem.StableName System.Mem.Weak
>>                  System.Posix.Internals System.Posix.Types
>>                  Text.ParserCombinators.ReadP
>> Text.ParserCombinators.ReadPrec
>>                  Text.Printf Text.Read Text.Read.Lex Text.Show
>> Text.Show.Functions
>>                  Unsafe.Coerce
>>
>>
>> Greetings,
>> Joachim
>>
>> --
>> Joachim "nomeata" Breitner
>> Debian Developer
>>   nomeata <at> debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
>>   JID: nomeata <at> joachim-breitner.de | http://people.debian.org/~nomeata
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe <at> haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

--

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic <at> gmail.com
http://IvanMiljenovic.wordpress.com

Gmane