mueval
mueval copied to clipboard
mueval fails with "Could not find module ‘ShowFun’" error
mueval (09b6a7aa5a25c4115442ea2e6ae0c2db557007f8) fails with the following error message:
<no location info>: error:
Could not find module ‘ShowFun’
Use -v to see a list of the files searched for.
I'm also getting this error after having installed mueval with Nix. Has any progress been made?
mueval
imports some modules by default (see https://github.com/gwern/mueval/blob/master/Mueval/Context.hs#L24-L93), incurring a runtime dependency on several packages (as far as I can see, those packages are show
, simple-reflect
, QuickCheck
, pretty
, containers
, mtl
; these are packages that mueval itself depends on, so in many environments it will just work. Nix is not such an enviroment.)
This default behavior can be overridden using the -n
(= --noimport
) command line flag, for example: mueval -n -e '[1..10]'
. Extra modules can be loaded with -m
(= --module
).
workaround for this:
you need to create a GHC environment file to provide mueval the needed libraries:
- cabal init (just to create a .cabal file)
- edit it and add the needed libraries, for example:
build-depends: base >=4.11 && <4.12
, show
, simple-reflect
, QuickCheck
, pretty
, containers
, mtl
, bytestring
- build it
cabal new-build
, this will create the GHC env file - provide the GHC env file to mueval upon execution:
GHC_ENVIRONMENT=.ghc.environment.x86_64-linux-8.4.3 mueval -e '(+1) <$> [1..100]'
For the case of building with stack, I found that stack exec -- myprogram
using mueval works fine, but I cannot just copy the executable to somewhere else and execute it directly without stack exec
; then I get Could not find module ‘ShowFun’
.