Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

ghc - Haskell timeit Module - SystemTimeIT not found

This must be very simple; but why this error:

PS C:UsersguthrieDesktop> cabal install --lib timeit
Resolving dependencies...
Up to date
PS C:UsersguthrieDesktop> ghci
GHCi, version 8.10.2: https://www.haskell.org/ghc/  :? for help
Prelude> :m System.TimeIt

<no location info>: error:
    Could not find module `System.TimeIt'
    Perhaps you meant System.Timeout (from base-4.14.1.0)
Prelude>
Leaving GHCi.

Hackage shows System.TimeIt as being defined in timeit-2.0, which is what cabal installed.

PS C:UsersguthrieDesktop> cabal install timeit
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
 - timeit-2.0 (lib) (requires download & build)
Downloading  timeit-2.0
Downloaded   timeit-2.0
Starting     timeit-2.0 (lib)
Building     timeit-2.0 (lib)
Installing   timeit-2.0 (lib)
Completed    timeit-2.0 (lib)

Checking again:

PS C:UsersguthrieDesktop> cabal install --lib timeit
Resolving dependencies...
Up to date

But trying to check on it from cabal info::

PS C:UsersguthrieDesktop> cabal info timeit
* timeit           (library)
    Synopsis:      Time monadic computations with an IO base.
    Versions available: 0.9.0.0, 1.0.0.0, 2.0
    Versions installed: [ Not installed ]
    Homepage:      https://github.com/merijn/timeit
    Bug reports:   https://github.com/merijn/timeit/issues
    Description:   A simple wrapper to show the used CPU time of monadic
                   computation with an IO base.
    Category:      System
    License:       BSD3
    Author:        Lennart Augustsson
    Maintainer:    Merijn Verstraaten <[email protected]>, Lennart Augustsson
    Source repo:   ssh://github.com:merijn/timeit.git
    Dependencies:  base >=3 && <5, transformers >=0.2 && <0.6
    Cached:        Yes
    Modules:
        System.TimeIt

So it reports: "Not installed". Same problem with criterion (Criterion.Main).

I see a note from 2/2020; that if a package is installed without the --lib option,

It does add the library to the package db in this case but does not add it to the default environment. (*https://github.com/haskell/cabal/issues/6262#issuecomment-589843722)

So I repeated the install with this option, no effect - just reported "Up to date".

That same link gave a solution (work-around?) to use instead cabal v1-install, which does work. But what would be the recommended simple solution to be able just to use ghci for testing small codes? Forced migration to stack, with local sandboxed and copies of everything for every small test?

Since I am only doing very simple short tests of examples, I was not creating a sandbox for each, and do not have a .cabal file, are those now necessary?!

(cabal 3.2.0.o, ghc 8.10.2, Windows 10)

question from:https://stackoverflow.com/questions/65836038/haskell-timeit-module-systemtimeit-not-found

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...