刚刚安装了当前的 Haskell 平台 2012.2.0.0 , which says it uses base-4.5.0.0 base-4.5.0.0 includes the GHC.TypeLits module

但是,当我尝试加载 GHC.TypeLits 时, ghc 找不到它:

% ghci --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
% ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m +GHC.TypeLits

<no location info>:
    Could not find module `GHC.TypeLits'
    Perhaps you meant GHC.Types (from ghc-prim)
Prelude>
% ghc-pkg list base
/Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/lib/ghc-7.4.1/package.conf.d
   base-4.5.0.0
% ghc-pkg describe base
name: base
version: 4.5.0.0
id: base-4.5.0.0-a732a3518af7589b6c46f83e8ceae384
license: BSD3
copyright:
maintainer: libraries@haskell.org
stability:
homepage:
package-url:
synopsis: Basic libraries
description: This package contains the Prelude and its support libraries,
             and a large collection of useful libraries ranging from data
             structures to parsing combinators and debugging utilities.
category:
author:
exposed: True
exposed-modules: Foreign.Concurrent GHC.Arr GHC.Base 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.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.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.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.OldException 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
hidden-modules: GHC.Event.Array GHC.Event.Clock GHC.Event.Control
                GHC.Event.EPoll GHC.Event.IntMap GHC.Event.Internal
                GHC.Event.KQueue GHC.Event.Manager GHC.Event.PSQ GHC.Event.Poll
                GHC.Event.Thread GHC.Event.Unique Control.Monad.ST.Imp
                Control.Monad.ST.Lazy.Imp Foreign.ForeignPtr.Imp
trusted: False
import-dirs: /Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/lib/ghc-7.4.1/base-4.5.0.0
library-dirs: /Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/lib/ghc-7.4.1/base-4.5.0.0
hs-libraries: HSbase-4.5.0.0
extra-libraries: iconv
extra-ghci-libraries:
include-dirs: /Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/lib/ghc-7.4.1/base-4.5.0.0/include
includes: HsBase.h
depends: ghc-prim-0.2.0.0-bd29cb1ca1b712d64e00ac9207f87d0a
         integer-gmp-0.4.0.0-ec87c5d9609a1d46da031ef5d51c4f79 builtin_rts
hugs-options:
cc-options:
ld-options:
framework-dirs:
frameworks:
haddock-interfaces: /Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/share/doc/ghc/html/libraries/base-4.5.0.0/base.haddock
haddock-html: /Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/share/doc/ghc/html/libraries/base-4.5.0.0
pkgroot: "/Library/Frameworks/GHC.framework/Versions/7.4.1-i386/usr/lib/ghc-7.4.1"
%

发生什么了?假设 GHC.TypeLits 应该可用于当前的 Haskell 平台,我错了吗?或者我是否跳过了使其可用所需的步骤?

最佳答案

您链接到的文档页面似乎有些可疑。您的 GHC 声称是 7.4.1,它似乎确实使用了 base-4.5.0.0 ,并且 the GHC library documentationthe Hackage page 都显示 base-4.5.0.0 不包括 GHC.TypeLits 。这是完全合理的,因为 GHC 7.4.1 doesn't support type literalsGHC 7.6.1 不同。

关于haskell - 无法加载 GHC.TypeLits 模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12567642/

10-12 00:28
查看更多