Skip to content
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

add a readonly computeStorePathForPath #144

Closed
wants to merge 2 commits into from

Conversation

layus
Copy link
Contributor

@layus layus commented Mar 23, 2021

No description provided.

@layus
Copy link
Contributor Author

layus commented Mar 23, 2021

It seems that it does not work correclty, for now. I do not get the right hash in the end :-/

@layus
Copy link
Contributor Author

layus commented Mar 24, 2021

Fixed in #145 🎉

@layus
Copy link
Contributor Author

layus commented Mar 24, 2021

I do not understand why I need AllowAmbiguousTypes and TypeFamilies here. Looks way overkill for that simple function.

@layus
Copy link
Contributor Author

layus commented Mar 24, 2021

Just to give an idea of what I am facing now:

src/System/Nix/ReadonlyStore.hs:76:28: error:
    • Could not deduce (NamedAlgo a0)
      from the context: NamedAlgo a
        bound by the type signature for:
                   computeStorePathForPath :: forall (a :: HashAlgorithm).
                                              NamedAlgo a =>
                                              StorePathName
                                              -> FilePath
                                              -> Bool
                                              -> (FilePath -> Bool)
                                              -> Bool
                                              -> IO StorePath
        at src/System/Nix/ReadonlyStore.hs:(76,28)-(82,26)
      The type variable ‘a0’ is ambiguous
    • In the ambiguity check for ‘computeStorePathForPath’
      To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
      In the type signature:
        computeStorePathForPath :: forall a.
                                   (NamedAlgo a) =>
                                   StorePathName
                                   -> FilePath -> Bool -> (FilePath -> Bool) -> Bool -> IO StorePath
   |
76 | computeStorePathForPath :: forall a. (NamedAlgo a)
   |                            ^^^^^^^^^^^^^^^^^^^^^^^...

@layus layus marked this pull request as ready for review March 24, 2021 02:08
@layus
Copy link
Contributor Author

layus commented Mar 24, 2021

Fixed everything :-). I think it is ready
@sorki Would you consider reviewing it ?

. ( ValidAlgo hashAlgo
, NamedAlgo hashAlgo
)
. (NamedAlgo hashAlgo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed superfluous parens here and pushed to master.

@sorki
Copy link
Member

sorki commented Mar 24, 2021

Thank you!

@sorki sorki closed this Mar 24, 2021
@layus
Copy link
Contributor Author

layus commented Mar 24, 2021 via email

-> FilePath -- ^ Local `FilePath` to add
-> Bool -- ^ Add target directory recursively
-> (FilePath -> Bool) -- ^ Path filter function
-> Bool -- ^ Only used by local store backend
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should do something about these two arguments but I'm not sure what.

@sorki
Copy link
Member

sorki commented Mar 24, 2021

Oops, I'm opening style can of worms discussion. Wanted to do that anyway, maybe we can ormolu everything and forget about such.

@layus layus deleted the ro-computeStorePathForPath branch March 24, 2021 10:27
@layus
Copy link
Contributor Author

layus commented Mar 24, 2021

maybe we can everything and forget about such.

Yes, I spend a lot of time indenting, formatting and similarly torturing myself to get formatting right, even though I do not have any strong opinion on the right formatting. Any automated tool would get rid of this wasted time.

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

Successfully merging this pull request may close these issues.

None yet

2 participants