Skip to content

called with unexpected argument '__functor' #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hamishmack opened this issue Apr 12, 2020 · 3 comments
Closed

called with unexpected argument '__functor' #542

hamishmack opened this issue Apr 12, 2020 · 3 comments

Comments

@hamishmack
Copy link
Collaborator

This is likely to be a common issue for people upgrading to the latest version of haskell.nix.

If you get an error like this after updating then the simplest fix is to update the nix
code to use the new API.

For example you may need to go from:

pkgs = import nixpkgsSrc (import haskellNixSrc);

to

pkgs = import nixpkgsSrc ((import haskellNixSrc {}).nixpkgsArgs);

You will need both the addition of {} and the use of .nixpkgsArgs.

@locallycompact
Copy link
Contributor

I'm trying to fix this error with a stack-to-nix setup like shown here (which has a small typo btw)

https://input-output-hk.github.io/haskell.nix/user-guide/stack-projects/#creating-the-package-set

but then I get the error

error: attempt to call something which is not a function but a string with context, at /home/lc/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/nix/default.nix:5:13

@hamishmack
Copy link
Collaborator Author

Thanks for the heads up. As well as the typo there were some places import was missing and that looks likely to have caused your issue. I have fixed up the docs with #543.

hamishmack added a commit that referenced this issue Jun 19, 2020
This was a nice idea, but in practice it did not work unless you
were explicitly extracting just `config`, `overlays` and `system`
(see #542).

```
~/iohk/haskell.nix$ nix-build -E 'import <nixpkgs> (import ./.)'
error: anonymous function at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/default.nix:20:1 called with unexpected argument '__functor', at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/impure.nix:84:1
```

This change will replace #542 errors with #707 errors.
hamishmack added a commit that referenced this issue Jun 19, 2020
This was a nice idea, but in practice it did not work unless you
were explicitly extracting just `config`, `overlays` and `system`
(see #542).

```
~/iohk/haskell.nix$ nix-build -E 'import <nixpkgs> (import ./.)'
error: anonymous function at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/default.nix:20:1 called with unexpected argument '__functor', at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/impure.nix:84:1
```

This change will replace #542 errors with #709 errors.
hamishmack added a commit that referenced this issue Jun 19, 2020
This was a nice idea, but in practice it did not work unless you
were explicitly extracting just `config`, `overlays` and `system`
(see #542).

```
~/iohk/haskell.nix$ nix-build -E 'import <nixpkgs> (import ./.)'
error: anonymous function at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/default.nix:20:1 called with unexpected argument '__functor', at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/impure.nix:84:1
```

This change will replace #542 errors with #709 errors.
@hamishmack
Copy link
Collaborator Author

Now the V1 interface is gone we will not see any more of these (with the latest haskell.nix), but we may see #709 instead.

booniepepper pushed a commit to booniepepper/haskell.nix that referenced this issue Feb 4, 2022
This was a nice idea, but in practice it did not work unless you
were explicitly extracting just `config`, `overlays` and `system`
(see input-output-hk#542).

```
~/iohk/haskell.nix$ nix-build -E 'import <nixpkgs> (import ./.)'
error: anonymous function at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/default.nix:20:1 called with unexpected argument '__functor', at /nix/store/f7mwvx7gl8lwjiqmpv60xapc3crvc474-nixpkgs-20.03pre194824.1f56d679f40/nixpkgs/pkgs/top-level/impure.nix:84:1
```

This change will replace input-output-hk#542 errors with input-output-hk#709 errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants