The hint library is a wrapper around the GHC api and allows the evaluation of Haskell expressions at run time. Just like ghc and ghci need a wrapper package to correctly access other installed Haskell packages at runtime so does the hint package and its dependancies.
A few of the dependent packages effected include
Other reverse dependancies can be found at:
Created gist with an example program that can not run. It is just the example code from the hint package with a one line modification:
@Davorak is this still broken? @peti any ideas here?
The sample program works just fine for me. I had to replace Control.Proxy with Pipes.Core because that module's been renamed in recent version of pipes. Then I set up my GHC environment:
haskellEnv = haskellPackages: with haskellPackages; [ pipes hint ];
packageOverrides = pkgs:
ghcDevEnv = pkgs.haskellPackages.ghcWithPackages haskellEnv;
ran nix-env -u haskell-env-ghc --always, updated the Shell environment:
nix-env -u haskell-env-ghc --always
NIX_GHC=$(type -p ghc)
if [ -n "$NIX_GHC" ]; then
eval $(grep export "$NIX_GHC")
and executed the example code:
$ runhaskell example.hs
Put the Prelude, Data.Map and *SomeModule in scope
Data.Map is qualified as M!
Now we can query the type of an expression
e.g. typeOf M.singleton (f, g, h, 42)
Num t => a -> M.Map ([a1] -> a1, [a2] -> a2, [a3] -> a3, t) a
Observe that f, g and h are defined in SomeModule.hs, but f is not exported. Let's check it...
[Fun "g",Fun "h"]
We can also evaluate an expression; the result will be a string
e.g. eval "M.singleton (f, g, h, 42)"
Or we can interpret it as a proper, say, int value!
This works for any monomorphic type, even for function types
e.g. we interpret \(Just x) -> succ x with type Maybe Int -> Int and apply it on Just 7
And sometimes we can even use the type system to infer the expected type (eg Maybe Bool -> Bool)!
Here we evaluate an expression of type string, that when evaluated (again) leads to a string
that's all folks
That works only with ghcWithPackages, though. Users of ghc-wrapper will probably still need a wrapper. There's not much we can do about that ... someone has to sit down and write those wrappers for these issues to be fixed. The code in ghc-mod might be a good starting point, because it does pretty much the same thing for ghc-mod that these other packages would need, too.